zglTCamera2D = record
X, Y : Single;
Angle : Single;
Zoom : zglTPoint2D;
Center: zglTPoint2D;
end;
Rus: смотрите demo07, в данной демке активно используется камера.
Координаты для X идут слева направо, для Y снизу вверх.
При запуске проекта сразу создаётся камера со своими параметрами: constCamera2D: zglTCamera2D = (X: 0; Y: 0; Angle: 0; Zoom: (X: 1; Y: 1); Center: (X: 0; Y: 0));
Структура zglTCamera2D содержит в себе:
- координаты X и Y.
- Angle - угол поворота .
- Zoom - шкалу масштабирования по X и Y.
- Center - координаты центра камеры.
Eng: see demo07, this demo actively uses the camera.
The coordinates for X go from left to right, for Y from bottom to top.
When you start the project, a camera is immediately created with its parameters: constCamera2D: zglTCamera2D = (X: 0; Y: 0; Angle: 0; Zoom: (X: 1; Y: 1); Center: (X: 0; Y: 0 ));
The zglTCamera2D structure contains:
- coordinates X and Y.
- Angle - rotation angle.
- Zoom - scaling scale along X and Y.
- Center - coordinates of the camera center.
procedure cam2d_DefInit(out Camera: zglTCamera2D);
Rus: инициализация камеры по умолчанию.
Вы должны объявить камеру в своей программе, например:
- camMain: zglTCamera2D;
и передать эту камеру в процедуру. Все остальные действия вы можете совершать в процедуре обработки таймера, процедуре обработки клавиатуры/мыши/тачскрина/джойстика или процедуре обновления (Update). Это изменение:
- координат X и Y.
- угла вращения Angle.
- шкалу отображения Zoom.
- центр экрана Center.
Так же вы можете это сделать используя процедуры описанные ниже.
Eng: default camera initialization.
You must declare the camera in your program, for example:
- camMain: zglTCamera2D;
and pass this camera to the procedure. You can perform all other actions in the timer processing procedure, the keyboard/mouse/touchscreen/joystick processing procedure, or the Update procedure. This change:
- coordinates X and Y.
- rotation angle Angle.
- display scale Zoom.
- screen center Center.
You can also do this using the procedures described below.
procedure cam2d_Init(out Camera: zglTCamera2D; offsetX, offsetY, centerX, CenterY, angle: Single; zoom: Single = 1);
Rus: инициализация камеры с заданными значениями.
Эта процедура такая же как и предыдущая, но с возможностью указать:
- координаты смещения камеры.
- координаты центра камеры.
- угол поворота камеры.
- шкалу отображения.
Важно знать!!! Если вы смещаете камеру влево, то изображение сместится вправо, если вы сместите камеру вверх, то изображение сместится вниз. И т.д.
Eng: initializing the camera with the given values.
This procedure is the same as the previous one, but with the ability to specify:
- camera offset coordinates.
- coordinates of the camera center.
- camera rotation angle.
- display scale.
It is important to know!!! If you move the camera to the left, the image will move to the right; if you move the camera up, the image will move down. Etc.
procedure cam2d_SetCenter(Camera: zglPCamera2D; x, y: Single);
Rus: задать координаты центра камеры.
Eng: set the coordinates of the camera center.
procedure cam2d_SetTranslate(Camera: zglPCamera2D; x, y: Single);
Rus: задать координаты смещения камеры.
Eng: set camera offset coordinates.
procedure cam2d_SetAngle(Camera: zglPCamera2D; Angle: Single);
Rus: задать угол вращения камеры.
Eng: set the camera rotation angle.
procedure cam2d_SetZoom(Camera: zglPCamera2D; zoomX, zoomY: Single);
Rus: задать шкалу размерности по осям X и Y.
Eng: set the dimension scale along the X and Y axes.
procedure cam2d_Set(Camera: zglPCamera2D);
Rus: установка используемой камеры.
Данная процедура позволяет использовать несколько камер одновременно, меняя их в нужный момент времени. При передаче в процедуру значения nil будет включена камера по умолчанию, та что создалась при запуске проекта.
Eng: installation of the camera used.
This procedure allows you to use several cameras simultaneously, changing them at the right time. When passing the value nil to the procedure, the default camera will be turned on, the one that was created when the project was launched.
function cam2d_Get : zglPCamera2D;
Rus: возвращает камеру которая используется в данный момент времени.
Eng: returns the camera that is currently in use.