Open Game Engine 2D API
 All Functions Variables
Functions
Input

Functions

int OGE_GetKey ()
 Get current pressed key of the keyboard.
void OGE_HoldKeyEvent ()
 Stop broadcasting the key event.
void OGE_SkipMouseEvent ()
 Continue to broadcast the mouse event.
int OGE_GetScanCode ()
 Get the scan code of current pressed key in the keyboard.
void OGE_ShowKeyboard (bool bShow)
 Show the soft keyboard or not.
bool OGE_IsKeyboardShown ()
 Check if the soft keyboard is shown or not.
void OGE_SetKeyDown (int iKey)
 Fire a key down event.
void OGE_SetKeyUp (int iKey)
 Fire a key up event.
bool OGE_IsKeyDown (int iKey)
 Check if the key of the keyboard is pressed or not.
bool OGE_IsKeyDownTime (int iKey, int iInterval)
 Check whether the keyboard key is pressed again after the last time it was pressed.
int OGE_GetJoystickCount ()
 Return a count of the number of joysticks available.
bool OGE_IsJoyKeyDown (int iJoyId, int iKey)
 Check if the joystick key is pressed or not.
bool OGE_IsJoyKeyDownTime (int iJoyId, int iKey, int iInterval)
 Check if the joystick key is pressed again in a short time after it was pressed last time.
bool OGE_IsMouseLeftDown ()
 Check if the left button of the mouse is pressed or not.
bool OGE_IsMouseRightDown ()
 Check if the right button of the mouse is pressed or not.
bool OGE_IsMouseLeftUp ()
 Check if the left button of the mouse is up or not.
bool OGE_IsMouseRightUp ()
 Check if the right button of the mouse is up or not.
int OGE_GetMouseX ()
 Get the x coordinate of the position of the mouse cursor.
int OGE_GetMouseY ()
 Get the y coordinate of the position of the mouse cursor.
int OGE_GetCaretPos (int iSprId)
 Get the position of the caret of the text input editor.
void OGE_ResetCaretPos (int iSprId)
 Reset the position of the caret of the text input editor (reset it to be zero)
int OGE_GetInputTextBuffer (int iSprId)
 Get the text input buffer.
void OGE_ClearInputTextBuffer (int iSprId)
 Clear text input buffer.
int OGE_GetInputCharCount (int iSprId)
 Get the count of the characters of the input text.
string OGE_GetInputText (int iSprId)
 Get the input text.
int OGE_SetInputText (int iSprId, string sText)
 Fill the input text buffer with a string.
void OGE_SetInputWinPos (int iSprId, int iPosX, int iPosY)
 Set the position of the input window.

Function Documentation

void OGE_ClearInputTextBuffer ( int  iSprId)

Clear text input buffer.

Parameters:
[in]iSprIdThe ID of the text input sprite
int OGE_GetCaretPos ( int  iSprId)

Get the position of the caret of the text input editor.

Parameters:
[in]iSprIdThe ID of the text input sprite
Returns:
The position of the caret
int OGE_GetInputCharCount ( int  iSprId)

Get the count of the characters of the input text.

Parameters:
[in]iSprIdThe ID of the text input sprite
Returns:
The character count of the input text
string OGE_GetInputText ( int  iSprId)

Get the input text.

Parameters:
[in]iSprIdThe ID of the text input sprite
Returns:
The input text
int OGE_GetInputTextBuffer ( int  iSprId)

Get the text input buffer.

Parameters:
[in]iSprIdThe ID of the text input sprite
Returns:
The ID of the buffer

Return a count of the number of joysticks available.

Returns:
The count of the available joysticks
int OGE_GetKey ( )

Get current pressed key of the keyboard.

Returns:
The code of the key
int OGE_GetMouseX ( )

Get the x coordinate of the position of the mouse cursor.

Returns:
The x coordinate of the position of the mouse cursor
int OGE_GetMouseY ( )

Get the y coordinate of the position of the mouse cursor.

Returns:
The y coordinate of the position of the mouse cursor
int OGE_GetScanCode ( )

Get the scan code of current pressed key in the keyboard.

Returns:
The scan code of the key
bool OGE_IsJoyKeyDown ( int  iJoyId,
int  iKey 
)

Check if the joystick key is pressed or not.

Parameters:
[in]iJoyIdThe ID of the joystick
[in]iKeyThe joystick key
Returns:
Returns true if the key is pressed
bool OGE_IsJoyKeyDownTime ( int  iJoyId,
int  iKey,
int  iInterval 
)

Check if the joystick key is pressed again in a short time after it was pressed last time.

Parameters:
[in]iJoyIdThe ID of the joystick
[in]iKeyThe joystick key
[in]iIntervalThe short time
Returns:
Returns true if the key is pressed again

Check if the soft keyboard is shown or not.

Returns:
Returns true if the soft keyboard is shown on the screen
bool OGE_IsKeyDown ( int  iKey)

Check if the key of the keyboard is pressed or not.

Parameters:
[in]iKeyThe key code
Returns:
Returns true if the key is pressed
bool OGE_IsKeyDownTime ( int  iKey,
int  iInterval 
)

Check whether the keyboard key is pressed again after the last time it was pressed.

Parameters:
[in]iKeyThe keyboard key
[in]iIntervalThe waiting time after the last time it was pressed
Returns:
Returns true if the key is pressed again in the waiting time

Check if the left button of the mouse is pressed or not.

Returns:
Returns true if the left button is pressed

Check if the left button of the mouse is up or not.

Returns:
Returns true if the left button is up

Check if the right button of the mouse is pressed or not.

Returns:
Returns true if the right button is pressed

Check if the right button of the mouse is up or not.

Returns:
Returns true if the right button is up
void OGE_ResetCaretPos ( int  iSprId)

Reset the position of the caret of the text input editor (reset it to be zero)

Parameters:
[in]iSprIdThe ID of the text input sprite
int OGE_SetInputText ( int  iSprId,
string  sText 
)

Fill the input text buffer with a string.

Parameters:
[in]iSprIdThe ID of the text input sprite
[in]sTextThe string used to fill the buffer
Returns:
The length of the string in the input buffer
void OGE_SetInputWinPos ( int  iSprId,
int  iPosX,
int  iPosY 
)

Set the position of the input window.

Parameters:
[in]iSprIdThe ID of the text input sprite
[in]iPosXThe x coordinate of the position of the input window
[in]iPosYThe y coordinate of the position of the input window
void OGE_SetKeyDown ( int  iKey)

Fire a key down event.

Parameters:
[in]iKeyThe key code for the key event
void OGE_SetKeyUp ( int  iKey)

Fire a key up event.

Parameters:
[in]iKeyThe key code for the key event
void OGE_ShowKeyboard ( bool  bShow)

Show the soft keyboard or not.

Parameters:
[in]bShowIf true then show the keyboard, otherwise hide it