Make games that sell. |  |
| download
| order now
KInput
> Introduction
> Examples
> Showcase
> Documentation
| KWindow
| KGraphic
| KMiscTools
| KInput
| KText
| KTrueText
| KSpline
| KWeb
| KIniReader
| KResource
| K3D
| KSound
| KSound2
> History
> Download
> FAQ
> Credits
KInput : | Quick Reference
#include "KInput.h" Microsoft Windows: requires winmm.lib for joystick support. Mac OS X : IOKit required in the frameworks Click here for the list of virtual Keys | getMouseX getMouseY getLeftButtonState getRightButtonState showPointer getWheelValue hidePointer clipPointer isPressed mousePointerTo joyEnable joyDisable joyLeft joyRight joyUp joyDown joyButtonN joyX joyY joyWaitForJoyButtonUp waitForKeyRelease
static short getMouseX( void ) ;
Retrieves the X position of the Mouse Example : short xMouse = KInput::getMouseX( ) ;
static short getMouseY( void ) ;
Retrieves the Y position of the Mouse Example : short yMouse = KInput::getMouseY( ) ;
static bool getLeftButtonState( void ) ;
Returns the state of the left mouse button. ISDOWN if the button is down ( ISDOWN == true ) Example : bool isButtonDown ; isButtonDown= KInput::getLeftButtonState( );
static bool getRightButtonState( void ) ;
Returns the state of the right mouse button. ISDOWN if the button is down ( ISDOWN == true ) ISUP if the button is up. Example : bool isButtonDown ; isButtonDown= KInput::getRightButtonState( );
static void mousePointerTo( long x , long y ) ;
Moves the mouse to the specified coordinates Example : KInput::mousePointerTo( 50,50) ;
static void showPointer( void ) ;
Shows the operating system default mouse cursor. Example : KInput::showPointer( ) ;
static void hidePointer( void ) ;
Hides the operating system default mouse cursor. Example : KInput::hidePointer( ) ;
static void clipPointer( bool clipToWindow ) ;
Constrains the mouse into the window. set clipToWindow to true to constrain the mouse into the game window area. set clipToWindow to false to release the mouse. Not available on Mac os X Example : KInput::clipPointer(true ) ;
static bool isPressed( EKeyboardLayout keyCode ) ;
Returns ISDOWN if the key is down. Returns ISUP if the key is up. Example : if ( KInput::isPressed( K_VK_RIGHT ) == ISDOWN ) { moveSpriteToTheRight( ) ; }
static void waitForKeyRelease( EKeyboardLayout keyCode ) ;
Waits for a key to be released. Example : KInput::waitForKeyRelease( K_VK_RIGHT ) ; //wait for the right arrow key to be released
static bool joyEnable( char joyID )
Activates a joystick, returns true if a joystick is present and has been activated succesfuly joyID can be JOYSTICKID1 or JOYSTICKID2 Example : if ( KInput::joyEnable( JOYSTICKID1 ) == true ) { //yes a joystick is available! }
static void joyDisable( char joyID )
Deactivates a joystick. joyID can be JOYSTICKID1 or JOYSTICKID2 Example : KInput::joyDisable( JOYSTICKID1 ) ;
static bool joyLeft( char joyID )
Test the left state of a joystick. joyID can be JOYSTICKID1 or JOYSTICKID2 Returns ISDOWN if the joystick is pushed to the left Example : if ( KInput::joyLeft( JOYSTICKID1 ) == ISDOWN ) { moveSpriteToTheLeft( ) ; }
static bool joyRight( char joyID )
Test the right state of a joystick. joyID can be JOYSTICKID1 or JOYSTICKID2 Returns ISDOWN if the joystick is pushed to the right Example : if ( KInput::joyRight( JOYSTICKID1 ) == ISDOWN ) { moveSpriteToTheRight( ) ; }
static bool joyUp( char joyID )
Test the up state of a joystick. joyID can be JOYSTICKID1 or JOYSTICKID2 Returns ISDOWN if the joystick is pushed upward Example : if ( KInput::joyUp( JOYSTICKID1 ) == ISDOWN ) { moveSpriteUp( ) ; }
static bool joyDown( char joyID )
Test the down state of a joystick. joyID can be JOYSTICKID1 or JOYSTICKID2 Returns ISDOWN if the joystick is pushed downward Example : if ( KInput::joyDown( JOYSTICKID1 ) == ISDOWN ) { moveSpriteDown( ) ; }
static bool joyButtonN( char joyID , long buttonID )
Test the down state of a joystick button. joyID can be JOYSTICKID1 or JOYSTICKID2 buttonID ranges from BUTTON_1 to BUTTON_32 Returns ISDOWN if the joystick's button is pressed Example : if ( KInput::joyButtonN( JOYSTICKID1 , BUTTON_1 ) == ISDOWN ) { spriteJump( ) ; } Tests the first button of the pad/joystick.
static long joyX( char joyID , char hatID )
Test the position of a hat ( stick ) on an analog joystick. joyID can be K_JOYID1 or K_JOYID2 Returns a value between 0 and 65535. hatID can be either 0 or 1 Example : xIntensity = KInput::joyX( K_JOYID1 , 0 ) ; //gets the position of the first hat.
static long joyY( char joyID , char hatID )
Test the position of a hat ( stick ) on an analog joystick. joyID can be K_JOYID1 or K_JOYID2 Returns a value between 0 and 65535. hatID can be either 0 or 1 Example : yIntensity = KInput::joyY( K_JOYID1 , 1 ) ; //retrieves position of the second hat.
static void KInput::joyWaitForJoyButtonUp( char joyID , long buttonID )
Waits for a button to be released.
static short getWheelValue( void ) ;
Retrieves the last movement of the wheel Example : short mousewheel = KInput::getWheelValue( ) ;
© 2003-2005, Phelios, inc. - All rights reserved. Trademarks mentioned are the property of their respective owners.