ddnet/src/game/client/components/controls.h
2023-10-03 19:27:53 +02:00

50 lines
1.4 KiB
C++

/* (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. */
#ifndef GAME_CLIENT_COMPONENTS_CONTROLS_H
#define GAME_CLIENT_COMPONENTS_CONTROLS_H
#include <base/vmath.h>
#include <engine/client.h>
#include <game/client/component.h>
#include <game/generated/protocol.h>
class CControls : public CComponent
{
float GetMaxMouseDistance() const;
public:
vec2 m_aMousePos[NUM_DUMMIES];
vec2 m_aMousePosOnAction[NUM_DUMMIES];
vec2 m_aTargetPos[NUM_DUMMIES];
float m_OldMouseX;
float m_OldMouseY;
int m_aAmmoCount[NUM_WEAPONS];
CNetObj_PlayerInput m_aInputData[NUM_DUMMIES];
CNetObj_PlayerInput m_aLastData[NUM_DUMMIES];
int m_aInputDirectionLeft[NUM_DUMMIES];
int m_aInputDirectionRight[NUM_DUMMIES];
int m_aShowHookColl[NUM_DUMMIES];
int m_LastDummy;
int m_OtherFire;
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 OnCursorMove(float x, float y, IInput::ECursorType CursorType) override;
virtual void OnConsoleInit() override;
virtual void OnPlayerDeath();
int SnapInput(int *pData);
void ClampMousePos();
void ResetInput(int Dummy);
};
#endif