SvgaLib/doc/man3/keyboard_keypressed.3

135 lines
3.5 KiB
Groff

.TH keyboard_keypressed 3 "29 July 1997" "Svgalib (>= 1.2.11)" "Svgalib User Manual"
.SH NAME
keyboard_keypressed \- check if a key is pressed when in raw keyboard mode
.SH SYNOPSIS
.B "#include <vgakeyboard.h>"
.BI "int keyboard_keypressed(int " scancode );
.SH DESCRIPTION
When in raw keyboard mode this routine checks if the key with
.I scancode
is pressed and returns
.BR KEY_PRESSED " or " KEY_NOTPRESSED
accordingly. Actually
.BR KEY_PRESSED " is 1 and " KEY_NOTPRESSED " is 0,"
s.t. you can use constructs like:
.B "if(keyboard_keypressed(SCANCODE_ENTER)) {"
.br
.BR " " "/* do something */"
.br
.B }
Please note that keyboard events will only be processed when you occasionally call
.BR keyboard_update "(3) or "
.BR keyboard_waitforupdate (3).
.BR keyboard_translatekeys (3)
allows certain remap operations which make certain keys (digits, enter) which might have
several physical keys show up under the same scancodes.
Here are the supported scancodes. The names of the
.B #defines
originate from the US keyboard layout, for other countries, they'll refer to the key
in the same physical location, but the keycap will have a different inscription. For
the list below, add
.BR SCANCODE_
in front of the names to get the right name for your C source. That means, if it lists
.BR BACKSLASH
below, you shall use
.BR SCANCODE_BACKSLASH
as symbol in your program. In addition to the names below we also have
.BR SCANCODE_0 " - " SCANCODE_9 ", "
.BR SCANCODE_KEYPAD0 " - " SCANCODE_KEYPAD9 ", "
.BR SCANCODE_A " - " SCANCODE_Z ", and "
.BR SCANCODE_F1 " - " SCANCODE_F12 "."
The other key names are
.BR ESCAPE ", "
.BR MINUS ", "
.BR EQUAL ", "
.BR BACKSPACE ", "
.BR TAB ", "
.BR BRACKET_LEFT ", "
.BR BRACKET_RIGHT ", "
.BR ENTER ", "
.BR LEFTCONTROL ", "
.BR SEMICOLON ", "
.BR APOSTROPHE ", "
.BR GRAVE ", "
.BR LEFTSHIFT ", "
.BR BACKSLASH ", "
.BR COMMA ", "
.BR PERIOD ", "
.BR SLASH ", "
.BR RIGHTSHIFT ", "
.BR KEYPADMULTIPLY ", "
.BR LEFTALT ", "
.BR SPACE ", "
.BR CAPSLOCK ", "
.BR NUMLOCK ", "
.BR SCROLLLOCK ", "
.BR CURSORUPLEFT ", "
.BR CURSORUP ", "
.BR CURSORUPRIGHT ", "
.BR KEYPADMINUS ", "
.BR CURSORLEFT ", "
.BR CURSORRIGHT ", "
.BR KEYPADPLUS ", "
.BR CURSORDOWNLEFT ", "
.BR CURSORDOWN ", "
.BR CURSORDOWNRIGHT ", "
.BR KEYPADPERIOD ", "
.BR LESS ", "
.BR KEYPADENTER ", "
.BR RIGHTCONTROL ", "
.BR CONTROL ", "
.BR KEYPADDIVIDE ", "
.BR PRINTSCREEN ", "
.BR RIGHTALT ", "
.BR BREAK ", "
.BR BREAK_ALTERNATIVE ", "
.BR HOME ", "
.BR CURSORBLOCKUP ", "
.BR PAGEUP ", "
.BR CURSORBLOCKLEFT ", "
.BR CURSORBLOCKRIGHT ", "
.BR END ", "
.BR CURSORBLOCKDOWN ", "
.BR PAGEDOWN ", "
.BR INSERT ", and "
.BR REMOVE "."
.SH SEE ALSO
.BR svgalib (7),
.BR vgagl (7),
.BR libvga.config (5),
.BR keytest (6),
.BR eventtest (6),
.BR keyboard_seteventhandler (3),
.BR keyboard_init (3),
.BR keyboard_init_return_fd (3),
.BR keyboard_close (3),
.BR keyboard_setdefaulteventhandler (3),
.BR keyboard_keypressed (3),
.BR keyboard_clearstate (3),
.BR keyboard_translatekeys (3),
.BR keyboard_update (3),
.BR keyboard_waitforupdate (3),
.BR vga_waitevent (3)
.SH AUTHOR
This manual page was edited by Michael Weller <eowmob@exp-math.uni-essen.de>. The
exact source of the referenced function as well as of the original documentation is
unknown.
It is very likely that both are at least to some extent are due to
Harm Hanemaayer <H.Hanemaayer@inter.nl.net>.
Occasionally this might be wrong. I hereby
asked to be excused by the original author and will happily accept any additions or corrections
to this first version of the svgalib manual.