2011-03-16 11:09:22 +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. */
|
|
|
|
#ifndef GAME_CLIENT_COMPONENTS_COUNTRYFLAGS_H
|
|
|
|
#define GAME_CLIENT_COMPONENTS_COUNTRYFLAGS_H
|
2022-05-29 16:33:38 +00:00
|
|
|
|
2011-03-16 11:09:22 +00:00
|
|
|
#include <game/client/component.h>
|
2022-05-23 17:51:54 +00:00
|
|
|
#include <vector>
|
2011-03-16 11:09:22 +00:00
|
|
|
|
|
|
|
class CCountryFlags : public CComponent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
struct CCountryFlag
|
|
|
|
{
|
|
|
|
int m_CountryCode;
|
2011-07-31 00:04:46 +00:00
|
|
|
char m_aCountryCodeString[8];
|
2012-08-12 10:41:50 +00:00
|
|
|
IGraphics::CTextureHandle m_Texture;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2020-10-08 05:28:53 +00:00
|
|
|
bool operator<(const CCountryFlag &Other) const { return str_comp(m_aCountryCodeString, Other.m_aCountryCodeString) < 0; }
|
2011-03-16 11:09:22 +00:00
|
|
|
};
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2022-01-31 02:11:47 +00:00
|
|
|
virtual int Sizeof() const override { return sizeof(*this); }
|
2022-01-30 23:43:56 +00:00
|
|
|
void OnInit() override;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2022-05-23 17:51:54 +00:00
|
|
|
size_t Num() const;
|
2011-06-29 20:27:32 +00:00
|
|
|
const CCountryFlag *GetByCountryCode(int CountryCode) const;
|
2022-05-23 17:51:54 +00:00
|
|
|
const CCountryFlag *GetByIndex(size_t Index) const;
|
2019-04-26 21:47:34 +00:00
|
|
|
void Render(int CountryCode, const ColorRGBA *pColor, float x, float y, float w, float h);
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2011-03-16 11:09:22 +00:00
|
|
|
private:
|
2011-06-29 20:27:32 +00:00
|
|
|
enum
|
|
|
|
{
|
2020-09-26 19:41:58 +00:00
|
|
|
CODE_LB = -1,
|
|
|
|
CODE_UB = 999,
|
|
|
|
CODE_RANGE = CODE_UB - CODE_LB + 1,
|
2011-06-29 20:27:32 +00:00
|
|
|
};
|
2022-06-11 19:38:18 +00:00
|
|
|
std::vector<CCountryFlag> m_vCountryFlags;
|
2022-06-30 22:36:32 +00:00
|
|
|
size_t m_aCodeIndexLUT[CODE_RANGE];
|
2011-03-16 11:09:22 +00:00
|
|
|
|
2021-09-13 21:14:04 +00:00
|
|
|
int m_FlagsQuadContainerIndex;
|
|
|
|
|
2011-03-16 11:09:22 +00:00
|
|
|
void LoadCountryflagsIndexfile();
|
|
|
|
};
|
|
|
|
#endif
|