1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-25 01:20:37 +00:00

text bubbles

This commit is contained in:
Zeno Rogue 2019-12-25 22:01:57 +01:00
parent 4848cb1b87
commit e8ec32d078

View File

@ -3762,6 +3762,7 @@ struct flashdata {
double angle2; double angle2;
int spd; // 0 for flashes, >0 for particles int spd; // 0 for flashes, >0 for particles
color_t color; color_t color;
string text;
flashdata(int _t, int _s, cell *_w, color_t col, int sped) { flashdata(int _t, int _s, cell *_w, color_t col, int sped) {
t=_t; size=_s; where=_w; color = col; t=_t; size=_s; where=_w; color = col;
angle = rand() % 1000; spd = sped; angle = rand() % 1000; spd = sped;
@ -3771,6 +3772,13 @@ struct flashdata {
vector<flashdata> flashes; vector<flashdata> flashes;
EX void drawBubble(cell *c, color_t col, string s, ld size) {
auto fd = flashdata(ticks, 1000, c, col, 1);
fd.text = s;
fd.angle = size;
flashes.push_back(fd);
}
EX void drawFlash(cell *c) { EX void drawFlash(cell *c) {
flashes.push_back(flashdata(ticks, 1000, c, iinf[itOrbFlash].color, 0)); flashes.push_back(flashdata(ticks, 1000, c, iinf[itOrbFlash].color, 0));
} }
@ -4137,8 +4145,12 @@ EX void draw_flash(struct flashdata& f, const transmatrix& V, bool& kill) {
int tim = ticks - f.t; int tim = ticks - f.t;
if(tim <= f.size && !f.spd) kill = false; if(tim <= f.size && !f.spd) kill = false;
if(f.spd) { if(f.text != "") {
queuestr(V, (1 - tim * 1. / f.size) * f.angle, f.text, f.color);
}
else if(f.spd) {
#if CAP_SHAPES #if CAP_SHAPES
if(tim <= 300) kill = false; if(tim <= 300) kill = false;
int partcol = darkena(f.color, 0, GDIM == 3 ? 255 : max(255 - tim*255/300, 0)); int partcol = darkena(f.color, 0, GDIM == 3 ? 255 : max(255 - tim*255/300, 0));