1 | /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ |
---|---|
2 | /* If you are missing that file, acquire a complete release at teeworlds.com. */ |
3 | #ifndef GAME_CLIENT_COMPONENTS_NAMEPLATES_H |
4 | #define GAME_CLIENT_COMPONENTS_NAMEPLATES_H |
5 | #include <base/vmath.h> |
6 | |
7 | #include <engine/shared/protocol.h> |
8 | #include <engine/textrender.h> |
9 | |
10 | #include <game/client/component.h> |
11 | |
12 | struct CNetObj_Character; |
13 | struct CNetObj_PlayerInfo; |
14 | |
15 | struct SPlayerNamePlate |
16 | { |
17 | SPlayerNamePlate() |
18 | { |
19 | Reset(); |
20 | } |
21 | |
22 | void Reset() |
23 | { |
24 | m_NameTextContainerIndex.Reset(); |
25 | m_ClanNameTextContainerIndex.Reset(); |
26 | m_aName[0] = 0; |
27 | m_aClanName[0] = 0; |
28 | m_NameTextWidth = m_ClanNameTextWidth = 0.f; |
29 | m_NameTextFontSize = m_ClanNameTextFontSize = 0; |
30 | } |
31 | |
32 | char m_aName[MAX_NAME_LENGTH]; |
33 | float m_NameTextWidth; |
34 | STextContainerIndex m_NameTextContainerIndex; |
35 | float m_NameTextFontSize; |
36 | |
37 | char m_aClanName[MAX_CLAN_LENGTH]; |
38 | float m_ClanNameTextWidth; |
39 | STextContainerIndex m_ClanNameTextContainerIndex; |
40 | float m_ClanNameTextFontSize; |
41 | }; |
42 | |
43 | class CNamePlates : public CComponent |
44 | { |
45 | void RenderNameplate( |
46 | const CNetObj_Character *pPrevChar, |
47 | const CNetObj_Character *pPlayerChar, |
48 | const CNetObj_PlayerInfo *pPlayerInfo); |
49 | void RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pPlayerInfo, float Alpha, bool ForceAlpha = false); |
50 | |
51 | SPlayerNamePlate m_aNamePlates[MAX_CLIENTS]; |
52 | |
53 | void ResetNamePlates(); |
54 | |
55 | int m_DirectionQuadContainerIndex; |
56 | |
57 | public: |
58 | virtual int Sizeof() const override { return sizeof(*this); } |
59 | virtual void OnWindowResize() override; |
60 | virtual void OnInit() override; |
61 | virtual void OnRender() override; |
62 | }; |
63 | |
64 | #endif |
65 |