Interface ICoordinates
Utility methods to help convert between different coordinate systems:
- Window coordinates: those are the coordinates of the window which hosts the game (the units are based on the number of pixels the window has on your screen- determined from your screen resolution and display size).
- World coordinates: those are the coordinates of your game world (the units are based on your virtual resolution).
- Viewport coordinates: the game might have multiple viewports on the screen (for example, in a split-screen game). Each viewport can have its own coordinates. The world coordinates are actually the main viewport coordinates.
- Object coordinates: each object in the game can have its own coordinates. First, it can be using a IRenderLayer which has a different resolution than your world's resolution. Secondly, if the object is a child of another object, then the coordinate system is relative to the parent.
Namespace: AGS.API
Assembly: AGS.API.dll
Syntax
public interface ICoordinates
Methods
| Improve this Doc View SourceIsWorldInWindow(PointF)
Checks if the given world position is inside the window.
Declaration
bool IsWorldInWindow(PointF worldPosition)
Parameters
Type | Name | Description |
---|---|---|
PointF | worldPosition | World position. |
Returns
Type | Description |
---|---|
System.Boolean |
|
ViewportToWindow(IViewport, PointF)
Converts viewport coordinates to window coordinates.
Declaration
PointF ViewportToWindow(IViewport viewport, PointF position)
Parameters
Type | Name | Description |
---|---|---|
IViewport | viewport | Viewport. |
PointF | position | Position. |
Returns
Type | Description |
---|---|
PointF |
ViewportXToWindowX(IViewport, Single)
Converts a viewport X coordinate to the window X coordinate.
Declaration
float ViewportXToWindowX(IViewport viewport, float x)
Parameters
Type | Name | Description |
---|---|---|
IViewport | viewport | Viewport. |
System.Single | x | The x coordinate. |
Returns
Type | Description |
---|---|
System.Single |
ViewportYToWindowY(IViewport, Single)
Converts a viewport Y coordinate to the window Y coordinate.
Declaration
float ViewportYToWindowY(IViewport viewport, float y)
Parameters
Type | Name | Description |
---|---|---|
IViewport | viewport | Viewport. |
System.Single | y | The y coordinate. |
Returns
Type | Description |
---|---|
System.Single |
WindowToObject(IViewport, IObject, PointF)
Converts window coordinates to object coordinates.
Declaration
PointF WindowToObject(IViewport viewport, IObject obj, PointF position)
Parameters
Type | Name | Description |
---|---|---|
IViewport | viewport | Viewport. |
IObject | obj | Object. |
PointF | position | Position. |
Returns
Type | Description |
---|---|
PointF |
WindowToViewport(IViewport, PointF)
Converts window coordinates to viewport coordinates.
Declaration
PointF WindowToViewport(IViewport viewport, PointF position)
Parameters
Type | Name | Description |
---|---|---|
IViewport | viewport | Viewport. |
PointF | position | Position. |
Returns
Type | Description |
---|---|
PointF |
WindowToWorld(PointF)
Converts window coordinates to world coordinates.
Declaration
PointF WindowToWorld(PointF position)
Parameters
Type | Name | Description |
---|---|---|
PointF | position | Position. |
Returns
Type | Description |
---|---|
PointF |
WindowXToViewportX(IViewport, Single)
Converts a window X coordinate to the viewport X coordinate.
Declaration
float WindowXToViewportX(IViewport viewport, float x)
Parameters
Type | Name | Description |
---|---|---|
IViewport | viewport | Viewport. |
System.Single | x | The x coordinate. |
Returns
Type | Description |
---|---|
System.Single |
WindowXToWorldX(Single)
Converts a window X coordinate to the world X coordinate.
Declaration
float WindowXToWorldX(float x)
Parameters
Type | Name | Description |
---|---|---|
System.Single | x | The x coordinate. |
Returns
Type | Description |
---|---|
System.Single |
WindowYToViewportY(IViewport, Single)
Converts a window Y coordinate to the viewport Y coordinate.
Declaration
float WindowYToViewportY(IViewport viewport, float y)
Parameters
Type | Name | Description |
---|---|---|
IViewport | viewport | Viewport. |
System.Single | y | The y coordinate. |
Returns
Type | Description |
---|---|
System.Single |
WindowYToWorldY(Single)
Converts a window Y coordinate to the world Y coordinate.
Declaration
float WindowYToWorldY(float y)
Parameters
Type | Name | Description |
---|---|---|
System.Single | y | The y coordinate. |
Returns
Type | Description |
---|---|
System.Single |
WorldToWindow(PointF)
Converts world coordinates to window coordinates.
Declaration
PointF WorldToWindow(PointF position)
Parameters
Type | Name | Description |
---|---|---|
PointF | position | Position. |
Returns
Type | Description |
---|---|
PointF |
WorldXToWindowX(Single)
Converts a world X coordinate to the window X coordinate.
Declaration
float WorldXToWindowX(float x)
Parameters
Type | Name | Description |
---|---|---|
System.Single | x | The x coordinate. |
Returns
Type | Description |
---|---|
System.Single |
WorldYToWindowY(Single)
Converts a world Y coordinate to the window Y coordinate.
Declaration
float WorldYToWindowY(float y)
Parameters
Type | Name | Description |
---|---|---|
System.Single | y | The y coordinate. |
Returns
Type | Description |
---|---|
System.Single |