|
|
@@ -1,25 +1,20 @@
|
|
|
-# Part I: Introduction to Nim via graphics
|
|
|
+# Глава 1. Введение
|
|
|
|
|
|
-## Chapter 1. Introduction
|
|
|
-
|
|
|
-In this chapter we will show the basics of Nim language (types, for loops, if
|
|
|
-and case statements, procedures, etc.) while using basic graphic primitives to
|
|
|
-create shapes.
|
|
|
-The premise is that the putPixel proc exists and we can use it, not worrying
|
|
|
-about its implementation details. All we need to know is: that proc takes the x
|
|
|
-and y coordinate of a point and its Color (default: white), and places a pixel of
|
|
|
-that color at those coordinates for us. This is how to use it:
|
|
|
+В этой главе мы рассмотрим основы языка **Nim** (типы, циклы `for`, операторы `if` и `case`, процедуры и т. д.), используя базовые графические примитивы для создания фигур. Предполагается, что процедура `putPixel` существует и мы можем ее использовать, не беспокоясь о деталях ее реализации. Все, что нам нужно знать: эта процедура принимает координаты `x` и `y` точки, а также ее цвет (по умолчанию — белый) и размещает в этих координатах пиксель указанного цвета. Вот как ее использовать:
|
|
|
|
|
|
```nim
|
|
|
- import pixels # 1
|
|
|
- putPixel(5, 9) # 2
|
|
|
- putPixel(11, 18, Red) # 3
|
|
|
+import pixels # 1
|
|
|
+
|
|
|
+putPixel(5, 9) # 2
|
|
|
+putPixel(11, 18, Red) # 3
|
|
|
```
|
|
|
|
|
|
-- 1 We import pixels so we can use the putPixel proc.
|
|
|
-- 2 Puts a white (that is the default color) pixel at the (5, 9) coordinate.
|
|
|
-- 3 Puts a red pixel at the (11, 18) coordinate.
|
|
|
+- 1 Мы импортируем пиксели, чтобы использовать процедуру `putPixel`.
|
|
|
+- 2 Помещает белый (цвет по умолчанию) пиксель в координаты (5, 9).
|
|
|
+- 3 Помещает красный пиксель в координаты (11, 18).
|
|
|
|
|
|
-Your Nim installation ships with a package manager called Nimble. Nimble
|
|
|
-can install additional packages. You can install the pixels library via:
|
|
|
- nimble install pixels
|
|
|
+В вашей установке **Nim** есть менеджер пакетов под названием **Nimble**. **Nimble** может устанавливать дополнительные пакеты. Вы можете установить библиотеку **pixels** с помощью:
|
|
|
+
|
|
|
+```bash
|
|
|
+nimble install pixels
|
|
|
+```
|