ddnet/src/game/client/components/controls.h

53 lines
1.4 KiB
C
Raw Normal View History

2010-11-20 10:37:14 +00:00
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
/* If you are missing that file, acquire a complete release at teeworlds.com. */
2010-05-29 07:25:38 +00:00
#ifndef GAME_CLIENT_COMPONENTS_CONTROLS_H
#define GAME_CLIENT_COMPONENTS_CONTROLS_H
2014-06-16 11:29:18 +00:00
#include <SDL_joystick.h>
#include <base/system.h>
#include <base/vmath.h>
2010-05-29 07:25:38 +00:00
#include <game/client/component.h>
2021-07-12 09:29:59 +00:00
#include <game/generated/protocol.h>
2010-05-29 07:25:38 +00:00
class CControls : public CComponent
{
2010-05-29 07:25:38 +00:00
public:
2020-10-18 14:51:26 +00:00
vec2 m_MousePos[NUM_DUMMIES];
vec2 m_TargetPos[NUM_DUMMIES];
2014-06-16 11:29:18 +00:00
float m_OldMouseX;
float m_OldMouseY;
SDL_Joystick *m_Joystick;
bool m_JoystickFirePressed;
bool m_JoystickRunPressed;
2021-06-23 05:05:49 +00:00
int64_t m_JoystickTapTime;
2014-06-16 11:29:18 +00:00
SDL_Joystick *m_Gamepad;
bool m_UsingGamepad;
int m_AmmoCount[NUM_WEAPONS];
2010-05-29 07:25:38 +00:00
2020-10-18 14:51:26 +00:00
CNetObj_PlayerInput m_InputData[NUM_DUMMIES];
CNetObj_PlayerInput m_LastData[NUM_DUMMIES];
int m_InputDirectionLeft[NUM_DUMMIES];
int m_InputDirectionRight[NUM_DUMMIES];
int m_ShowHookColl[NUM_DUMMIES];
2014-04-30 11:32:47 +00:00
int m_LastDummy;
int m_OtherFire;
2010-05-29 07:25:38 +00:00
CControls();
virtual int Sizeof() const override { return sizeof(*this); }
virtual void OnReset() override;
virtual void OnRelease() override;
virtual void OnRender() override;
virtual void OnMessage(int MsgType, void *pRawMsg) override;
virtual bool OnMouseMove(float x, float y) override;
virtual void OnConsoleInit() override;
2010-08-10 11:54:13 +00:00
virtual void OnPlayerDeath();
2010-05-29 07:25:38 +00:00
int SnapInput(int *pData);
void ClampMousePos();
2017-03-06 18:45:39 +00:00
void ResetInput(int Dummy);
2010-05-29 07:25:38 +00:00
};
#endif