-
Notifications
You must be signed in to change notification settings - Fork 0
Screen
Screen is a new small struct that provides access to viewports and conversion between screen and room coordinates.
Compatibility: Screen struct is supported by AGS 3.5.0 and later versions.
static Point* Screen.RoomToScreenPoint(int rx, int ry);
Returns the point on screen corresponding to the given room coordinates if seen through the primary viewport. Resulting Point struct will contain screen x and y coordinates.
Function does the conversion from room to screen's coordinate system, correctly taking into account viewport's position on screen, camera's position in the room and its transformation (scaling etc).
This is a convenience function which is used when you do not manage viewports yourself but just using default one. If you have more than one custom viewport in your room consider Viewport.RoomToScreenPoint instead.
See Also: Screen.ScreenToRoomPoint, Viewport.RoomToScreenPoint, Viewport.ScreenToRoomPoint
static Point* Screen.ScreenToRoomPoint(int sx, int sy);
Returns the point in room corresponding to the given screen coordinates, but only if there's at least one visible viewport at that location. The conversion is done if seen through the topmost viewport. Resulting Point struct will contain room x and y coordinates.
If there are no viewports found there then this function returns null.
Function does the conversion from screen to room's coordinate system, correctly taking into account viewport's location on screen, camera's position in the room and its transformation (scaling etc).
See Also: Screen.RoomToScreenPoint, Viewport.RoomToScreenPoint, Viewport.ScreenToRoomPoint, Viewport.Visible, Viewport.ZOrder
static bool Screen.AutoSizeViewportOnRoomLoad;
Gets/sets whether the game should automatically adjust primary viewport and primary camera to the size of the room background each time the new room is loaded. This setting is enabled by default, and is the standard viewport behavior in AGS.
When this setting is on then every time the new room is loaded primary viewport and camera will be resized to match either the size of a room's background or game screen, whatever is smaller. The viewport will also be centered on game screen.
For example, if game is 320x200 and room is also 320x200, then both viewport and camera will be resized to 320x200 and cover whole screen. If game is 320x200 and room is 160x160, then both viewport and camera will be resized to 160x160 and viewport positioned in the center of screen (at 80, 20). If game is 320x200 and room is 400x200, then both viewport and camera will be resized to 320x200 again, and you'll have a scrolling room (one that is only partially seen at any time).
See Also: Viewport.SetPosition, Camera.SetSize
(Replaces System.ScreenHeight, which is now obsolete)
(Replaces System.ViewportHeight, which is now obsolete)
static readonly int Screen.Height;
Gets the native height of the game screen in pixels, which matches game resolution you set in the Editor.
NOTE: this is the game screen's logical size before any additional scaling is applied by the graphics renderer. It may or not be equal to the dimension of the final game image on player's display.
(Replaces System.ScreenWidth, which is now obsolete)
(Replaces System.ViewportWidth, which is now obsolete)
static readonly int Screen.Width;
Gets the native width of the game screen in pixels, which matches game resolution you set in the Editor.
NOTE: this is the game screen's logical size before any additional scaling is applied by the graphics renderer. It may or not be equal to the dimension of the final game image on player's display.
static readonly Viewport *Screen.Viewport;
Gets the primary room viewport. This is the default viewport that is created automatically at the start of the game and cannot be deleted.
See Also: Screen.Viewports, Viewport, Viewport.Create, Viewport.Delete, Game.Camera
static readonly int Screen.ViewportCount;
Gets the number of viewports.
See Also: Screen.Viewports
static readonly Viewport* Screen.Viewports[int index];
Returns the Viewport instance by its index. There's always at least primary viewport at the index 0, more could be created in script using Viewport.Create.
IMPORTANT: with the current implementation when you delete a custom viewport in the middle all the following viewports will be shifted towards beginning of array, changing their indexes.
Example:
for (int i = 0; i < Screen.ViewportCount; i++) {
Screen.Viewports[i].Visible = false;
}
Above disables (hides) all of the existing viewports.
See Also: Screen.Viewport, Screen.ViewportCount, Viewport.Create, Viewport.Delete, Game.Cameras
Getting Started in AGS
Editor Reference
- Music and sound
- Distributing your game
- Backing up your game
- The text parser
- Translations
- Global variables
- Custom Properties
- Plugins
- Lip sync
- New Game templates
- Debugging features
- Auto-number speech files
- Integration with Windows
- Source Control integration
Engine
Scripting
- Scripting tutorial part 1
- Scripting tutorial part 2
- Pointers in AGS
- Calling global functions from local scripts
- The script header
- String formatting
- Multiple Scripts
- Understanding blocking scripts
- Dynamic Arrays
- Extender functions
- Game variables
- Predefined global script functions
- repeatedly_execute (_always)
- Custom dialog options rendering
- Built-in enumerated types
- Script language keywords
- AudioChannel functions and properties
- AudioClip functions and properties
- Character functions and properties
- DateTime functions and properties
- Dialog functions and properties
- DialogOptionsRenderingInfo functions and properties
- DrawingSurface functions and properties
- DynamicSprite functions and properties
- File functions and properties
- Game / Global functions
- 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
- Multimedia functions
- Object functions and properties
- Overlay functions and properties
- Palette functions
- Parser functions
- Region functions and properties
- Room functions
- Screen functions
- Speech functions and properties
- String functions
- System functions and properties
- Text display / Speech functions
- ViewFrame functions and properties
Working on Legacy games
Upgrading from a previous version
- Upgrading to AGS 2.7
- Upgrading to AGS 2.71
- Upgrading to AGS 3.0
- Upgrading to AGS 3.1
- Upgrading to AGS 3.2
- Upgrading to AGS 3.3
- Upgrading to AGS 3.3.5
- Upgrading to AGS 3.4
- Upgrading to AGS 3.4.1
Legal Notice
Getting in touch