Input

From Leadwerks Developer Wiki

Jump to: navigation, search

Contents

Introduction

Leadwerks Engine 2 allows input from the keyboard and mouse. Because keyboard and mouse input are tied to the graphics window, input commands will not work if an external custom buffer is used.


Use the chart at the right to view keyboard equivalents for the engine. Put KEY_ before the text on the key you want to access.

Commands

LE2 Keyboard Equivalents
LE2 Keyboard Equivalents
LE2 Mouse Equivalents
LE2 Mouse Equivalents

Keyboard

KeyDown

  • C: int KeyDown( int key = KEY_ESCAPE )
  • C++: static bool Keyboard::IsDown( int key = KEY_ESCAPE ) const
  • BlitzMax: KeyDown:Int( key:Int )
  • Pascal: function KeyDown ( key:Integer=KEY_SPACE ): Integer;
Returns 1 if the specified key is being held down, else returns 0.
[Examples]

KeyHit

  • C: int KeyHit( int key )
  • C++: static bool Keyboard::IsHit( int key = KEY_ESCAPE ) const
  • BlitzMax: KeyHit:Int( key:Int )
  • Pascal: function KeyHit ( key:Integer=KEY_ESCAPE ): Integer;
Returns 1 if the specified key has been pressed since the last call to KeyHit(), else returns 0.
[Examples]

GetChar

  • C: int GetChar()
  • C++: static int Keyboard::GetChar() const
Returns the last character that was typed. Reacts correctly when the user holds a key for some time, resulting in multiple keystrokes.
[Examples]

Mouse

MouseX

  • C: int MouseX()
  • C++: static int Mouse::GetX( void ) const
  • BlitzMax: MouseX:Int()
  • Pascal: function MouseX: Integer;
Returns the current mouse X position.
[Examples]

MouseY

  • C: int MouseY()
  • C++: static int Mouse::GetY( void ) const
  • BlitzMax: MouseY:Int()
  • Pascal: function MouseY: Integer;
Returns the current mouse Y position.
[Examples]

MouseZ

  • C: int MouseZ()
  • C++: static int Mouse::GetZ( void ) const
  • BlitzMax: MouseZ:Int()
  • Pascal: function MouseZ: Integer;
Returns the mouse's current Z position. This is the delta value of the mouse wheel.
[Examples]

MouseDown

  • C: int MouseDown( int button )
  • C++: static bool Mouse::IsDown( const MouseButton& rButton = Left ) Where MouseButton is one of LEFT, RIGHT or MIDDLE
  • BlitzMax: MouseDown:Int( button:Int )
  • Pascal: function MouseDown ( button:Integer ): Integer;
Returns 1 if the specified mouse button is being held down, else returns 0.
[Examples]

MouseHit

  • C: int MouseHit( int button )
  • C++: static bool Mouse::IsHit( const MouseButton& rButton = Left ) Where MouseButton is one of LEFT, RIGHT or MIDDLE
  • BlitzMax: MouseHit:Int( button:Int )
  • Pascal: function MouseHit ( button:Integer ): Integer;
Returns 1 if the specified mouse button has been pressed since the last call to MouseHit(), else returns 0.
[Examples]

MoveMouse

  • C: void MoveMouse( int x, int y )
  • C++: static void Mouse::Move( int x, int y )
  • BlitzMax: MoveMouse( x:Int, y:Int )
  • Pascal: procedure MoveMouse ( x:Integer; y:Integer );
Moves the mouse to the specified screen coordinates.
[Examples]

HideMouse

  • C: void HideMouse( void )
  • C++: static void Mouse::Hide( void )
  • BlitzMax: HideMouse()
  • Pascal: procedure HideMouse;
Hides the mouse cursor.
[Examples]

ShowMouse

  • C: void ShowMouse( void )
  • C++: static void Mouse::Show( void )
  • BlitzMax: ShowMouse()
  • Pascal: procedure ShowMouse;
Shows the mouse cursor.
[Examples]
Personal tools