mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 09:39:43 +01:00
add a one pixel gap between each line in textboxes (main game only)
This commit is contained in:
parent
2807524c78
commit
cc1528aacc
5 changed files with 27 additions and 13 deletions
|
@ -874,7 +874,7 @@ void Graphics::drawgui(void)
|
|||
int font_height = font::height(textboxes[i].print_flags);
|
||||
if (flipmode)
|
||||
{
|
||||
text_yoff = 8 + (textboxes[i].lines.size() - 1) * font_height;
|
||||
text_yoff = 8 + (textboxes[i].lines.size() - 1) * (font_height + textboxes[i].linegap);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -884,7 +884,7 @@ void Graphics::drawgui(void)
|
|||
yp = textboxes[i].yp;
|
||||
if (flipmode && textboxes[i].flipme)
|
||||
{
|
||||
yp = SCREEN_HEIGHT_PIXELS - yp - 16 - textboxes[i].lines.size() * font_height;
|
||||
yp = SCREEN_HEIGHT_PIXELS - yp - 16 - textboxes[i].lines.size() * (font_height + textboxes[i].linegap);
|
||||
}
|
||||
|
||||
char buffer[SCREEN_WIDTH_CHARS + 1];
|
||||
|
@ -931,7 +931,7 @@ void Graphics::drawgui(void)
|
|||
font::print(
|
||||
print_flags | PR_BOR,
|
||||
text_xp,
|
||||
yp + text_yoff + text_sign * (j * font_height),
|
||||
yp + text_yoff + text_sign * (j * (font_height + textboxes[i].linegap)),
|
||||
textbox_line(buffer, sizeof(buffer), i, j),
|
||||
0, 0, 0
|
||||
);
|
||||
|
@ -941,7 +941,7 @@ void Graphics::drawgui(void)
|
|||
font::print(
|
||||
print_flags,
|
||||
text_xp,
|
||||
yp + text_yoff + text_sign * (j * font_height),
|
||||
yp + text_yoff + text_sign * (j * (font_height + textboxes[i].linegap)),
|
||||
textbox_line(buffer, sizeof(buffer), i, j),
|
||||
196, 196, 255 - help.glow
|
||||
);
|
||||
|
@ -961,7 +961,7 @@ void Graphics::drawgui(void)
|
|||
font::print(
|
||||
print_flags | PR_BRIGHTNESS(tl_lerp*255),
|
||||
text_xp,
|
||||
yp + text_yoff + text_sign * (j * font_height),
|
||||
yp + text_yoff + text_sign * (j * (font_height + textboxes[i].linegap)),
|
||||
textbox_line(buffer, sizeof(buffer), i, j),
|
||||
textboxes[i].r, textboxes[i].g, textboxes[i].b
|
||||
);
|
||||
|
@ -1506,6 +1506,12 @@ void Graphics::textboxadjust(void)
|
|||
textboxes[m].adjust();
|
||||
}
|
||||
|
||||
int Graphics::getlinegap(void)
|
||||
{
|
||||
// Don't use linegaps in custom levels, for now anyway
|
||||
if (map.custommode) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void Graphics::createtextboxreal(
|
||||
const std::string& t,
|
||||
|
@ -1517,7 +1523,7 @@ void Graphics::createtextboxreal(
|
|||
|
||||
if (m < 20)
|
||||
{
|
||||
textboxclass text;
|
||||
textboxclass text(getlinegap());
|
||||
text.lines.push_back(t);
|
||||
text.xp = xp;
|
||||
if (xp == -1) text.xp = 160 - ((font::len(PR_FONT_LEVEL, t.c_str()) / 2) + 8);
|
||||
|
|
|
@ -65,6 +65,7 @@ public:
|
|||
|
||||
void drawfade(void);
|
||||
|
||||
int getlinegap(void);
|
||||
void createtextboxreal(
|
||||
const std::string& t,
|
||||
int xp, int yp,
|
||||
|
|
|
@ -569,18 +569,21 @@ void scriptclass::run(void)
|
|||
}
|
||||
}
|
||||
|
||||
int linegap = graphics.getlinegap();
|
||||
|
||||
//next is whether to position above or below
|
||||
if (INBOUNDS_VEC(i, obj.entities) && words[2] == "above")
|
||||
{
|
||||
if (j == 1) //left
|
||||
{
|
||||
textx = obj.entities[i].xp -10000; //tells the box to be oriented correctly later
|
||||
texty = obj.entities[i].yp - 16 - (txt.size() * font::height(PR_FONT_LEVEL));
|
||||
texty = obj.entities[i].yp - 16 - (txt.size() * (font::height(PR_FONT_LEVEL) + linegap) - linegap);
|
||||
|
||||
}
|
||||
else if (j == 0) //Right
|
||||
{
|
||||
textx = obj.entities[i].xp - 16;
|
||||
texty = obj.entities[i].yp - 18 - (txt.size() * font::height(PR_FONT_LEVEL));
|
||||
texty = obj.entities[i].yp - 18 - (txt.size() * (font::height(PR_FONT_LEVEL) + linegap) - linegap);
|
||||
}
|
||||
}
|
||||
else if (INBOUNDS_VEC(i, obj.entities))
|
||||
|
@ -666,18 +669,20 @@ void scriptclass::run(void)
|
|||
texty = -500;
|
||||
}
|
||||
|
||||
int linegap = graphics.getlinegap();
|
||||
|
||||
//next is whether to position above or below
|
||||
if (INBOUNDS_VEC(i, obj.entities) && words[2] == "above")
|
||||
{
|
||||
if (j == 1) //left
|
||||
{
|
||||
textx = obj.entities[i].xp -10000; //tells the box to be oriented correctly later
|
||||
texty = obj.entities[i].yp - 16 - (txt.size() * font::height(PR_FONT_LEVEL));
|
||||
texty = obj.entities[i].yp - 16 - (txt.size() * (font::height(PR_FONT_LEVEL) + linegap) - linegap);
|
||||
}
|
||||
else if (j == 0) //Right
|
||||
{
|
||||
textx = obj.entities[i].xp - 16;
|
||||
texty = obj.entities[i].yp - 18 - (txt.size() * font::height(PR_FONT_LEVEL));
|
||||
texty = obj.entities[i].yp - 18 - (txt.size() * (font::height(PR_FONT_LEVEL) + linegap) - linegap);
|
||||
}
|
||||
}
|
||||
else if (INBOUNDS_VEC(i, obj.entities))
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "Font.h"
|
||||
#include "UTF8.h"
|
||||
|
||||
textboxclass::textboxclass(void)
|
||||
textboxclass::textboxclass(int gap)
|
||||
{
|
||||
w = 0;
|
||||
h = 0;
|
||||
|
@ -19,6 +19,7 @@ textboxclass::textboxclass(void)
|
|||
r = 0;
|
||||
g = 0;
|
||||
b = 0;
|
||||
linegap = gap;
|
||||
|
||||
flipme = false;
|
||||
|
||||
|
@ -132,7 +133,7 @@ void textboxclass::resize(void)
|
|||
|
||||
// 16 for the borders
|
||||
w = max + 16;
|
||||
h = lines.size()*font::height(print_flags) + 16;
|
||||
h = lines.size()*(font::height(print_flags) + linegap) + 16 - linegap;
|
||||
}
|
||||
|
||||
void textboxclass::addline(const std::string& t)
|
||||
|
|
|
@ -23,7 +23,7 @@ enum TextboxImage
|
|||
class textboxclass
|
||||
{
|
||||
public:
|
||||
textboxclass(void);
|
||||
textboxclass(int gap);
|
||||
|
||||
void addsprite(int x, int y, int tile, int col);
|
||||
|
||||
|
@ -57,6 +57,7 @@ public:
|
|||
std::vector<std::string> lines;
|
||||
int xp, yp, w, h;
|
||||
int r,g,b;
|
||||
int linegap;
|
||||
int timer;
|
||||
|
||||
float tl;
|
||||
|
|
Loading…
Reference in a new issue