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
|
|
|
|
#include <base/tl/sorted_array.h>
|
2020-09-26 19:41:58 +00:00
|
|
|
#include <base/vmath.h>
|
2011-03-16 11:09:22 +00:00
|
|
|
#include <game/client/component.h>
|
|
|
|
|
|
|
|
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
|
|
|
|
2011-03-16 11:09:22 +00:00
|
|
|
int Num() const;
|
2011-06-29 20:27:32 +00:00
|
|
|
const CCountryFlag *GetByCountryCode(int CountryCode) const;
|
|
|
|
const CCountryFlag *GetByIndex(int 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
|
|
|
};
|
2011-03-16 11:09:22 +00:00
|
|
|
sorted_array<CCountryFlag> m_aCountryFlags;
|
2011-06-29 20:27:32 +00:00
|
|
|
int m_CodeIndexLUT[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
|