1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-11-04 18:29:41 +01:00

Add Graphics::map_tab()

This function is useful to de-duplicate all the map page names at the
bottom, which are MAP, CREW/SHIP/GRAV, STATS, and SAVE. If selected, it
will surround the text in square brackets and automatically handle the
positioning.

Shamelessly copy-pasted from Dav999's localization branch.
This commit is contained in:
Misa 2020-06-20 18:33:55 -07:00 committed by Ethan Lee
parent 8c9c3d3751
commit aa3c1c8053
2 changed files with 15 additions and 0 deletions

View file

@ -301,6 +301,19 @@ void Graphics::MakeSpriteArray()
} }
void Graphics::map_tab(int opt, const std::string& text, bool selected /*= false*/)
{
int x = opt*80 + 40 - len(text)/2;
if (selected)
{
Print(x-8, 220, "[" + text + "]", 196, 196, 255 - help.glow);
}
else
{
Print(x, 220, text, 64, 64, 64);
}
}
void Graphics::Print( int _x, int _y, std::string _s, int r, int g, int b, bool cen /*= false*/ ) { void Graphics::Print( int _x, int _y, std::string _s, int r, int g, int b, bool cen /*= false*/ ) {
return PrintAlpha(_x,_y,_s,r,g,b,255,cen); return PrintAlpha(_x,_y,_s,r,g,b,255,cen);
} }

View file

@ -111,6 +111,8 @@ public:
void printcrewnamedark(int x, int y, int t); void printcrewnamedark(int x, int y, int t);
void map_tab(int opt, const std::string& text, bool selected = false);
void Print(int _x, int _y, std::string _s, int r, int g, int b, bool cen = false); void Print(int _x, int _y, std::string _s, int r, int g, int b, bool cen = false);
void PrintAlpha(int _x, int _y, std::string _s, int r, int g, int b, int a, bool cen = false); void PrintAlpha(int _x, int _y, std::string _s, int r, int g, int b, int a, bool cen = false);