DDraceNetwork Docs
countryflags.h
Go to the documentation of this file.
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_COUNTRYFLAGS_H
4#define GAME_CLIENT_COMPONENTS_COUNTRYFLAGS_H
5
6#include <engine/graphics.h>
8#include <vector>
9
11{
12public:
14 {
18
19 bool operator<(const CCountryFlag &Other) const { return str_comp(m_aCountryCodeString, Other.m_aCountryCodeString) < 0; }
20 };
21
22 virtual int Sizeof() const override { return sizeof(*this); }
23 void OnInit() override;
24
25 size_t Num() const;
26 const CCountryFlag *GetByCountryCode(int CountryCode) const;
27 const CCountryFlag *GetByIndex(size_t Index) const;
28 void Render(const CCountryFlag *pFlag, ColorRGBA Color, float x, float y, float w, float h);
29 void Render(int CountryCode, ColorRGBA Color, float x, float y, float w, float h);
30
31private:
32 enum
33 {
34 CODE_LB = -1,
35 CODE_UB = 999,
37 };
38 std::vector<CCountryFlag> m_vCountryFlags;
40
42
44};
45#endif
Definition: component.h:20
Definition: countryflags.h:11
const CCountryFlag * GetByCountryCode(int CountryCode) const
Definition: countryflags.cpp:132
int m_FlagsQuadContainerIndex
Definition: countryflags.h:41
std::vector< CCountryFlag > m_vCountryFlags
Definition: countryflags.h:38
size_t m_aCodeIndexLUT[CODE_RANGE]
Definition: countryflags.h:39
void OnInit() override
Definition: countryflags.cpp:106
virtual int Sizeof() const override
Definition: countryflags.h:22
void Render(const CCountryFlag *pFlag, ColorRGBA Color, float x, float y, float w, float h)
Definition: countryflags.cpp:142
size_t Num() const
Definition: countryflags.cpp:127
const CCountryFlag * GetByIndex(size_t Index) const
Definition: countryflags.cpp:137
@ CODE_UB
Definition: countryflags.h:35
@ CODE_LB
Definition: countryflags.h:34
@ CODE_RANGE
Definition: countryflags.h:36
void LoadCountryflagsIndexfile()
Definition: countryflags.cpp:16
Definition: color.h:210
Definition: graphics.h:200
int str_comp(const char *a, const char *b)
Definition: system.cpp:2933
Definition: countryflags.h:14
char m_aCountryCodeString[8]
Definition: countryflags.h:16
int m_CountryCode
Definition: countryflags.h:15
IGraphics::CTextureHandle m_Texture
Definition: countryflags.h:17
bool operator<(const CCountryFlag &Other) const
Definition: countryflags.h:19