IInput

From Valve Developer Community
Revision as of 15:13, 22 January 2009 by Coder0xff (talk | contribs) (Creation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This interface is used by the Source Engine to access input functionality that must be implemented in game code. This class handles mouse and joystick input, keeps track of and modifies key "button" state, and completely controls the position of the camera. The file iinput.h should remain unedited as the engine expects to find the IInput interface as it is currently presented in iinput.h. To implement IInput the game code creates a new class inheriting IInput, and exposing it to engine:

class CMyInput : public CInput
{
public:
};

static CMyInput g_Input;

// Expose this interface
IInput *input = ( IInput * )&g_Input;

The easiest way to implement this interface is by starting with and modifying the preexisting class CInput. CInput is declared in input.h and is implemented in:

  • in_main.cpp
  • in_mouse.cpp
  • in_camera.cpp
  • in_joystick.cpp