BRL.PolledInput: | Functions | Modinfo | Source |
Function AppSuspended() | |
Returns | True if application is currently suspended. |
Description | Get app suspended state. |
Function AppTerminate() | |
Returns | True if user has requested to terminate application. |
Description | Return app terminate state. |
Example | Graphics 640,480,0 While Not AppTerminate() Or Not Confirm( "Terminate?" ) Cls DrawText MouseX()+","+MouseY(),0,0 Flip Wend |
Function FlushKeys() | |
Description | Flush key states and character queue. |
Information | FlushKeys resets the state of all keys to 'off', and resets the character queue used by GetChar. |
Function FlushMouse() | |
Description | Flush mouse button states. |
Information | FlushMouse resets the state of all mouse buttons to 'off'. |
Function GetChar() | |
Returns | The character code of the next character. |
Description | Get next character. |
Information | As the user hits keys on the keyboard, BlitzMax records the character codes of these
keystrokes into an internal 'character queue'. GetChar removes the next character code from this queue and returns it the application. If the character queue is empty, 0 is returned. |
Function KeyDown( key ) | |
Returns | True if key is currently down. |
Description | Check for key state. |
Information | See the KeyCodes docs for a list of valid keycodes. |
Example | ' keydown.bmx ' the following code draws a circle if the ' program detects the spacebar is pressed ' and exits when it detects the ESCAPE key has ' been pressed Graphics 640,480 While Not KeyHit(KEY_ESCAPE) Cls If KeyDown(KEY_SPACE) DrawOval 0,0,640,480 Flip Wend |
Function KeyHit( key ) | |
Returns | Number of times key has been hit. |
Description | Check for key hit. |
Information | The returned value represents the number of the times key has been hit since the last
call to KeyHit with the same key. See the KeyCodes docs for a list of valid keycodes. |
Example | ' keyhit.bmx ' the following code draws a circle every time the ' program detects the spacebar has been pressed ' and exits when it detects the ESCAPE key has ' been pressed graphics 640,480 while not keyhit(KEY_ESCAPE) cls if keyhit(KEY_SPACE) drawoval 0,0,640,480 flip wend |
Function MouseDown( button ) | |
Returns | True if button is currently down. |
Description | Check for mouse button down state. |
Information | button should be 1 for the left mouse button, 2 for the right mouse button or 3 for the middle mouse button. |
Example | ' mousedown.bmx graphics 640,480 while not keyhit(KEY_ESCAPE) cls if mousedown(1) drawrect 0,0,200,200 if mousedown(2) drawrect 200,0,200,200 if mousedown(3) drawrect 400,0,200,200 flip wend |
Function MouseHit( button ) | |
Returns | Number of times button has been clicked. |
Description | Check for mouse button click. |
Information | The returned value represents the number of the times button has been clicked since the
last call to MouseHit with the same button. button should be 1 for the left mouse button, 2 for the right mouse button or 3 for the middle mouse button. |
Example | ' mousehit.bmx graphics 640,480 while not keyhit(KEY_ESCAPE) cls if mousehit(1) drawrect 0,0,200,200 if mousehit(2) drawrect 200,0,200,200 if mousehit(3) drawrect 400,0,200,200 flip wend |
Function MouseX() | |
Returns | Mouse x axis location. |
Description | Get mouse x location. |
Information | The returned value is relative to the left of the screen. |
Example | ' mousex.bmx ' the following tracks the position of the mouse graphics 640,480 while not keyhit(KEY_ESCAPE) cls drawoval mousex()-10,mousey()-10,20,20 flip wend |
Function MouseY() | |
Returns | Mouse y axis location. |
Description | Get mouse y location. |
Information | The returned value is relative to the top of the screen. |
Example | ' mousey.bmx ' the following tracks the position of the mouse graphics 640,480 while not keyhit(KEY_ESCAPE) cls drawrect mousex()-10,mousey()-10,20,20 flip wend |
Function MouseZ() | |
Returns | Mouse wheel value. |
Description | Get mouse wheel. |
Information | The mouse wheel value increments when the mouse wheel is rolled 'away' from the user, and decrements when the mouse wheel is rolled 'towards' the user. |
Example | ' mousez.bmx ' prints mousez() the mousewheel position Graphics 640,480 While Not keyhit(KEY_ESCAPE) cls drawtext "MouseZ()="+MouseZ(),0,0 flip Wend |
Function WaitChar() | |
Returns | The character code of the pressed key. |
Description | Wait for a key press. |
Information | WaitChar suspends program execution until a character is available from GetChar. This character is then returned to the application. |
Function WaitKey() | |
Returns | The keycode of the pressed key. |
Description | Wait for a key press. |
Information | WaitKey suspends program execution until a key has been hit. The keycode of this
key is then returned to the application. See the KeyCodes docs for a list of valid keycodes. |
Function WaitMouse() | |
Returns | The clicked button. |
Description | Wait for mouse button click. |
Information | WaitMouse suspends program execution until a mouse button is clicked. WaitMouse returns 1 if the left mouse button was clicked, 2 if the right mouse button was clicked or 3 if the middle mouse button was clicked. |
Version | 1.01 |
---|---|
Author | Mark Sibly, Simon Armstrong |
License | Blitz Shared Source Code |
Copyright | Blitz Research Ltd |
Modserver | BRL |
History | 1.01 Release |
History | Fixed charQueue bug |