In ENIGMA, a view is a region on the screen assigned to display a region in your game world. By default, a room contains one view which displays the entire content of the room on a window of equal size. That is, if your room is 640x480, a 640x480 window will be created to display the contents of your room. This still applies even if your room is larger than the size of the display. In these cases, you probably want to assign views.
A viewport is a region in the window, or on the screen. Its dimensions correspond to actual user units, as displayed on the user's monitor. Thus, the largest useful viewport size is the user's resolution. A very common default viewport size is 640x480. A less common, more modern default viewport size is 800x600. These are typically positioned at (0, 0), except where other views occupy the top-left region of the window. Viewports used for status boxes or menus are usually smaller, and positioned elsewhere on the screen. In many games, these values remain hard-coded. In other games, they are computed using methods such as display_get_width/display_get_height.
If your game window is positioned on your screen at (100, 100), and your window border is 4px thick with a 24px title bar (this is controlled by the window manager and is not accessible to ENIGMA), the upper-left corner of your actual game viewport will be at (104, 124), and this will be the real coordinate of a viewport positioned at (0, 0). You can use window functions such as window_get_x/window_get_y to fetch the (100, 100). Presently, no functions exist to accurately fetch the border and title bar size. (It may be possible to fetch the (104,124) on Windows using the GL/DX display HWND separately.)
This is the area in the game that a view represents. It can have any real size, and any real position. Most commonly, the position coordinates range from zero to room_width and room_height for x and y, respectively, and the width and height are usually identical to the viewport width and height. This prevents unsightly stretching or scaling. In games where those are desirable, the view region width and height are usually related to the viewport width and height by some inverse power-of-two, eg, a half or a quarter. This causes pixelation reminiscent of retro games.
When there is disparity between the viewport dimensions and the view region dimensions, the view region dimensions define the in-game coordinates.
For any occasion wherein pivoting the angle of the current view about an unspecified point is useful, ENIGMA also offers the GM:S
For your convenience, ENIGMA provides functionality to automatically move views to follow an object. If you assign an object to a view, the viewing region will automatically move around the room to keep the first instance of that object in sight.
If you have assigned a view object, the view border is a margin of viewing space guaranteed to be found around the player. A view border of (0,0) will likely be regarded as annoying, as the player will not be able to see what is ahead while moving. Typically a value slightly less than half the view region width and height are used for the border width and height. For example, if you view is sized 640x480, a good border size might be 300, 220.
This border is not related to the window border and does not correspond to real screen coordinates. It uses in-game coordinates.
If you have assigned a view object, the view speed is the maximum speed at which the view object is followed.
While you may occasionally want to use functions such as room_set_view to assign to a room, you more likely will want to set view parameters immediately. Changing the views in each room this way can be done up front, but will only take effect once the room is reloaded, as no relationship is guaranteed between the default room view assignment and the (mutable) room variables during gameplay.
You can edit view properties live using the following variables:
|The x-coordinate, in screen space, of the port of this view in the window. This, and other variables in this category, will almost certainly be integers.|
|The y-coordinate, in screen space, of the port of this view in the window.|
|The width, in screen space, of the port of this view in the window.|
|The height, in screen space, of the port of this view in the window.|
|View region variables|
|The x-coordinate, in game space, of the port of this view in the window. This, and other variables in this category, may be integers or floating point numbers, depending on the in-game coordinate system.|
|The y-coordinate, in game space, of the port of this view in the window.|
|The width, in game space, of the port of this view in the window.|
|The height, in game space, of the port of this view in the window.|
|The angle at which to tilt this view about an arbitrary axis, probably given by the center of the current view.|
|View object/border variables|
| An identifying ID of the object to follow. Assigning to an instance ID will cause the view to follow that instance so long as it exists. Assigning an object index, such as |
| The horizontal border to allow around the object being followed, in game space. This guarantees, to the extent logically possible, that at least |
| The vertical border to allow around the object being followed, in game space. This guarantees, to the extent logically possible, that at least |
|The maximum horizontal speed at which to follow objects, in game space.|
|The maximum vertical speed at which to follow objects, in game space.|