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);
|
int font_height = font::height(textboxes[i].print_flags);
|
||||||
if (flipmode)
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -884,7 +884,7 @@ void Graphics::drawgui(void)
|
||||||
yp = textboxes[i].yp;
|
yp = textboxes[i].yp;
|
||||||
if (flipmode && textboxes[i].flipme)
|
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];
|
char buffer[SCREEN_WIDTH_CHARS + 1];
|
||||||
|
@ -931,7 +931,7 @@ void Graphics::drawgui(void)
|
||||||
font::print(
|
font::print(
|
||||||
print_flags | PR_BOR,
|
print_flags | PR_BOR,
|
||||||
text_xp,
|
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),
|
textbox_line(buffer, sizeof(buffer), i, j),
|
||||||
0, 0, 0
|
0, 0, 0
|
||||||
);
|
);
|
||||||
|
@ -941,7 +941,7 @@ void Graphics::drawgui(void)
|
||||||
font::print(
|
font::print(
|
||||||
print_flags,
|
print_flags,
|
||||||
text_xp,
|
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),
|
textbox_line(buffer, sizeof(buffer), i, j),
|
||||||
196, 196, 255 - help.glow
|
196, 196, 255 - help.glow
|
||||||
);
|
);
|
||||||
|
@ -961,7 +961,7 @@ void Graphics::drawgui(void)
|
||||||
font::print(
|
font::print(
|
||||||
print_flags | PR_BRIGHTNESS(tl_lerp*255),
|
print_flags | PR_BRIGHTNESS(tl_lerp*255),
|
||||||
text_xp,
|
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),
|
textbox_line(buffer, sizeof(buffer), i, j),
|
||||||
textboxes[i].r, textboxes[i].g, textboxes[i].b
|
textboxes[i].r, textboxes[i].g, textboxes[i].b
|
||||||
);
|
);
|
||||||
|
@ -1506,6 +1506,12 @@ void Graphics::textboxadjust(void)
|
||||||
textboxes[m].adjust();
|
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(
|
void Graphics::createtextboxreal(
|
||||||
const std::string& t,
|
const std::string& t,
|
||||||
|
@ -1517,7 +1523,7 @@ void Graphics::createtextboxreal(
|
||||||
|
|
||||||
if (m < 20)
|
if (m < 20)
|
||||||
{
|
{
|
||||||
textboxclass text;
|
textboxclass text(getlinegap());
|
||||||
text.lines.push_back(t);
|
text.lines.push_back(t);
|
||||||
text.xp = xp;
|
text.xp = xp;
|
||||||
if (xp == -1) text.xp = 160 - ((font::len(PR_FONT_LEVEL, t.c_str()) / 2) + 8);
|
if (xp == -1) text.xp = 160 - ((font::len(PR_FONT_LEVEL, t.c_str()) / 2) + 8);
|
||||||
|
|
|
@ -65,6 +65,7 @@ public:
|
||||||
|
|
||||||
void drawfade(void);
|
void drawfade(void);
|
||||||
|
|
||||||
|
int getlinegap(void);
|
||||||
void createtextboxreal(
|
void createtextboxreal(
|
||||||
const std::string& t,
|
const std::string& t,
|
||||||
int xp, int yp,
|
int xp, int yp,
|
||||||
|
|
|
@ -569,18 +569,21 @@ void scriptclass::run(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int linegap = graphics.getlinegap();
|
||||||
|
|
||||||
//next is whether to position above or below
|
//next is whether to position above or below
|
||||||
if (INBOUNDS_VEC(i, obj.entities) && words[2] == "above")
|
if (INBOUNDS_VEC(i, obj.entities) && words[2] == "above")
|
||||||
{
|
{
|
||||||
if (j == 1) //left
|
if (j == 1) //left
|
||||||
{
|
{
|
||||||
textx = obj.entities[i].xp -10000; //tells the box to be oriented correctly later
|
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
|
else if (j == 0) //Right
|
||||||
{
|
{
|
||||||
textx = obj.entities[i].xp - 16;
|
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))
|
else if (INBOUNDS_VEC(i, obj.entities))
|
||||||
|
@ -666,18 +669,20 @@ void scriptclass::run(void)
|
||||||
texty = -500;
|
texty = -500;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int linegap = graphics.getlinegap();
|
||||||
|
|
||||||
//next is whether to position above or below
|
//next is whether to position above or below
|
||||||
if (INBOUNDS_VEC(i, obj.entities) && words[2] == "above")
|
if (INBOUNDS_VEC(i, obj.entities) && words[2] == "above")
|
||||||
{
|
{
|
||||||
if (j == 1) //left
|
if (j == 1) //left
|
||||||
{
|
{
|
||||||
textx = obj.entities[i].xp -10000; //tells the box to be oriented correctly later
|
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
|
else if (j == 0) //Right
|
||||||
{
|
{
|
||||||
textx = obj.entities[i].xp - 16;
|
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))
|
else if (INBOUNDS_VEC(i, obj.entities))
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include "Font.h"
|
#include "Font.h"
|
||||||
#include "UTF8.h"
|
#include "UTF8.h"
|
||||||
|
|
||||||
textboxclass::textboxclass(void)
|
textboxclass::textboxclass(int gap)
|
||||||
{
|
{
|
||||||
w = 0;
|
w = 0;
|
||||||
h = 0;
|
h = 0;
|
||||||
|
@ -19,6 +19,7 @@ textboxclass::textboxclass(void)
|
||||||
r = 0;
|
r = 0;
|
||||||
g = 0;
|
g = 0;
|
||||||
b = 0;
|
b = 0;
|
||||||
|
linegap = gap;
|
||||||
|
|
||||||
flipme = false;
|
flipme = false;
|
||||||
|
|
||||||
|
@ -132,7 +133,7 @@ void textboxclass::resize(void)
|
||||||
|
|
||||||
// 16 for the borders
|
// 16 for the borders
|
||||||
w = max + 16;
|
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)
|
void textboxclass::addline(const std::string& t)
|
||||||
|
|
|
@ -23,7 +23,7 @@ enum TextboxImage
|
||||||
class textboxclass
|
class textboxclass
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
textboxclass(void);
|
textboxclass(int gap);
|
||||||
|
|
||||||
void addsprite(int x, int y, int tile, int col);
|
void addsprite(int x, int y, int tile, int col);
|
||||||
|
|
||||||
|
@ -57,6 +57,7 @@ public:
|
||||||
std::vector<std::string> lines;
|
std::vector<std::string> lines;
|
||||||
int xp, yp, w, h;
|
int xp, yp, w, h;
|
||||||
int r,g,b;
|
int r,g,b;
|
||||||
|
int linegap;
|
||||||
int timer;
|
int timer;
|
||||||
|
|
||||||
float tl;
|
float tl;
|
||||||
|
|
Loading…
Reference in a new issue