1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 01:59:43 +01:00

Add Graphics::map_option()

Similar to Graphics::map_tab(), this ensures that I don't have to
copy-paste printing the map options for every single game.menupage case
I want, and in this case that's a good thing because there'll be 4
game.menupage cases I'll be using.
This commit is contained in:
Misa 2020-06-22 15:23:15 -07:00 committed by Ethan Lee
parent b8403ffe1e
commit a402c990bf
2 changed files with 30 additions and 0 deletions

View file

@ -314,6 +314,34 @@ void Graphics::map_tab(int opt, const std::string& text, bool selected /*= false
}
}
void Graphics::map_option(int opt, int num_opts, const std::string& text, bool selected /*= false*/)
{
int x = 80 + opt*32;
int y = 136; // start from middle of menu
int yoff = -(num_opts * 12) / 2; // could be simplified to -num_opts * 6, this conveys my intent better though
yoff += opt * 12;
if (flipmode)
{
y -= yoff; // going down, which in Flip Mode means going up
y -= 40;
}
else
{
y += yoff; // going up
}
if (selected)
{
Print(x - 16, y, "[ " + text + " ]", 196, 196, 255 - help.glow);
}
else
{
Print(x, y, text, 96, 96, 96);
}
}
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);
}

View file

@ -113,6 +113,8 @@ public:
void map_tab(int opt, const std::string& text, bool selected = false);
void map_option(int opt, int num_opts, 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 PrintAlpha(int _x, int _y, std::string _s, int r, int g, int b, int a, bool cen = false);