Jump to content

HotKey API: Difference between revisions

From fCraft Wiki
Created page with " = Hotkey API = A simple way to get key press information from the client. ===KeyFlags enum=== Enumeration used to indicate what modifiers were on when the key was pressed or re..."
 
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
= Hotkey API =
A simple way to get key press information from the client.
A simple way to get key press information from the client.


===KeyFlags enum===
=KeyFlags enumeration=
Enumeration used to indicate what modifiers were on when the key was pressed or released.
Enumeration used to indicate what modifiers were on when the key was pressed or released.
<syntaxhighlight lang="csharp">[Flags] enum KeyFlags {
<syntaxhighlight lang="csharp">[Flags] enum KeyFlags {
Line 13: Line 11:
}</syntaxhighlight>
}</syntaxhighlight>


==KeyPressed packet==
=KeyPressed packet (Client -> Server)=
* byte '''OpCode'''
* byte '''OpCode'''
* byte '''KeyIndex''' - OpenGL key enumeration
* byte '''KeyIndex''' - OpenGL key enumeration
* byte '''KeyFlags''' - see enumeration above
* byte '''KeyFlags''' - see enumeration above


==KeyReleased packet==
=KeyReleased packet (Client -> Server)=
* byte '''OpCode'''
* byte '''OpCode'''
* byte '''KeyIndex''' - OpenGL key enumeration
* byte '''KeyIndex''' - OpenGL key enumeration
* byte '''KeyFlags''' - see enumeration above
* byte '''KeyFlags''' - see enumeration above
[[Category:Protocol Extensions]]

Latest revision as of 04:02, 9 July 2011

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