IInput: Difference between revisions
Jump to navigation
Jump to search
Bug:Although your mod will compile fine if you bypass creating the
TomEdwards (talk | contribs) No edit summary |
TomEdwards (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
'''<code>IInput</code>''' is a client [[interface]] that packages user input from keyboards, mice and joysticks/gamepads into [[usercmd]]s for transmission to the server. It also handles [[third-person camera]]s. | '''<code>IInput</code>''' is a client [[interface]] that packages user input from keyboards, mice and joysticks/gamepads into [[usercmd]]s for transmission to the server. It also handles [[third-person camera]]s. | ||
Conventionally, each type of supported peripheral has its own CPP file. Valve's <code>[[CInput]]</code> interface implementation is in <code>in_main.cpp</code> (for | Conventionally, each type of supported peripheral has its own CPP file. Valve's <code>[[CInput]]</code> interface implementation is in <code>in_main.cpp</code> (for usercmd packaging and keyboard), <code>in_mouse.cpp</code> and <code>in_joystick.cpp</code>. | ||
== | == Minimum implementation == | ||
<source lang=cpp> | <source lang=cpp>static CInput g_Input; | ||
IInput* input = (IInput*)&g_Input;</source> | |||
{{bug|Although your mod will compile fine if you bypass creating the <code>g_Input</code> object, you may encounter bizarre errors (including the world not rendering and a cursor that is re-centred every frame) when launching with a debugger attached!}} | |||
/ | |||
== See also == | == See also == |
Revision as of 09:58, 5 August 2009
IInput
is a client interface that packages user input from keyboards, mice and joysticks/gamepads into usercmds for transmission to the server. It also handles third-person cameras.
Conventionally, each type of supported peripheral has its own CPP file. Valve's CInput
interface implementation is in in_main.cpp
(for usercmd packaging and keyboard), in_mouse.cpp
and in_joystick.cpp
.
Minimum implementation
static CInput g_Input;
IInput* input = (IInput*)&g_Input;

g_Input
object, you may encounter bizarre errors (including the world not rendering and a cursor that is re-centred every frame) when launching with a debugger attached! [todo tested in ?]See also
CInput
, Valve's basicIInput
implementation