Show / Hide Table of Contents

    Interface ICoordinates

    Utility methods to help convert between different coordinate systems:

    1. 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).
    2. World coordinates: those are the coordinates of your game world (the units are based on your virtual resolution).
    3. 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.
    4. 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 Source

    IsWorldInWindow(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

    true, if world position is inside the window, false otherwise.

    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    WindowToWorld(PointF)

    Converts window coordinates to world coordinates.

    Declaration
    PointF WindowToWorld(PointF position)
    Parameters
    Type Name Description
    PointF position

    Position.

    Returns
    Type Description
    PointF
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    WorldToWindow(PointF)

    Converts world coordinates to window coordinates.

    Declaration
    PointF WorldToWindow(PointF position)
    Parameters
    Type Name Description
    PointF position

    Position.

    Returns
    Type Description
    PointF
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    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
    • Improve this Doc
    • View Source
    Back to top Generated by DocFX