1keyboard_keypressed(3) Svgalib User Manual keyboard_keypressed(3)
2
3
4
6 keyboard_keypressed - check if a key is pressed when in raw keyboard
7 mode
8
10 #include <vgakeyboard.h>
11
12 int keyboard_keypressed(int scancode);
13
14
16 When in raw keyboard mode this routine checks if the key with scancode
17 is pressed and returns KEY_PRESSED or KEY_NOTPRESSED accordingly. Actu‐
18 ally KEY_PRESSED is 1 and KEY_NOTPRESSED is 0, s.t. you can use con‐
19 structs like:
20
21 if(keyboard_keypressed(SCANCODE_ENTER)) {
22 /* do something */
23 }
24
25 Please note that keyboard events will only be processed when you occa‐
26 sionally call keyboard_update(3) or keyboard_waitforupdate(3).
27
28 keyboard_translatekeys(3) allows certain remap operations which make
29 certain keys (digits, enter) which might have several physical keys
30 show up under the same scancodes.
31
32 Here are the supported scancodes. The names of the #defines originate
33 from the US keyboard layout, for other countries, they'll refer to the
34 key in the same physical location, but the keycap will have a different
35 inscription. For the list below, add SCANCODE_ in front of the names to
36 get the right name for your C source. That means, if it lists BACKSLASH
37 below, you shall use SCANCODE_BACKSLASH as symbol in your program. In
38 addition to the names below we also have SCANCODE_0 - SCANCODE_9, SCAN‐
39 CODE_KEYPAD0 - SCANCODE_KEYPAD9, SCANCODE_A - SCANCODE_Z, and SCAN‐
40 CODE_F1 - SCANCODE_F12.
41
42 The other key names are ESCAPE, MINUS, EQUAL, BACKSPACE, TAB,
43 BRACKET_LEFT, BRACKET_RIGHT, ENTER, LEFTCONTROL, SEMICOLON, APOSTROPHE,
44 GRAVE, LEFTSHIFT, BACKSLASH, COMMA, PERIOD, SLASH, RIGHTSHIFT, KEYPAD‐
45 MULTIPLY, LEFTALT, SPACE, CAPSLOCK, NUMLOCK, SCROLLLOCK, CURSORUPLEFT,
46 CURSORUP, CURSORUPRIGHT, KEYPADMINUS, CURSORLEFT, CURSORRIGHT, KEYPAD‐
47 PLUS, CURSORDOWNLEFT, CURSORDOWN, CURSORDOWNRIGHT, KEYPADPERIOD, LESS,
48 KEYPADENTER, RIGHTCONTROL, CONTROL, KEYPADDIVIDE, PRINTSCREEN, RIGH‐
49 TALT, BREAK, BREAK_ALTERNATIVE, HOME, CURSORBLOCKUP, PAGEUP, CURSOR‐
50 BLOCKLEFT, CURSORBLOCKRIGHT, END, CURSORBLOCKDOWN, PAGEDOWN, INSERT,
51 and REMOVE.
52
53
55 svgalib(7), vgagl(7), libvga.config(5), keytest(6), eventtest(6), key‐
56 board_seteventhandler(3), keyboard_init(3), keyboard_init_return_fd(3),
57 keyboard_close(3), keyboard_setdefaulteventhandler(3), keyboard_key‐
58 pressed(3), keyboard_clearstate(3), keyboard_translatekeys(3), key‐
59 board_update(3), keyboard_waitforupdate(3), vga_waitevent(3)
60
61
63 This manual page was edited by Michael Weller <eowmob@exp-math.uni-
64 essen.de>. The exact source of the referenced function as well as of
65 the original documentation is unknown.
66
67 It is very likely that both are at least to some extent are due to Harm
68 Hanemaayer <H.Hanemaayer@inter.nl.net>.
69
70 Occasionally this might be wrong. I hereby asked to be excused by the
71 original author and will happily accept any additions or corrections to
72 this first version of the svgalib manual.
73
74
75
76Svgalib (>= 1.2.11) 29 July 1997 keyboard_keypressed(3)