home *** CD-ROM | disk | FTP | other *** search
- /*
- #### # # # #
- # # # # # The FreeWare C library for
- # # ## ### # # # # ### RISC OS machines
- # # # # # # # # # # # ___________________________________
- # # #### ### ## # # # #
- # # # # # # # # # # Please refer to the accompanying
- #### ### #### # # ##### # ### documentation for conditions of use
- ________________________________________________________________________
-
- File: Kbd.h
- Author: Copyright © 1993 Jason Williams
- Version: 1.01 (24 Jul 1993)
- Purpose: Reading from the keyboard
-
- Mods: 24-07-93 JW Added Kbd_GET
- */
-
-
- #ifndef __dl_kbd_h
- #define __dl_kbd_h
-
- #ifndef __dl_core_h
- #include "core.h"
- #endif
-
-
- /* Kbd_Keydown(keynum)
- * Checks to see if the given key is currently depressed.
- * 'keynum' is a negative INKEY number (as defined below)
- * Generally, it's use is for things like (eg) checking if CTRL is held
- * down when a click is made, as in:
- * if (Kbd_KeyDown(inkey_CTRL)) ...
- */
- extern BOOL Kbd_KeyDown(int keynum);
-
-
- /* In the DeskTop environment, you shouldn't ever need to read more than the
- * the following keys via this method (everything else should come in via WIMP
- * events). If you need other values, look up the Appendix on INKEY values
- * in the BBC BASIC Guide (mine has this on page 411)
- */
-
- typedef enum
- {
- inkey_ADJUST = -12, /* MOUSE 'Adjust' button */
- inkey_MENU = -11, /* MOUSE 'Menu' button */
- inkey_SELECT = -10, /* MOUSE 'Select' button */
-
- inkey_RALT = -9, /* Right ALT key */
- inkey_LALT = -6, /* Left ALT key */
- inkey_ALT = -3, /* Either/Both ALT keys */
-
- inkey_RCTRL = -8, /* Right CTRL key */
- inkey_LCTRL = -5, /* Left CTRL key */
- inkey_CTRL = -2, /* Either/Both CTRL keys */
-
- inkey_RSHIFT = -7, /* Right SHIFT key */
- inkey_LSHIFT = -4, /* Left SHIFT key */
- inkey_SHIFT = -1 /* Either/Both SHIFT keys */
- } kbd_neginkey;
-
-
-
- /* Kbd_GET()
- * Returns the ASCII code of the next key pressed (this may be a key already
- * waiting in the keyboard buffer). (i.e. an OS_ReadC veneer)
- * This is similar to BASIC's GET command, hence the name.
- */
- extern char Kbd_GET(void);
-
-
-
- /****************************************************************************
-
- typedef kbd_modifiers
-
- For each modifier key, when the flag is TRUE it means that the key
- is held down.
-
- ****************************************************************************/
-
-
- typedef struct
- {
- unsigned alt : 1;
- unsigned ctrl : 1;
- unsigned shift : 1;
- unsigned left_alt : 1;
- unsigned left_ctrl : 1;
- unsigned left_shift : 1;
- unsigned right_alt : 1;
- unsigned right_ctrl : 1;
- unsigned right_shift : 1;
-
- } kbd_modifiers;
-
-
- /****************************************************************************
-
- kbd_modifiers Kbd_GetModifiers(BOOL detailed)
-
- Inputs: detailed - normally FALSE, but set to TRUE if you want to
- know which (as in left or right) modifiers are
- held down.
- Returns: The status of the modifier keys (the left... and right...
- fields are only accurate when detailed = TRUE).
- Purpose: To find out the state of various modifier (shift) keys.
- This is useful when handling mouse clicks, and so on.
-
- ****************************************************************************/
-
-
- extern kbd_modifiers Kbd_GetModifiers(BOOL detailed);
-
-
- #endif
-