Input

Input

Description

Responsible for input event processing for mouse and keyboard events. This includes mouse visibility, mouse movement and button clicks (including the scroll wheel as button "click" events) and keyboard events for text input and key state checking.

Accelerometer Threshold

Returns false when the key requested is being held down. This is updated as part of the ProcessEvents call. Use the key codes from KeyCode to specify the key to be checked.

  • Accelerometer Threshold () : Single [show]

    Returns false when the key requested is being held down. This is updated as part of the ProcessEvents call. Use the key codes from KeyCode to specify the key to be checked.

    Returns:
    Single :
    Signatures by Language:
    C/C++: float get_accelerometer_threshold();
    C++: float accelerometer_threshold();
    Pascal: function AccelerometerThreshold(): Single;
  • Accelerometer Threshold (value) [show]

    Returns false when the key requested is being held down. This is updated as part of the ProcessEvents call. Use the key codes from KeyCode to specify the key to be checked.

    Parameters:
    value : Single
    Signatures by Language:
    C/C++: void set_accelerometer_threshold(float value);
    C++: void accelerometer_threshold(float value);
    Pascal: procedure AccelerometerThreshold(value: Single);

Any Key Pressed

Checks to see if any key has been pressed since the last time ProcessEvents was called.

  • Any Key Pressed () : Boolean [show]

    Checks to see if any key has been pressed since the last time ProcessEvents was called.

    Returns:
    Boolean :
    Signatures by Language:
    C/C++: bool any_key_pressed();
    Pascal: function AnyKeyPressed(): Boolean;

Device Moved In XAxis

Returns a value ranging from 0 to 1 showing delta in x Axis from level(being flat on the ground).

  • Device Moved In XAxis () : Single [show]

    Returns a value ranging from 0 to 1 showing delta in x Axis from level(being flat on the ground).

    Returns:
    Single :
    Signatures by Language:
    C/C++: float device_moved_in_xaxis();
    Pascal: function DeviceMovedInXAxis(): Single;

Device Moved In YAxis

Returns a value ranging from 0 to 1 showing delta in y Axis from level(being flat on the ground).

  • Device Moved In YAxis () : Single [show]

    Returns a value ranging from 0 to 1 showing delta in y Axis from level(being flat on the ground).

    Returns:
    Single :
    Signatures by Language:
    C/C++: float device_moved_in_yaxis();
    Pascal: function DeviceMovedInYAxis(): Single;

Device Moved In ZAxis

Returns a value ranging from 0 to 1 showing delta in z Axis from level(being flat on the ground).

  • Device Moved In ZAxis () : Single [show]

    Returns a value ranging from 0 to 1 showing delta in z Axis from level(being flat on the ground).

    Returns:
    Single :
    Signatures by Language:
    C/C++: float device_moved_in_zaxis();
    Pascal: function DeviceMovedInZAxis(): Single;

End Reading Text

Returns the string that has been read since StartReadingText or StartReadingTextWithText was called.


Fingers On Screen

Returns an Array of Fingers that are on the screen.

  • Fingers On Screen () : FingerArray [show]

    Returns an Array of Fingers that are on the screen.

    Returns:
    FingerArray :
    Signatures by Language:
    C/C++: void fingers_on_screen(finger_array result, int32_t result_len);
    Pascal: function FingersOnScreen(): FingerArray;

Hide Keyboard

Hides iOS Keyboard


Hide Mouse

Tells the mouse cursor to hide (no longer visible) if it is currently showing. Use ShowMouse to make the mouse cursor visible again.

  • Hide Mouse () [show]

    Tells the mouse cursor to hide (no longer visible) if it is currently showing. Use ShowMouse to make the mouse cursor visible again.


Key Down

Returns true when the key requested is being held down. This is updated as part of the ProcessEvents call. Use the key codes from KeyCode to specify the key to be checked.

  • Key Down (key) : Boolean [show]

    Returns true when the key requested is being held down. This is updated as part of the ProcessEvents call. Use the key codes from KeyCode to specify the key to be checked.

    Parameters:
    key : KeyCode
    Returns:
    Boolean :
    Signatures by Language:
    C/C++: bool key_down(key_code key);
    Pascal: function KeyDown(key: KeyCode): Boolean;

Key Name

The KeyName function returns a string name for a given KeyCode. For example, vk_Comma returns the string 'Comma'. This function could be used to display more meaningful key names for configuring game controls, etc.

  • Key Name (key) : String [show]

    The KeyName function returns a string name for a given KeyCode. For example, vk_Comma returns the string 'Comma'. This function could be used to display more meaningful key names for configuring game controls, etc.

    Parameters:
    key : KeyCode
    Returns:
    String :
    Signatures by Language:
    C/C++: void key_name(key_code key, char *result);
    Pascal: function KeyName(key: KeyCode): String;

Key Released

Returns true if the specified key was released since the last time ProcessEvents was called. This occurs only once for the key that is released and will not return true again until the key is pressed down and released again.

  • Key Released (key) : Boolean [show]

    Returns true if the specified key was released since the last time ProcessEvents was called. This occurs only once for the key that is released and will not return true again until the key is pressed down and released again.

    Parameters:
    key : KeyCode
    Returns:
    Boolean :
    Signatures by Language:
    C/C++: bool key_released(key_code key);
    Pascal: function KeyReleased(key: KeyCode): Boolean;

Key Typed

Returns true when the key requested is just pressed down. This is updated as part of the ProcessEvents call. Use the key codes from KeyCode to specify the key to be checked. this will only occur once for that key that is pressed and will not return true again until the key is released and presssed down again

  • Key Typed (key) : Boolean [show]

    Returns true when the key requested is just pressed down. This is updated as part of the ProcessEvents call. Use the key codes from KeyCode to specify the key to be checked. this will only occur once for that key that is pressed and will not return true again until the key is released and presssed down again

    Parameters:
    key : KeyCode
    Returns:
    Boolean :
    Signatures by Language:
    C/C++: bool key_typed(key_code key);
    Pascal: function KeyTyped(key: KeyCode): Boolean;

Key Up

Returns false when the key requested is being held down. This is updated as part of the ProcessEvents call. Use the key codes from KeyCode to specify the key to be checked.

  • Key Up (key) : Boolean [show]

    Returns false when the key requested is being held down. This is updated as part of the ProcessEvents call. Use the key codes from KeyCode to specify the key to be checked.

    Parameters:
    key : KeyCode
    Returns:
    Boolean :
    Signatures by Language:
    C/C++: bool key_up(key_code key);
    Pascal: function KeyUp(key: KeyCode): Boolean;

Keyboard Shown

returns boolean indicating if iOS keyboard is shown

  • Keyboard Shown () : Boolean [show]

    returns boolean indicating if iOS keyboard is shown

    Returns:
    Boolean :
    Signatures by Language:
    C/C++: bool keyboard_shown();
    Pascal: function KeyboardShown(): Boolean;

Mouse Clicked

Returns true if the specified button was clicked since the last time ProcessEvents was called

  • Mouse Clicked (button) : Boolean [show]

    Returns true if the specified button was clicked since the last time ProcessEvents was called

    Parameters:
    button : MouseButton
    Returns:
    Boolean :
    Signatures by Language:
    C/C++: bool mouse_clicked(mouse_button button);
    Pascal: function MouseClicked(button: MouseButton): Boolean;

Mouse Down

Returns true if the specified button is currently pressed down.

  • Mouse Down (button) : Boolean [show]

    Returns true if the specified button is currently pressed down.

    Parameters:
    button : MouseButton
    Returns:
    Boolean :
    Signatures by Language:
    C/C++: bool mouse_down(mouse_button button);
    Pascal: function MouseDown(button: MouseButton): Boolean;

Mouse Movement

Returns the amount of accumulated mouse movement, since the last time ProcessEvents was called, as a Vector.

  • Mouse Movement () : Vector [show]

    Returns the amount of accumulated mouse movement, since the last time ProcessEvents was called, as a Vector.

    Returns:
    Vector :
    Signatures by Language:
    C/C++: vector mouse_movement();
    Pascal: function MouseMovement(): Vector;

Mouse Position

Returns the current window position of the mouse as a Point2D

  • Mouse Position () : Point2D [show]

    Returns the current window position of the mouse as a Point2D

    Returns:
    Point2D :
    Signatures by Language:
    C/C++: point2d mouse_position();
    Pascal: function MousePosition(): Point2D;

Mouse Position As Vector

Returns The current window position of the mouse as a Vector

  • Mouse Position As Vector () : Vector [show]

    Returns The current window position of the mouse as a Vector

    Returns:
    Vector :
    Signatures by Language:
    C/C++: vector mouse_position_as_vector();
    Pascal: function MousePositionAsVector(): Vector;

Mouse Shown

Returns true if the mouse is currently visible, false if not.

  • Mouse Shown () : Boolean [show]

    Returns true if the mouse is currently visible, false if not.

    Returns:
    Boolean :
    Signatures by Language:
    C/C++: bool mouse_shown();
    Pascal: function MouseShown(): Boolean;

Mouse Up

Returns true if the specified button is currently up.

  • Mouse Up (button) : Boolean [show]

    Returns true if the specified button is currently up.

    Parameters:
    button : MouseButton
    Returns:
    Boolean :
    Signatures by Language:
    C/C++: bool mouse_up(mouse_button button);
    Pascal: function MouseUp(button: MouseButton): Boolean;

Mouse X

Returns the current x value of the mouse's position.

  • Mouse X () : Single [show]

    Returns the current x value of the mouse's position.

    Returns:
    Single :
    Signatures by Language:
    C/C++: float mouse_x();
    Pascal: function MouseX(): Single;

Mouse Y

Returns the current y value of the mouse's position.

  • Mouse Y () : Single [show]

    Returns the current y value of the mouse's position.

    Returns:
    Single :
    Signatures by Language:
    C/C++: float mouse_y();
    Pascal: function MouseY(): Single;

Move Mouse

Moves the mouse cursor to the specified screen location.

  • Move Mouse (const point) [show]

    Moves the mouse cursor to the specified screen location.

    Parameters:
    point : Point2D
    Signatures by Language:
    C/C++: void move_mouse_to_point(const point2d *point);
    C/C++: void move_mouse_to_point_byval(const point2d point);
    C++: void move_mouse(const point2d &point);
    Pascal: procedure MoveMouse(const point: Point2D);
  • Move Mouse (x, y) [show]

    Moves the mouse cursor to the specified screen location.

    Parameters:
    x : Byte
    y : Byte
    Signatures by Language:
    C/C++: void move_mouse(unsigned char x, unsigned char y);
    Pascal: procedure MoveMouse(x: Byte; y: Byte);

Number Of Fingers On Screen

Returns the number of fingers that are currently on the screen.

  • Number Of Fingers On Screen () : Longint [show]

    Returns the number of fingers that are currently on the screen.

    Returns:
    Longint :
    Signatures by Language:
    C/C++: int32_t number_of_fingers_on_screen();
    Pascal: function NumberOfFingersOnScreen(): Longint;

Process Events

ProcessEvents allows the SwinGame API to react to user interactions. This routine checks the current keyboard and mouse states. This routine must be called frequently within your game loop to enable user interaction.

Side Effects - Reads user interaction events - Updates keys down, text input, etc.

  • Process Events () [show]

    ProcessEvents allows the SwinGame API to react to user interactions. This routine checks the current keyboard and mouse states. This routine must be called frequently within your game loop to enable user interaction.

    Side Effects - Reads user interaction events - Updates keys down, text input, etc.


Reading Text

ReadingText indicates if the API is currently reading text from the user. Calling StartReadingText will set this to true, and it becomes false when the user presses enter or escape. At this point you can read the string entered as either ASCII or Unicode.

  • Reading Text () : Boolean [show]

    ReadingText indicates if the API is currently reading text from the user. Calling StartReadingText will set this to true, and it becomes false when the user presses enter or escape. At this point you can read the string entered as either ASCII or Unicode.

    Returns:
    Boolean :
    Signatures by Language:
    C/C++: bool reading_text();
    Pascal: function ReadingText(): Boolean;

Screen Touched

returns a boolean indicating if the screen was touched.

  • Screen Touched () : Boolean [show]

    returns a boolean indicating if the screen was touched.

    Returns:
    Boolean :
    Signatures by Language:
    C/C++: bool screen_touched();
    Pascal: function ScreenTouched(): Boolean;

Show Keyboard

Shows iOS Keyboard


Show Mouse

Tells the mouse cursor to be visible if it was previously hidden with by a HideMouse or SetMouseVisible(False) call.

  • Show Mouse () [show]

    Tells the mouse cursor to be visible if it was previously hidden with by a HideMouse or SetMouseVisible(False) call.

  • Show Mouse (show) [show]

    Used to explicitly set the mouse cursors visible state (if it is showing in the window or not) based on the show parameter.

    Parameters:
    show : Boolean
    Signatures by Language:
    C/C++: void set_mouse_visible(bool show);
    C++: void show_mouse(bool show);
    Pascal: procedure ShowMouse(show: Boolean);

Start Reading Text

Start reading text within an area. Entry is completed when the user presses ENTER, and aborted with ESCAPE. If the user aborts entry the result is an empty string, and TextEntryCancelled will return true. Text entry is updated during ProcessEvents, and text is drawn to the screen as part of the RefreshScreen call.

  • Start Reading Text (textColor, maxLength, theFont, const area) [show]

    Start reading text within an area. Entry is completed when the user presses ENTER, and aborted with ESCAPE. If the user aborts entry the result is an empty string, and TextEntryCancelled will return true. Text entry is updated during ProcessEvents, and text is drawn to the screen as part of the RefreshScreen call.

    Parameters:
    textColor : Color
    maxLength : Longint
    theFont : Font
    area : Rectangle
    Signatures by Language:
    C/C++: void start_reading_text_within_area(color textColor, int32_t maxLength, font theFont, const rectangle *area);
    C/C++: void start_reading_text_within_area_byval(color textColor, int32_t maxLength, font theFont, const rectangle area);
    C++: void start_reading_text(color textColor, int32_t maxLength, font theFont, const rectangle &area);
    Pascal: procedure StartReadingText(textColor: Color; maxLength: Longint; theFont: Font; const area: Rectangle);
  • Start Reading Text (textColor, maxLength, theFont, x, y) [show]

    Starts the reading of a string of characters from the user. Entry is completed when the user presses ENTER, and aborted with ESCAPE. If the user aborts entry the result is an empty string, and TextEntryCancelled will return true. Text entry is updated during ProcessEvents, and text is drawn to the screen as part of the RefreshScreen call.

    Parameters:
    textColor : Color
    maxLength : Longint
    theFont : Font
    x : Longint
    y : Longint
    Signatures by Language:
    C/C++: void start_reading_text(color textColor, int32_t maxLength, font theFont, int32_t x, int32_t y);
    Pascal: procedure StartReadingText(textColor: Color; maxLength: Longint; theFont: Font; x: Longint; y: Longint);

Start Reading Text With Text

The same as StartReadingText but with an additional text parameter that is displayed as default text to the user.

  • Start Reading Text With Text (text, textColor, maxLength, theFont, const pt) [show]

    The same as StartReadingText but with an additional text parameter that is displayed as default text to the user.

    Parameters:
    text : String
    textColor : Color
    maxLength : Longint
    theFont : Font
    pt : Point2D
    Signatures by Language:
    C/C++: void start_reading_text_with_text_at_pt(const char *text, color textColor, int32_t maxLength, font theFont, const point2d *pt);
    C/C++: void start_reading_text_with_text_at_pt_byval(const char *text, color textColor, int32_t maxLength, font theFont, const point2d pt);
    C++: void start_reading_text_with_text(const char *text, color textColor, int32_t maxLength, font theFont, const point2d &pt);
    Pascal: procedure StartReadingTextWithText(text: String; textColor: Color; maxLength: Longint; theFont: Font; const pt: Point2D);
  • Start Reading Text With Text (text, textColor, maxLength, theFont, const area) [show]

    The same as StartReadingText but with an additional text parameter that is displayed as default text to the user.

    Parameters:
    text : String
    textColor : Color
    maxLength : Longint
    theFont : Font
    area : Rectangle
    Signatures by Language:
    C/C++: void start_reading_text_with_text_in_area(const char *text, color textColor, int32_t maxLength, font theFont, const rectangle *area);
    C/C++: void start_reading_text_with_text_in_area_byval(const char *text, color textColor, int32_t maxLength, font theFont, const rectangle area);
    C++: void start_reading_text_with_text(const char *text, color textColor, int32_t maxLength, font theFont, const rectangle &area);
    Pascal: procedure StartReadingTextWithText(text: String; textColor: Color; maxLength: Longint; theFont: Font; const area: Rectangle);
  • Start Reading Text With Text (text, textColor, backGroundColor, maxLength, theFont, const area) [show]

    The same as StartReadingTextWithText but with text and bgColor parameter that is displayed as default text to the user.

    Parameters:
    text : String
    textColor : Color
    backGroundColor : Color
    maxLength : Longint
    theFont : Font
    area : Rectangle
    Signatures by Language:
    C/C++: void start_reading_text_with_text_and_color_in_area(const char *text, color textColor, color backGroundColor, int32_t maxLength, font theFont, const rectangle *area);
    C/C++: void start_reading_text_with_text_and_color_in_area_byval(const char *text, color textColor, color backGroundColor, int32_t maxLength, font theFont, const rectangle area);
    C++: void start_reading_text_with_text(const char *text, color textColor, color backGroundColor, int32_t maxLength, font theFont, const rectangle &area);
    Pascal: procedure StartReadingTextWithText(text: String; textColor: Color; backGroundColor: Color; maxLength: Longint; theFont: Font; const area: Rectangle);
    • source code
    • lib name: StartReadingTextWithTextAndColorInArea
  • Start Reading Text With Text (text, textColor, maxLength, theFont, x, y) [show]

    The same as StartReadingText but with an additional text parameter that is displayed as default text to the user.

    Parameters:
    text : String
    textColor : Color
    maxLength : Longint
    theFont : Font
    x : Longint
    y : Longint
    Signatures by Language:
    C/C++: void start_reading_text_with_text(const char *text, color textColor, int32_t maxLength, font theFont, int32_t x, int32_t y);
    Pascal: procedure StartReadingTextWithText(text: String; textColor: Color; maxLength: Longint; theFont: Font; x: Longint; y: Longint);

Text Entry Cancelled

Returns true if the text entry started with StartReadingText was cancelled.

  • Text Entry Cancelled () : Boolean [show]

    Returns true if the text entry started with StartReadingText was cancelled.

    Returns:
    Boolean :
    Signatures by Language:
    C/C++: bool text_entry_cancelled();
    Pascal: function TextEntryCancelled(): Boolean;

Text Read As ASCII

TextReadAsASCII allows you to read the value of the string entered by the user as ASCII. See TextReasAsUNICODE, StartReadingText and ReadingText for more details.

  • Text Read As ASCII () : String [show]

    TextReadAsASCII allows you to read the value of the string entered by the user as ASCII. See TextReasAsUNICODE, StartReadingText and ReadingText for more details.

    Returns:
    String :
    Signatures by Language:
    C/C++: void text_read_as_ascii(char *result);
    Pascal: function TextReadAsASCII(): String;

Toggle Keyboard

Toggles iOS Keyboard


Window Close Requested

Checks to see if the window has been asked to close. You need to handle this if you want the game to end when the window is closed. This value is updated by the ProcessEvents routine.

  • Window Close Requested () : Boolean [show]

    Checks to see if the window has been asked to close. You need to handle this if you want the game to end when the window is closed. This value is updated by the ProcessEvents routine.

    Returns:
    Boolean : True if the window has been requested to close.
    Signatures by Language:
    C/C++: bool window_close_requested();
    Pascal: function WindowCloseRequested(): Boolean;