- This wiki is out of date, use the continuation of this wiki instead
Key
From FenixWiki
(Difference between revisions)
| Revision as of 00:01, 26 June 2007 (edit) Sandman (Talk | contribs) ← Previous diff |
Current revision (00:36, 19 December 2007) (edit) (undo) Sandman (Talk | contribs) m |
||
| (5 intermediate revisions not shown.) | |||
| Line 1: | Line 1: | ||
| [[Category:functions]] | [[Category:functions]] | ||
| + | [[Category:programinteraction]] | ||
| ==Definition== | ==Definition== | ||
| - | '''INT''' Key( <'''INT''' | + | '''INT''' Key( <'''INT''' scancode> ) |
| Checks if a certain key is being pressed. | Checks if a certain key is being pressed. | ||
| Line 8: | Line 9: | ||
| == Parameters == | == Parameters == | ||
| {| | {| | ||
| - | | '''INT''' | + | | '''INT''' scancode || - The [[scancodes|scancode]] of the key to be checked. |
| |} | |} | ||
| Line 15: | Line 16: | ||
| == Notes == | == Notes == | ||
| - | Take a look at the [[ | + | Take a look at the [[scancodes]] for a complete list. |
| == Example == | == Example == | ||
| Line 24: | Line 25: | ||
| While( !key(_esc) ) | While( !key(_esc) ) | ||
| - | delete_text(); | + | delete_text(ALL_TEXT); |
| if( key(_left) && !key(_right) ) | if( key(_left) && !key(_right) ) | ||
| Line 42: | Line 43: | ||
| End | End | ||
| </pre> | </pre> | ||
| - | Used in example: [[delete_text]](), [[write]](), [[exit]]() | + | Used in example: [[delete_text]](), [[write]](), [[exit]](), [[ALL_TEXT]] |
| This will output the words LEFT or RIGHT according to the keys you press, | This will output the words LEFT or RIGHT according to the keys you press, | ||
| or it will quit the program once ESCAPE is pressed. | or it will quit the program once ESCAPE is pressed. | ||
| + | |||
| + | {{Funcbox | ||
| + | | category=Programinteraction | ||
| + | }} | ||
Current revision
Contents |
[edit] Definition
INT Key( <INT scancode> )
Checks if a certain key is being pressed.
[edit] Parameters
| INT scancode | - The scancode of the key to be checked. |
[edit] Returns
INT : true/false: Whether the key is being pressed.
[edit] Notes
Take a look at the scancodes for a complete list.
[edit] Example
Program input_test;
Begin
While( !key(_esc) )
delete_text(ALL_TEXT);
if( key(_left) && !key(_right) )
write(0,160,120,4, "LEFT");
end;
if( key(_right) && !key(_left) )
write(0,160,120,4, "RIGHT");
end;
frame;
End;
exit();
End
Used in example: delete_text(), write(), exit(), ALL_TEXT
This will output the words LEFT or RIGHT according to the keys you press, or it will quit the program once ESCAPE is pressed.
| Programinteraction Functions | |
| • Exit() • Getenv() • Key() • Move_window() • Set_fps() • Set_icon() • Set_mode() • Set_title() • | |
