Jump to content

HotKey API

From fCraft Wiki
Revision as of 04:02, 9 July 2011 by F (talk | contribs) (moved FClient/HotKey API to HotKey API)

A simple way to get key press information from the client.

KeyFlags enumeration

Enumeration used to indicate what modifiers were on when the key was pressed or released.

[Flags] enum KeyFlags {
    None = 0,
    Ctrl = 1,
    Alt = 2,
    Shift = 4,
    CapsLock = 8
}

KeyPressed packet (Client -> Server)

  • byte OpCode
  • byte KeyIndex - OpenGL key enumeration
  • byte KeyFlags - see enumeration above

KeyReleased packet (Client -> Server)

  • byte OpCode
  • byte KeyIndex - OpenGL key enumeration
  • byte KeyFlags - see enumeration above

Data Types

  • sbyte = signed byte
  • byte = unsigned byte (extension)
  • short = signed 16-bit int, big-endian
  • ushort = unsigned 16-bit int, big-endian (extension)
  • RGB = red-green-blue triplet. 1 unsigned byte per channel, 3 bytes total (extension)
  • RGBA = red-green-blue triplet + alpha. 1 unsigned byte per channel, 4 bytes total (extension)