mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-30 09:54:10 +03:00
Merge pull request #322 from Dav999-v/auto-center-menu
Make menus automatically centered and narrowed
This commit is contained in:
@@ -1260,7 +1260,7 @@ void Graphics::processfade()
|
||||
}
|
||||
}
|
||||
|
||||
void Graphics::drawmenu( int cr, int cg, int cb, int division /*= 30*/ )
|
||||
void Graphics::drawmenu( int cr, int cg, int cb )
|
||||
{
|
||||
for (size_t i = 0; i < game.menuoptions.size(); i++)
|
||||
{
|
||||
@@ -1272,14 +1272,14 @@ void Graphics::drawmenu( int cr, int cg, int cb, int division /*= 30*/ )
|
||||
std::string tempstring = game.menuoptions[i].text;
|
||||
std::transform(tempstring.begin(), tempstring.end(),tempstring.begin(), ::toupper);
|
||||
tempstring = std::string("[ ") + tempstring + std::string(" ]");
|
||||
Print(110 + (i * division) - 16 +game.menuxoff, 140 + (i * 12) +game.menuyoff, tempstring, cr, cg, cb);
|
||||
Print((i * game.menuspacing) - 16 +game.menuxoff, 140 + (i * 12) +game.menuyoff, tempstring, cr, cg, cb);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string tempstring = game.menuoptions[i].text;
|
||||
tempstring = "[ " + tempstring + " ]";
|
||||
//Draw it in gray
|
||||
Print(110 + (i * division) - 16 +game.menuxoff, 140 + (i * 12)+game.menuyoff, tempstring, 128, 128, 128);
|
||||
Print((i * game.menuspacing) - 16 +game.menuxoff, 140 + (i * 12)+game.menuyoff, tempstring, 128, 128, 128);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1287,18 +1287,18 @@ void Graphics::drawmenu( int cr, int cg, int cb, int division /*= 30*/ )
|
||||
//Draw it normally
|
||||
if (game.menuoptions[i].active)
|
||||
{
|
||||
Print(110 + (i * division) +game.menuxoff, 140 + (i * 12)+game.menuyoff, game.menuoptions[i].text, cr, cg, cb);
|
||||
Print((i * game.menuspacing) +game.menuxoff, 140 + (i * 12)+game.menuyoff, game.menuoptions[i].text, cr, cg, cb);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Draw it in gray
|
||||
Print(110 + (i * division) +game.menuxoff, 140 + (i * 12)+game.menuyoff, game.menuoptions[i].text, 128, 128, 128);
|
||||
Print((i * game.menuspacing) +game.menuxoff, 140 + (i * 12)+game.menuyoff, game.menuoptions[i].text, 128, 128, 128);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Graphics::drawlevelmenu( int cr, int cg, int cb, int division /*= 30*/ )
|
||||
void Graphics::drawlevelmenu( int cr, int cg, int cb )
|
||||
{
|
||||
for (size_t i = 0; i < game.menuoptions.size(); i++)
|
||||
{
|
||||
@@ -1311,14 +1311,14 @@ void Graphics::drawlevelmenu( int cr, int cg, int cb, int division /*= 30*/ )
|
||||
std::string tempstring = game.menuoptions[i].text;
|
||||
std::transform(tempstring.begin(), tempstring.end(),tempstring.begin(), ::toupper);
|
||||
tempstring = std::string("[ ") + tempstring + std::string(" ]");
|
||||
Print(110 + (i * division) - 16 +game.menuxoff, 140+8 + (i * 12) +game.menuyoff, tempstring, cr, cg, cb);
|
||||
Print((i * game.menuspacing) - 16 +game.menuxoff, 140+8 + (i * 12) +game.menuyoff, tempstring, cr, cg, cb);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string tempstring = game.menuoptions[i].text;
|
||||
tempstring = "[ " + tempstring + " ]";
|
||||
//Draw it in gray
|
||||
Print(110 + (i * division) - 16 +game.menuxoff, 140+8 + (i * 12)+game.menuyoff, tempstring, 128, 128, 128);
|
||||
Print((i * game.menuspacing) - 16 +game.menuxoff, 140+8 + (i * 12)+game.menuyoff, tempstring, 128, 128, 128);
|
||||
}
|
||||
}else{
|
||||
//Draw it highlighted
|
||||
@@ -1327,14 +1327,14 @@ void Graphics::drawlevelmenu( int cr, int cg, int cb, int division /*= 30*/ )
|
||||
std::string tempstring = game.menuoptions[i].text;
|
||||
std::transform(tempstring.begin(), tempstring.end(),tempstring.begin(), ::toupper);
|
||||
tempstring = std::string("[ ") + tempstring + std::string(" ]");
|
||||
Print(110 + (i * division) - 16 +game.menuxoff, 144 + (i * 12) +game.menuyoff, tempstring, cr, cg, cb);
|
||||
Print((i * game.menuspacing) - 16 +game.menuxoff, 144 + (i * 12) +game.menuyoff, tempstring, cr, cg, cb);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string tempstring = game.menuoptions[i].text;
|
||||
tempstring = "[ " + tempstring + " ]";
|
||||
//Draw it in gray
|
||||
Print(110 + (i * division) - 16 +game.menuxoff, 144 + (i * 12)+game.menuyoff, tempstring, 128, 128, 128);
|
||||
Print((i * game.menuspacing) - 16 +game.menuxoff, 144 + (i * 12)+game.menuyoff, tempstring, 128, 128, 128);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1344,23 +1344,23 @@ void Graphics::drawlevelmenu( int cr, int cg, int cb, int division /*= 30*/ )
|
||||
//Draw it normally
|
||||
if (game.menuoptions[i].active)
|
||||
{
|
||||
Print(110 + (i * division) +game.menuxoff, 140+8 + (i * 12)+game.menuyoff, game.menuoptions[i].text, cr, cg, cb);
|
||||
Print((i * game.menuspacing) +game.menuxoff, 140+8 + (i * 12)+game.menuyoff, game.menuoptions[i].text, cr, cg, cb);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Draw it in gray
|
||||
Print(110 + (i * division) +game.menuxoff, 140+8 + (i * 12)+game.menuyoff, game.menuoptions[i].text, 128, 128, 128);
|
||||
Print((i * game.menuspacing) +game.menuxoff, 140+8 + (i * 12)+game.menuyoff, game.menuoptions[i].text, 128, 128, 128);
|
||||
}
|
||||
}else{
|
||||
//Draw it normally
|
||||
if (game.menuoptions[i].active)
|
||||
{
|
||||
Print(110 + (i * division) +game.menuxoff, 144 + (i * 12)+game.menuyoff, game.menuoptions[i].text, cr, cg, cb);
|
||||
Print((i * game.menuspacing) +game.menuxoff, 144 + (i * 12)+game.menuyoff, game.menuoptions[i].text, cr, cg, cb);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Draw it in gray
|
||||
Print(110 + (i * division) +game.menuxoff, 144 + (i * 12)+game.menuyoff, game.menuoptions[i].text, 128, 128, 128);
|
||||
Print((i * game.menuspacing) +game.menuxoff, 144 + (i * 12)+game.menuyoff, game.menuoptions[i].text, 128, 128, 128);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user