1 | /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ |
2 | /* If you are missing that file, acquire a complete release at teeworlds.com. */ |
3 | #ifndef GAME_CLIENT_COMPONENTS_CONTROLS_H |
4 | #define GAME_CLIENT_COMPONENTS_CONTROLS_H |
5 | |
6 | #include <base/vmath.h> |
7 | |
8 | #include <engine/client.h> |
9 | |
10 | #include <game/client/component.h> |
11 | #include <game/generated/protocol.h> |
12 | |
13 | class CControls : public CComponent |
14 | { |
15 | float GetMinMouseDistance() const; |
16 | float GetMaxMouseDistance() const; |
17 | |
18 | public: |
19 | vec2 m_aMousePos[NUM_DUMMIES]; |
20 | vec2 m_aMousePosOnAction[NUM_DUMMIES]; |
21 | vec2 m_aTargetPos[NUM_DUMMIES]; |
22 | |
23 | int m_aAmmoCount[NUM_WEAPONS]; |
24 | |
25 | int64_t m_LastSendTime; |
26 | CNetObj_PlayerInput m_aInputData[NUM_DUMMIES]; |
27 | CNetObj_PlayerInput m_aLastData[NUM_DUMMIES]; |
28 | int m_aInputDirectionLeft[NUM_DUMMIES]; |
29 | int m_aInputDirectionRight[NUM_DUMMIES]; |
30 | int m_aShowHookColl[NUM_DUMMIES]; |
31 | |
32 | CControls(); |
33 | virtual int Sizeof() const override { return sizeof(*this); } |
34 | |
35 | virtual void OnReset() override; |
36 | virtual void OnRender() override; |
37 | virtual void OnMessage(int MsgType, void *pRawMsg) override; |
38 | virtual bool OnCursorMove(float x, float y, IInput::ECursorType CursorType) override; |
39 | virtual void OnConsoleInit() override; |
40 | virtual void OnPlayerDeath(); |
41 | |
42 | int SnapInput(int *pData); |
43 | void ClampMousePos(); |
44 | void ResetInput(int Dummy); |
45 | }; |
46 | #endif |
47 | |