-
Notifications
You must be signed in to change notification settings - Fork 9
Camera
Camera struct lets you manage room cameras. Camera is like a rectangular "eye" that floats above the room and captures what it sees. Captured camera's image may then be translated somewhere else. Right now AGS only supports drawing camera's contents over viewport on screen, but its uses may be extended in future.
Camera is defined by its size and position inside the room. The larger camera's rectangle is - the more room space will be seen at once. Camera cannot be larger than the current room's background though. Also it is forbidden to move camera outside of the room background, even by a pixel.
There's always at least one camera called "primary camera", and you may create more. Note that, although cameras display the room, in their current implementation they are considered global persistent objects and automatically change rooms with player's character.
Cameras are linked to the viewports using Viewport.Camera property. A camera may be thus linked to any number of different viewports, in which case they all will display same place in the room.
By default camera's size is set equal to room background or game screen size, whatever is smaller, but you may change that anytime. When camera is linked to a viewport the camera's contents are stretched to fill viewport's rectangle, and because of that the difference between viewport's and camera's sizes create zoom effect (scaling). If the camera is larger than the viewport that would work as a zoom-out (scale down). If the camera is smaller than the viewport that would work as a zoom-in (scale up).
By default camera follows player character, this is called "auto-tracking". You may override this by disabling Camera.AutoTracking property.
IMPORTANT: The game starts in automatic viewport mode that snaps primary viewport to whole screen and adjusts the camera to the same size (or at least the size of room background) each time new room is loaded. This is convenient in case you want to rely on a common behavior. If you prefer to customize cameras yourself standard behavior may be disabled using Screen.AutoSizeViewportOnRoomLoad property.
Compatibility: Camera struct is supported by AGS 3.5.0 and later versions.
static Camera* Camera.Create();
Creates a new camera and returns a pointer which you may use to operate it. Any camera created like this may be also accessed by Game.Cameras by index. The new camera will by default be located at the room's (0, 0) and assigned a size of game screen or room background, whatever is smaller. It will also be autotracking. You may change any of its properties later.
See Also: Camera.Delete, Game.Camera, Game.Cameras, Viewport.Camera
void Camera.Delete();
Removes an existing camera. Primary camera can be never removed and this command issued for the primary camera will be ignored.
IMPORANT: in Game.Cameras array cameras are arranged in the order they were created. When you delete one in the middle all the following cameras will be shifted towards beginning of array.
See Also: Camera.Create, Game.Camera, Game.Cameras
void Camera.SetAt(int x, int y);
Changes camera position in the room and disables automatic tracking of the player character.
See Also: Camera.SetSize, Camera.AutoTracking, Camera.X, Camera.Y, Camera.Width, Camera.Height
void Camera.SetSize(int width, int height);
Changes camera's capture dimensions in room coordinates.
If the camera's size is larger than the viewport it is drawn in then the room will be scaled down (zoom-out effect), if camera is smaller than the viewport then the room will be scaled up (zoom-in effect).
See Also: Camera.SetAt, Camera.X, Camera.Y, Camera.Width, Camera.Height
bool Camera.AutoTracking;
Gets/sets whether this camera will follow the player character automatically. Otherwise camera retains its position until you change it in script or turn tracking back on.
See Also: Camera.SetAt, Camera.X, Camera.Y
int Camera.Height;
Gets/sets the camera's capture height in room coordinates.
See Also: Camera.SetAt, Camera.SetSize, Camera.X, Camera.Y, Camera.Width
int Camera.Width;
Gets/sets the camera's capture width in room coordinates.
See Also: Camera.SetAt, Camera.SetSize, Camera.X, Camera.Y, Camera.Height
int Camera.X;
Gets/sets the X position of this camera in the room. If you assign new value that will disable automatic tracking.
See Also: Camera.SetAt, Camera.SetSize, Camera.AutoTracking, Camera.Y, Camera.Width, Camera.Height
int Camera.Y;
Gets/sets the Y position of this camera in the room. If you assign new value that will disable automatic tracking.
See Also: Camera.SetAt, Camera.SetSize, Camera.AutoTracking, Camera.X, Camera.Width, Camera.Height
Getting Started in AGS
Editor
- New Game templates
- Editor Preferences
- General Settings
- Default Setup
- Colours Editor
- Room Editor
- Character Editor
- Cursor Editor
- Dialog Editor
- Font Preview
- GUI Editor
- Inventory Items Editor
- View Editor
- Sprite Manager
- Music and sound
- Voice speech
- Script Modules
- System limits
- Log Panel
- Plugins
- Other Features
Engine
Scripting
- Scripting Tutorial
- Scripting Language
-
Scripting API
- Script API Overview
- Standard Constants
- Standard Enumerated Types
- Standard Types
- Game variables
- Global arrays
- Global event handlers
- repeatedly_execute / repeatedly_execute_always
- Custom dialog options rendering
- Global functions: general
- Global functions: message display
- Global functions: multimedia actions
- Global functions: palette operations
- Global functions: room actions
- Global functions: screen effects
- Global functions: wait
- AudioChannel functions and properties
- AudioClip functions and properties
- Camera functions and properties
- Character functions and properties
- DateTime functions and properties
- Dialog functions and properties
- DialogOptionsRenderingInfo functions and properties
- Dictionary functions and properties
- DrawingSurface functions and properties
- DynamicSprite functions and properties
- File functions and properties
- Game functions and properties
- GUI functions and properties
- GUI control functions and properties
- GUI Button functions and properties
- GUI InvWindow functions and properties
- GUI Label functions and properties
- GUI List Box functions and properties
- GUI Slider properties
- GUI Text Box functions and properties
- Hotspot functions and properties
- Inventory item functions and properties
- Maths functions and properties
- Mouse functions and properties
- Object functions and properties
- Overlay functions and properties
- Parser functions
- Region functions and properties
- Room functions and properties
- Screen functions and properties
- Set functions and properties
- Speech functions and properties
- String functions
- System functions and properties
- TextWindowGUI functions and properties
- ViewFrame functions and properties
- Viewport functions and properties
- Obsolete Script API
- Event Types
- Key code table
- Audio in script
Legal Notice
Getting in touch
Misc