18 #ifndef __PSCHARCONTROL_H__ 19 #define __PSCHARCONTROL_H__ 23 #include <csutil/hash.h> 24 #include <csutil/csstring.h> 25 #include <iutil/eventnames.h> 107 #define PS_MODS_MASK CSMASK_ALLSHIFTS 127 bool HandleEvent(iEvent &event);
136 void ResetAllTriggers();
154 bool SetTriggerData(
const char* name,
const void* ptr);
171 static psControl* GetFromMap(
const psControlMap &ctrlmap, uint button, uint32 mods);
174 csArray<psControl*>* GetArrayFromMap(
const psControlMap &ctrlmap, uint button);
177 void HandleButton(
psControl::Device device, uint button, uint32 mods,
bool newState);
197 void HandleBrightnessUp(
const psControl* trigger,
bool value);
198 void HandleBrightnessDown(
const psControl* trigger,
bool value);
199 void HandleBrightnessReset(
const psControl* trigger,
bool value);
200 void HandleMovement(
const psControl* trigger,
bool value);
201 void HandleMovementJump(
const psControl* trigger,
bool value);
202 void HandleMode(
const psControl* trigger,
bool value);
203 void HandleAutoMove(
const psControl* trigger,
bool value);
204 void HandleLook(
const psControl* trigger,
bool value);
205 void HandleZoom(
const psControl* trigger,
bool value);
206 void HandleMouseLook(
const psControl* trigger,
bool value);
207 void HandleMouseLookToggle(
const psControl* trigger,
bool value);
208 void HandleMouseZoom(
const psControl* trigger,
bool value);
209 void HandleMouseMove(
const psControl* trigger,
bool value);
210 void HandleCameraMode(
const psControl* trigger,
bool value);
211 void HandleCenterCamera(
const psControl* trigger,
bool value);
212 void HandleMovementAction(
const psControl* trigger,
bool value);
213 void HandleShortcut(
const psControl* trigger,
bool value);
214 void HandleWindow(
const psControl* trigger,
bool value);
215 void HandleModeRun(
const psControl* trigger,
bool value);
216 void HandleModeSneak(
const psControl* trigger,
bool value);
239 bool HandleEvent(iEvent &event);
254 bool RemapTrigger(
const char* name,
psControl::Device device, uint button, uint32 mods);
257 bool MatchTrigger(
const char* name,
psControl::Device device, uint button, uint32 mods);
263 void LoadDefaultKeys();
265 void CenterMouse(
bool value);
266 void CancelMouseLook();
274 bool LoadKeys(
const char* file);
Manages main character movements.
bool state
Is this active?
psControlMap mouse
List of all mouse triggers.
Manages button functions and triggers.
Device device
Location of button.
Handles functions for each trigger.
psCharController * charcontrol
Defines a generic button trigger.
csString name
Name of this control.
const void * DataPtr
Pointer to an object used by a TriggerFunction.
psMovementManager * GetMovementManager()
Provides access to the movement system.
psTriggerHandler handler
Trigger functions.
csString ComboToString(psControl::Device device, uint button, uint32 mods)
Returns a string of the form "mods+button".
Triggers on press and un-triggers on another press.
psMovementManager * movement
csEventID event_mouse_down
DataPtr data
Optional pointer to data needed by function.
csHash< psControl *, uint > psControlMap
Each device gets a hash map of buttons to triggers.
TriggerFunction function
Function called when triggered.
uint32 mods
Modifiers to go with the button.
void(psTriggerHandler::* TriggerFunction)(const psControl *, bool)
Pointer to a member function in the psTriggerHandler class.
uint button
Button this is bound to.
PressType type
Trigger method.
csString GetDisplayName(const char *name)
Resolves the custom name for a trigger (shortcut's name, or removes "(sec)" qualifiers) ...
csString ToString() const
Returns button combo in string form.
uint32 GetPSKeyMods(const iEvent *event)
Function which is used to extract just the modifier bits we use from a CS event.
psControlMap keyboard
List of all keyboard triggers.
void void Initialize(iObjectRegistry *object_reg)
Manages all control and movement related activities.
uint32 GetPSMouseMods(const iEvent *event)
const csPDelArray< psControl > & GetAllTriggers()
Get the full array of triggers.
void Execute() const
Does whatever this does.
psMovementManager movement
Movement system.
psControlManager controls
Key mappings.
Triggers on press and un-triggers on release.
csPDelArray< psControl > triggers
Master list of all triggers.
csEventID event_mouseclick
static psTriggerHandler * handler
Static pointer to the function handler class.
bool ready
Ready to process events?
psControl(const char *n, PressType t, TriggerFunction f)