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

131 lines
3.2 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_HUD_H
#define GAME_CLIENT_COMPONENTS_HUD_H
#include <game/client/component.h>
struct SScoreInfo
{
SScoreInfo()
{
Reset();
}
void Reset()
{
m_TextRankContainerIndex = m_TextScoreContainerIndex = m_RoundRectQuadContainerIndex = m_OptionalNameTextContainerIndex = -1;
m_aScoreText[0] = 0;
m_aRankText[0] = 0;
m_aPlayerNameText[0] = 0;
m_ScoreTextWidth = 0.f;
m_Initialized = false;
}
int m_TextRankContainerIndex;
int m_TextScoreContainerIndex;
float m_ScoreTextWidth;
char m_aScoreText[16];
char m_aRankText[16];
char m_aPlayerNameText[MAX_NAME_LENGTH];
int m_RoundRectQuadContainerIndex;
int m_OptionalNameTextContainerIndex;
bool m_Initialized;
};
2010-05-29 07:25:38 +00:00
class CHud : public CComponent
{
float m_Width, m_Height;
float m_FrameTimeAvg;
int m_HudQuadContainerIndex;
SScoreInfo m_aScoreInfo[2];
int m_FPSTextContainerIndex;
2010-05-29 07:25:38 +00:00
void RenderCursor();
2016-05-03 14:06:10 +00:00
void RenderTextInfo();
2010-05-29 07:25:38 +00:00
void RenderConnectionWarning();
void RenderTeambalanceWarning();
void RenderVoting();
void PrepareAmmoHealthAndArmorQuads();
void RenderAmmoHealthAndArmor(const CNetObj_Character *pCharacter);
void PreparePlayerStateQuads();
void RenderPlayerState(const int ClientID);
void RenderGameTimer();
2012-01-10 21:40:48 +00:00
void RenderPauseNotification();
void RenderSuddenDeath();
void RenderScoreHud();
void RenderSpectatorHud();
void RenderWarmupTimer();
void RenderLocalTime(float x);
2010-05-29 07:25:38 +00:00
void MapscreenToGroup(float CenterX, float CenterY, struct CMapItemGroup *PGroup);
2010-05-29 07:25:38 +00:00
public:
CHud();
virtual int Sizeof() const override { return sizeof(*this); }
void ResetHudContainers();
virtual void OnWindowResize() override;
virtual void OnReset() override;
virtual void OnRender() override;
virtual void OnInit() override;
// DDRace
virtual void OnMessage(int MsgType, void *pRawMsg) override;
2022-03-25 11:54:11 +00:00
void RenderProgressBar(float x, const float y, const float width, const float height, float Progress, float Alpha = 1.0f);
private:
void RenderRecord();
void RenderDDRaceEffects();
float m_CheckpointDiff;
float m_ServerRecord;
2020-10-18 14:51:26 +00:00
float m_PlayerRecord[NUM_DUMMIES];
int m_DDRaceTime;
int m_LastReceivedTimeTick;
int m_CheckpointTick;
bool m_FinishTime;
bool m_DDRaceTimeReceived;
// Quad Offsets
int m_AmmoOffset[NUM_WEAPONS];
int m_HealthOffset;
int m_EmptyHealthOffset;
int m_ArmorOffset;
int m_EmptyArmorOffset;
int m_CursorOffset[NUM_WEAPONS];
int m_FlagOffset;
int m_AirjumpOffset;
int m_AirjumpEmptyOffset;
2022-03-24 00:05:41 +00:00
int m_WeaponHammerOffset;
int m_WeaponGunOffset;
int m_WeaponShotgunOffset;
int m_WeaponGrenadeOffset;
int m_WeaponLaserOffset;
2022-03-24 00:05:41 +00:00
int m_WeaponNinjaOffset;
int m_EndlessJumpOffset;
int m_EndlessHookOffset;
int m_JetpackOffset;
int m_TeleportGrenadeOffset;
int m_TeleportGunOffset;
int m_TeleportLaserOffset;
int m_SoloOffset;
int m_NoCollisionOffset;
int m_NoHookHitOffset;
int m_NoHammerHitOffset;
int m_NoShotgunHitOffset;
int m_NoGrenadeHitOffset;
int m_NoLaserHitOffset;
2022-03-25 09:09:13 +00:00
int m_DeepFrozenOffset;
int m_LiveFrozenOffset;
int m_DummyHammerOffset;
int m_DummyCopyOffset;
2010-05-29 07:25:38 +00:00
};
#endif