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

Merge pull request #667 from InfoTeddy/general-improvements

Add text outlines to textboxless textboxes and gravitron text
This commit is contained in:
Terry Cavanagh 2021-04-02 17:49:20 +10:30 committed by GitHub
commit 886a57ab83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 79 additions and 31 deletions

View file

@ -541,6 +541,28 @@ void Graphics::bigprint( int _x, int _y, std::string _s, int r, int g, int b, b
} }
} }
void Graphics::bigbprint(int x, int y, std::string s, int r, int g, int b, bool cen, int sc)
{
if (!notextoutline)
{
bigprint(x, y - sc, s, 0, 0, 0, cen, sc);
if (cen)
{
int x_cen = VVV_max(160 - (len(s) / 2) * sc, 0);
bigprint(x_cen - sc, y, s, 0, 0, 0, false, sc);
bigprint(x_cen + sc, y, s, 0, 0, 0, false, sc);
}
else
{
bigprint(x - sc, y, s, 0, 0, 0, cen, sc);
bigprint(x + sc, y, s, 0, 0, 0, cen, sc);
}
bigprint(x, y + sc, s, 0, 0, 0, cen, sc);
}
bigprint(x, y, s, r, g, b, cen, sc);
}
int Graphics::len(std::string t) int Graphics::len(std::string t)
{ {
int bfontpos = 0; int bfontpos = 0;
@ -860,7 +882,7 @@ void Graphics::drawgui(void)
{ {
for (size_t j = 0; j < textbox[i].line.size(); j++) for (size_t j = 0; j < textbox[i].line.size(); j++)
{ {
Print(textbox[i].xp + 8, yp + text_yoff + text_sign * (j * 8), textbox[i].line[j], 196, 196, 255 - help.glow); bprint(textbox[i].xp + 8, yp + text_yoff + text_sign * (j * 8), textbox[i].line[j], 196, 196, 255 - help.glow);
} }
} }
else else
@ -3155,6 +3177,30 @@ void Graphics::bigrprint(int x, int y, std::string& t, int r, int g, int b, bool
} }
} }
void Graphics::bigbrprint(int x, int y, std::string& s, int r, int g, int b, bool cen, float sc)
{
if (!notextoutline)
{
int x_o = x / sc - len(s);
bigrprint(x, y - sc, s, 0, 0, 0, cen, sc);
if (cen)
{
x_o = VVV_max(160 - (len(s) / 2) * sc, 0);
bigprint(x_o - sc, y, s, 0, 0, 0, false, sc);
bigprint(x_o + sc, y, s, 0, 0, 0, false, sc);
}
else
{
x_o *= sc;
bigprint(x_o - sc, y, s, 0, 0, 0, false, sc);
bigprint(x_o + sc, y, s, 0, 0, 0, false, sc);
}
bigrprint(x, y + sc, s, 0, 0, 0, cen, sc);
}
bigrprint(x, y, s, r, g, b, cen, sc);
}
void Graphics::drawtele(int x, int y, int t, Uint32 c) void Graphics::drawtele(int x, int y, int t, Uint32 c)
{ {
setcolreal(getRGB(16,16,16)); setcolreal(getRGB(16,16,16));

View file

@ -144,6 +144,7 @@ public:
int len(std::string t); int len(std::string t);
void bigprint( int _x, int _y, std::string _s, int r, int g, int b, bool cen = false, int sc = 2 ); void bigprint( int _x, int _y, std::string _s, int r, int g, int b, bool cen = false, int sc = 2 );
void bigbprint(int x, int y, std::string s, int r, int g, int b, bool cen = false, int sc = 2);
void drawspritesetcol(int x, int y, int t, int c); void drawspritesetcol(int x, int y, int t, int c);
@ -168,6 +169,7 @@ public:
void drawtrophytext(void); void drawtrophytext(void);
void bigrprint(int x, int y, std::string& t, int r, int g, int b, bool cen = false, float sc = 2); void bigrprint(int x, int y, std::string& t, int r, int g, int b, bool cen = false, float sc = 2);
void bigbrprint(int x, int y, std::string& t, int r, int g, int b, bool cen = false, float sc = 2);
void drawtele(int x, int y, int t, Uint32 c); void drawtele(int x, int y, int t, Uint32 c);

View file

@ -1527,56 +1527,56 @@ void gamerender(void)
if (game.swngame == 0) if (game.swngame == 0)
{ {
std::string tempstring = help.timestring(game.swntimer); std::string tempstring = help.timestring(game.swntimer);
graphics.bigprint( -1, 20, tempstring, 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true, 2); graphics.bigbprint( -1, 20, tempstring, 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true, 2);
} }
else if (game.swngame == 1) else if (game.swngame == 1)
{ {
if (game.swnmessage == 0) if (game.swnmessage == 0)
{ {
std::string tempstring = help.timestring(game.swntimer); std::string tempstring = help.timestring(game.swntimer);
graphics.Print( 10, 10, "Current Time", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), false); graphics.bprint( 10, 10, "Current Time", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), false);
graphics.bigprint( 25, 24, tempstring, 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), false, 2); graphics.bigbprint( 25, 24, tempstring, 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), false, 2);
tempstring = help.timestring(game.swnrecord); tempstring = help.timestring(game.swnrecord);
graphics.Print( 240, 10, "Best Time", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), false); graphics.bprint( 240, 10, "Best Time", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), false);
graphics.bigrprint( 300, 24, tempstring, 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), false, 2); graphics.bigbrprint( 300, 24, tempstring, 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), false, 2);
switch(game.swnbestrank) switch(game.swnbestrank)
{ {
case 0: case 0:
graphics.Print( -1, 204, "Next Trophy at 5 seconds", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true); graphics.bprint( -1, 204, "Next Trophy at 5 seconds", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true);
break; break;
case 1: case 1:
graphics.Print( -1, 204, "Next Trophy at 10 seconds", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true); graphics.bprint( -1, 204, "Next Trophy at 10 seconds", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true);
break; break;
case 2: case 2:
graphics.Print( -1, 204, "Next Trophy at 15 seconds", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true); graphics.bprint( -1, 204, "Next Trophy at 15 seconds", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true);
break; break;
case 3: case 3:
graphics.Print( -1, 204, "Next Trophy at 20 seconds", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true); graphics.bprint( -1, 204, "Next Trophy at 20 seconds", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true);
break; break;
case 4: case 4:
graphics.Print( -1, 204, "Next Trophy at 30 seconds", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true); graphics.bprint( -1, 204, "Next Trophy at 30 seconds", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true);
break; break;
case 5: case 5:
graphics.Print( -1, 204, "Next Trophy at 1 minute", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true); graphics.bprint( -1, 204, "Next Trophy at 1 minute", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true);
break; break;
case 6: case 6:
graphics.Print( -1, 204, "All Trophies collected!", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true); graphics.bprint( -1, 204, "All Trophies collected!", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true);
break; break;
} }
} }
else if (game.swnmessage == 1) else if (game.swnmessage == 1)
{ {
std::string tempstring = help.timestring(game.swntimer); std::string tempstring = help.timestring(game.swntimer);
graphics.Print( 10, 10, "Current Time", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), false); graphics.bprint( 10, 10, "Current Time", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), false);
graphics.bigprint( 25, 24, tempstring, 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), false, 2); graphics.bigbprint( 25, 24, tempstring, 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), false, 2);
tempstring = help.timestring(game.swnrecord); tempstring = help.timestring(game.swnrecord);
if (int(game.deathseq / 5) % 2 == 1) if (int(game.deathseq / 5) % 2 == 1)
{ {
graphics.Print( 240, 10, "Best Time", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), false); graphics.bprint( 240, 10, "Best Time", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), false);
graphics.bigrprint( 300, 24, tempstring, 128 - (help.glow), 220 - (help.glow), 128 - (help.glow / 2), false, 2); graphics.bigbrprint( 300, 24, tempstring, 128 - (help.glow), 220 - (help.glow), 128 - (help.glow / 2), false, 2);
graphics.bigprint( -1, 200, "New Record!", 128 - (help.glow), 220 - (help.glow), 128 - (help.glow / 2), true, 2); graphics.bigbprint( -1, 200, "New Record!", 128 - (help.glow), 220 - (help.glow), 128 - (help.glow / 2), true, 2);
} }
} }
else if (game.swnmessage >= 2) else if (game.swnmessage >= 2)
@ -1584,19 +1584,19 @@ void gamerender(void)
game.swnmessage--; game.swnmessage--;
if (game.swnmessage == 2) game.swnmessage = 0; if (game.swnmessage == 2) game.swnmessage = 0;
std::string tempstring = help.timestring(game.swntimer); std::string tempstring = help.timestring(game.swntimer);
graphics.Print( 10, 10, "Current Time", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), false); graphics.bprint( 10, 10, "Current Time", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), false);
graphics.bigprint( 25, 24, tempstring, 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), false, 2); graphics.bigbprint( 25, 24, tempstring, 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), false, 2);
tempstring = help.timestring(game.swnrecord); tempstring = help.timestring(game.swnrecord);
graphics.Print( 240, 10, "Best Time", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), false); graphics.bprint( 240, 10, "Best Time", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), false);
graphics.bigrprint( 300, 24, tempstring, 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), false, 2); graphics.bigbrprint( 300, 24, tempstring, 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), false, 2);
if (int(game.swnmessage / 5) % 2 == 1) if (int(game.swnmessage / 5) % 2 == 1)
{ {
graphics.bigprint( -1, 200, "New Trophy!", 220 - (help.glow), 128 - (help.glow), 128 - (help.glow / 2), true, 2); graphics.bigbprint( -1, 200, "New Trophy!", 220 - (help.glow), 128 - (help.glow), 128 - (help.glow / 2), true, 2);
} }
} }
graphics.Print( 20, 228, "[Press ENTER to stop]", 160 - (help.glow/2), 160 - (help.glow/2), 160 - (help.glow/2), true); graphics.bprint( 20, 228, "[Press ENTER to stop]", 160 - (help.glow/2), 160 - (help.glow/2), 160 - (help.glow/2), true);
} }
else if(game.swngame==2) else if(game.swngame==2)
{ {
@ -1614,24 +1614,24 @@ void gamerender(void)
y1 = 10; y1 = 10;
y2 = 30; y2 = 30;
} }
graphics.bigprint( -1, y1, "Survive for", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true, 2); graphics.bigbprint( -1, y1, "Survive for", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true, 2);
graphics.bigprint( -1, y2, "60 seconds!", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true, 2); graphics.bigbprint( -1, y2, "60 seconds!", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true, 2);
} }
} }
else if(game.swngame==7) else if(game.swngame==7)
{ {
if (game.swndelay >= 60) if (game.swndelay >= 60)
{ {
graphics.bigprint( -1, 20, "SUPER GRAVITRON", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true, 2); graphics.bigbprint( -1, 20, "SUPER GRAVITRON", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true, 2);
std::string tempstring = help.timestring(game.swnrecord); std::string tempstring = help.timestring(game.swnrecord);
graphics.Print( 240, 190, "Best Time", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true); graphics.bprint( 240, 190, "Best Time", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true);
graphics.bigrprint( 300, 205, tempstring, 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true, 2); graphics.bigbrprint( 300, 205, tempstring, 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true, 2);
} }
else if (int(game.swndelay / 10) % 2 == 1) else if (int(game.swndelay / 10) % 2 == 1)
{ {
graphics.bigprint( -1, 20, "SUPER GRAVITRON", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true, 2); graphics.bigbprint( -1, 20, "SUPER GRAVITRON", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true, 2);
graphics.bigprint( -1, 200, "GO!", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true, 3); graphics.bigbprint( -1, 200, "GO!", 220 - (help.glow), 220 - (help.glow), 255 - (help.glow / 2), true, 3);
} }
} }
} }