GrafX2 2.9.3227
The ultimate 256-color painting program
keyboard.h File Reference

Functions to convert bewteen the SDL key formats and the keycode we use in grafx2. More...

+ This graph shows which files directly or indirectly include this file:

Functions

word Key_for_scancode (word scancode)
 Helper function to convert between SDL system and the old coding for PC keycodes. More...
 
const char * Key_name (word key)
 Returns key name in a string. More...
 
word Get_Key_modifiers (void)
 Gets the Key modifiers in our format Returns a combination of GFX2_MOD_SHIFT, GFX2_MOD_ALT, GFX2_MOD_CTRL. More...
 

Detailed Description

Functions to convert bewteen the SDL key formats and the keycode we use in grafx2.

The keycode we're using is generalized to handle mouse and joystick shortcuts as well. The format can be broken down as:

  • 0x0000 + a number between 0 and SDLK_LAST (about 324) : the SDL "sym" key number.
  • 0x0000 + SDLK_LAST+1: Mouse middle button.
  • 0x0000 + SDLK_LAST+2: Mouse wheel up.
  • 0x0000 + SDLK_LAST+3: Mouse wheel down.
  • 0x0000 + SDLK_LAST+4+B : Joystick button number "B", starting at B=0.
  • 0x0800 + a number between 0 and 0x7FF: The scancode key number, for keys which have no "sym", such as keys from multimedia keyboards, and "fn" and "Thinkpad" key for a laptop. Add 0x1000 for the Shift modifier GFX2_MOD_SHIFT Add 0x2000 for the Control modifier GFX2_MOD_CTRL Add 0x4000 for the Alt modifier GFX2_MOD_ALT Add 0x8000 for the "Meta" modifier GFX2_MOD_META (On MacOS X it's the CMD key)

Function Documentation

◆ Key_for_scancode()

word Key_for_scancode ( word  scancode)

Helper function to convert between SDL system and the old coding for PC keycodes.

This is only used to convert configuration files from the DOS version of Grafx2, where keyboard codes are in in the IBM PC AT form.

Parameters
scancodeScancode to convert

Referenced by Load_CFG().

◆ Key_name()

◆ Get_Key_modifiers()