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_NAMEPLATES_H
|
|
|
|
#define GAME_CLIENT_COMPONENTS_NAMEPLATES_H
|
2022-06-17 17:26:59 +00:00
|
|
|
#include <base/vmath.h>
|
|
|
|
|
|
|
|
#include <engine/shared/protocol.h>
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
#include <game/client/component.h>
|
2021-07-12 09:29:59 +00:00
|
|
|
|
2022-06-17 17:26:59 +00:00
|
|
|
struct CNetObj_Character;
|
|
|
|
struct CNetObj_PlayerInfo;
|
2021-07-12 09:29:59 +00:00
|
|
|
|
2018-03-13 20:55:47 +00:00
|
|
|
struct SPlayerNamePlate
|
|
|
|
{
|
|
|
|
SPlayerNamePlate()
|
|
|
|
{
|
|
|
|
Reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Reset()
|
|
|
|
{
|
2019-07-30 18:19:46 +00:00
|
|
|
m_NameTextContainerIndex = m_ClanNameTextContainerIndex = -1;
|
2018-03-13 20:55:47 +00:00
|
|
|
m_aName[0] = 0;
|
|
|
|
m_aClanName[0] = 0;
|
2019-07-30 18:19:46 +00:00
|
|
|
m_NameTextWidth = m_ClanNameTextWidth = 0.f;
|
2018-03-13 20:55:47 +00:00
|
|
|
m_NameTextFontSize = m_ClanNameTextFontSize = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
char m_aName[MAX_NAME_LENGTH];
|
|
|
|
float m_NameTextWidth;
|
|
|
|
int m_NameTextContainerIndex;
|
|
|
|
float m_NameTextFontSize;
|
|
|
|
|
|
|
|
char m_aClanName[MAX_CLAN_LENGTH];
|
|
|
|
float m_ClanNameTextWidth;
|
|
|
|
int m_ClanNameTextContainerIndex;
|
|
|
|
float m_ClanNameTextFontSize;
|
|
|
|
};
|
2010-05-29 07:25:38 +00:00
|
|
|
|
|
|
|
class CNamePlates : public CComponent
|
|
|
|
{
|
|
|
|
void RenderNameplate(
|
2010-07-05 18:57:07 +00:00
|
|
|
const CNetObj_Character *pPrevChar,
|
|
|
|
const CNetObj_Character *pPlayerChar,
|
2020-09-26 19:41:58 +00:00
|
|
|
const CNetObj_PlayerInfo *pPlayerInfo);
|
2021-08-29 00:56:00 +00:00
|
|
|
void RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pPlayerInfo, float Alpha, bool ForceAlpha = false);
|
2010-05-29 07:25:38 +00:00
|
|
|
|
2018-03-13 20:55:47 +00:00
|
|
|
SPlayerNamePlate m_aNamePlates[MAX_CLIENTS];
|
2020-09-26 19:41:58 +00:00
|
|
|
class CPlayers *m_pPlayers;
|
|
|
|
|
2018-03-21 14:53:29 +00:00
|
|
|
void ResetNamePlates();
|
2020-09-26 19:41:58 +00:00
|
|
|
|
2022-02-11 13:03:16 +00:00
|
|
|
int m_DirectionQuadContainerIndex;
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
public:
|
2022-01-31 02:11:47 +00:00
|
|
|
virtual int Sizeof() const override { return sizeof(*this); }
|
2022-01-30 23:43:56 +00:00
|
|
|
virtual void OnWindowResize() override;
|
|
|
|
virtual void OnInit() override;
|
|
|
|
virtual void OnRender() override;
|
2018-03-13 20:55:47 +00:00
|
|
|
|
2020-09-26 19:41:58 +00:00
|
|
|
void SetPlayers(class CPlayers *pPlayers);
|
2010-05-29 07:25:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|