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>
|
|
|
|
|
2018-03-13 20:56:37 +00:00
|
|
|
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
|
2011-04-13 18:37:12 +00:00
|
|
|
{
|
2011-03-10 09:08:14 +00:00
|
|
|
float m_Width, m_Height;
|
2018-01-14 16:21:50 +00:00
|
|
|
float m_FrameTimeAvg;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2018-03-13 20:56:37 +00:00
|
|
|
int m_HudQuadContainerIndex;
|
|
|
|
SScoreInfo m_aScoreInfo[2];
|
2018-03-21 14:53:29 +00:00
|
|
|
int m_FPSTextContainerIndex;
|
2018-03-13 20:56:37 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
void RenderCursor();
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2016-05-03 14:06:10 +00:00
|
|
|
void RenderTextInfo();
|
2010-05-29 07:25:38 +00:00
|
|
|
void RenderConnectionWarning();
|
|
|
|
void RenderTeambalanceWarning();
|
|
|
|
void RenderVoting();
|
2018-03-13 20:56:37 +00:00
|
|
|
|
|
|
|
void PrepareHealthAmoQuads();
|
2011-03-10 09:08:14 +00:00
|
|
|
void RenderHealthAndAmmo(const CNetObj_Character *pCharacter);
|
2018-03-13 20:56:37 +00:00
|
|
|
|
2010-05-30 12:01:11 +00:00
|
|
|
void RenderGameTimer();
|
2012-01-10 21:40:48 +00:00
|
|
|
void RenderPauseNotification();
|
2010-05-30 12:01:11 +00:00
|
|
|
void RenderSuddenDeath();
|
|
|
|
void RenderScoreHud();
|
2011-03-10 09:08:14 +00:00
|
|
|
void RenderSpectatorHud();
|
2010-05-30 12:01:11 +00:00
|
|
|
void RenderWarmupTimer();
|
2016-04-27 17:22:55 +00:00
|
|
|
void RenderLocalTime(float x);
|
2010-05-30 12:01:11 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
void MapscreenToGroup(float CenterX, float CenterY, struct CMapItemGroup *PGroup);
|
|
|
|
public:
|
|
|
|
CHud();
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2018-03-21 14:53:29 +00:00
|
|
|
void ResetHudContainers();
|
|
|
|
virtual void OnWindowResize();
|
2010-05-29 07:25:38 +00:00
|
|
|
virtual void OnReset();
|
|
|
|
virtual void OnRender();
|
2018-03-13 20:56:37 +00:00
|
|
|
virtual void OnInit();
|
2011-04-09 06:41:31 +00:00
|
|
|
|
|
|
|
// DDRace
|
|
|
|
|
2010-10-30 14:22:35 +00:00
|
|
|
virtual void OnMessage(int MsgType, void *pRawMsg);
|
2011-04-09 06:41:31 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2014-02-06 22:49:25 +00:00
|
|
|
void RenderRecord();
|
2011-04-09 06:41:31 +00:00
|
|
|
void RenderDDRaceEffects();
|
|
|
|
float m_CheckpointDiff;
|
2014-02-06 22:49:25 +00:00
|
|
|
float m_ServerRecord;
|
|
|
|
float m_PlayerRecord;
|
2011-04-09 06:41:31 +00:00
|
|
|
int m_DDRaceTime;
|
|
|
|
int m_LastReceivedTimeTick;
|
|
|
|
int m_CheckpointTick;
|
|
|
|
int m_DDRaceTick;
|
|
|
|
bool m_FinishTime;
|
|
|
|
bool m_DDRaceTimeReceived;
|
2010-05-29 07:25:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|