mirror of
https://github.com/rwengine/openrw.git
synced 2024-09-20 01:11:46 +02:00
Add GameInputState to store all control state
This commit is contained in:
parent
600333e20b
commit
50e059daf0
60
rwengine/include/engine/GameInputState.hpp
Normal file
60
rwengine/include/engine/GameInputState.hpp
Normal file
@ -0,0 +1,60 @@
|
||||
#ifndef RWENGINE_GAMEINPUTSTATE_HPP
|
||||
#define RWENGINE_GAMEINPUTSTATE_HPP
|
||||
|
||||
struct GameInputState
|
||||
{
|
||||
/// Inputs that can be controlled
|
||||
/// @todo find any sensible values
|
||||
enum Control {
|
||||
/* On Foot */
|
||||
FireWeapon = 0,
|
||||
NextWeapon,
|
||||
NextTarget = NextWeapon,
|
||||
LastWeapon,
|
||||
LastTarget = LastWeapon,
|
||||
GoForward,
|
||||
GoBackwards,
|
||||
GoLeft,
|
||||
GoRight,
|
||||
ZoomIn,
|
||||
ZoomOut,
|
||||
EnterExitVehicle,
|
||||
ChangeCamera,
|
||||
Jump,
|
||||
Sprint,
|
||||
AimWeapon,
|
||||
Crouch,
|
||||
Walk,
|
||||
LookBehind,
|
||||
|
||||
/* In Vehicle */
|
||||
VehicleFireWeapon = FireWeapon,
|
||||
VehicleAccelerate,
|
||||
VehicleBrake,
|
||||
VehicleLeft = GoLeft,
|
||||
VehicleRight = GoRight,
|
||||
VehicleDown,
|
||||
VehicleUp,
|
||||
ChangeRadio,
|
||||
Horn,
|
||||
Submission,
|
||||
Handbrake,
|
||||
LookLeft,
|
||||
LookRight,
|
||||
VehicleAimLeft,
|
||||
VehicleAimRight,
|
||||
VehicleAimUp,
|
||||
VehicleAimDown,
|
||||
|
||||
_MaxControls
|
||||
};
|
||||
|
||||
/**
|
||||
* Current state of each control [0 to 1].
|
||||
*
|
||||
* For buttons, this will result in either 0 or 1.
|
||||
*/
|
||||
float currentLevels[_MaxControls] = { };
|
||||
};
|
||||
|
||||
#endif
|
@ -10,6 +10,7 @@
|
||||
#include <objects/ObjectTypes.hpp>
|
||||
#include <engine/ScreenText.hpp>
|
||||
#include <data/VehicleGenerator.hpp>
|
||||
#include <engine/GameInputState.hpp>
|
||||
|
||||
class GameWorld;
|
||||
class GameObject;
|
||||
@ -332,6 +333,11 @@ struct GameState
|
||||
std::bitset<32> importExportShoreside;
|
||||
std::bitset<32> importExportUnused;
|
||||
|
||||
/**
|
||||
* State of the game input
|
||||
*/
|
||||
GameInputState input;
|
||||
|
||||
/**
|
||||
* World to use for this state, this isn't saved, just used at runtime
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user