Interface IViewport
It might be that not all of the room is shown on the screen at once (for example, a scrolling room). A viewport to the room instructs the engine on what parts of the room to show.
Inherited Members
Namespace: AGS.API
Assembly: AGS.API.dll
Syntax
public interface IViewport : INotifyPropertyChanged
Properties
| Improve this Doc View SourceAngle
The rotation angle (in degrees) of the viewport.
Declaration
float Angle { get; set; }
Property Value
Type | Description |
---|---|
System.Single | The angle. |
Camera
Gets or sets the camera which automatically manipulates the viewport to follow a target (usually the player).
Declaration
ICamera Camera { get; set; }
Property Value
Type | Description |
---|---|
ICamera | The camera. |
DisplayListSettings
Allows to control what will be seen via the viewport.
Declaration
IDisplayListSettings DisplayListSettings { get; }
Property Value
Type | Description |
---|---|
IDisplayListSettings | The display list settings. |
Interactive
Can the user interact with objects in the viewport?
Declaration
bool Interactive { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Parent
Adds the ability to attach a viewport to an object. This makes the ProjectionBox of the viewport be relative to that object.
Declaration
IObject Parent { get; set; }
Property Value
Type | Description |
---|---|
IObject | The parent. |
Pivot
Gets or sets the pivot point from which the position, scale and rotation of the viewport are determined. For example, rotating the viewport from its center point will rotate it in place, while rotating it from its bottom-left point will rotate the entire viewport around the bottom-left. It might help to think of the pivot as the point on an image on which you place your finger on before rotating.
The units of the pivot point is in relation to the viewport size, where (0f,0f) is the bottom-left corner, and (1f,1f) is the top-right corner. The default is (0f, 0f), which means the bottom-left point of the viewport.
Declaration
PointF Pivot { get; set; }
Property Value
Type | Description |
---|---|
PointF | The pivot. |
Examples
viewport.Pivot = new PointF(0.5f, 0.5f); //placing the pivot point in the middle of the viewport
|
Improve this Doc
View Source
ProjectionBox
Gets or sets the box into which the viewport will project into. The measurement for the box is the overall factor to the window size. So, for example, a rectangle with (x,y) = (0,0) and (width,height) = (1,1) will be projected onto the entire window (this is the default), and a rectangle with (x,y) = (0.25,0.25) and (width,height) = (0.5,0.5) will be projected on half the window and will be centered.
Note: the projection box respects the "keep aspect ratio" setting (PreserveAspectRatio), so if that option is enabled in the settings (on by default), the "window size" is without the black side-bars.
Declaration
RectangleF ProjectionBox { get; set; }
Property Value
Type | Description |
---|---|
RectangleF | The projection box. |
RoomProvider
Gets or sets the room provider, which returns the room currently shown by the viewport.
Declaration
IRoomProvider RoomProvider { get; set; }
Property Value
Type | Description |
---|---|
IRoomProvider | The room provider. |
ScaleX
The horizontal zoom factor of the room.
Declaration
float ScaleX { get; set; }
Property Value
Type | Description |
---|---|
System.Single | The scale x. |
ScaleY
The vertical zoom factor of the room.
Declaration
float ScaleY { get; set; }
Property Value
Type | Description |
---|---|
System.Single | The scale y. |
ScreenArea
Gets the area (in window co-ordinates) used by the viewport.
Declaration
Rectangle ScreenArea { get; }
Property Value
Type | Description |
---|---|
Rectangle | The screen area. |
X
The left location of the room from which to show the screen.
Declaration
float X { get; set; }
Property Value
Type | Description |
---|---|
System.Single | The x. |
Y
The bottom location for the room from which to show the screen.
Declaration
float Y { get; set; }
Property Value
Type | Description |
---|---|
System.Single | The y. |
Z
Gets or sets the Z ordering for the viewport. The smaller the number, the more visible the viewport gets..
Declaration
float Z { get; set; }
Property Value
Type | Description |
---|---|
System.Single | The z. |
Methods
| Improve this Doc View SourceGetMatrix(IRenderLayer)
Gets the matrix used to transform objects from the viewport co-ordinates to the screen co-ordinates.
Declaration
Matrix4 GetMatrix(IRenderLayer layer)
Parameters
Type | Name | Description |
---|---|---|
IRenderLayer | layer | Layer. |
Returns
Type | Description |
---|---|
Matrix4 | The matrix. |
GetScreenArea(IGameSettings, IWindowInfo, Boolean)
Refreshs the screen area for the viewport (this is called by the engine).
Declaration
Rectangle GetScreenArea(IGameSettings settings, IWindowInfo window, bool updateArea)
Parameters
Type | Name | Description |
---|---|---|
IGameSettings | settings | Settings. |
IWindowInfo | window | Window. |
System.Boolean | updateArea | Should we update the screen area internally? This is not always desired, like if we're setting a viewport for a frame buffer and not the screen. |
Returns
Type | Description |
---|---|
Rectangle |
IsObjectVisible(IObject)
Checks whether a given object should be visible in the viewport.
Declaration
bool IsObjectVisible(IObject obj)
Parameters
Type | Name | Description |
---|---|---|
IObject | obj | Object. |
Returns
Type | Description |
---|---|
System.Boolean |
|