summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-26 16:54:55 +0000
committerennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-26 16:54:55 +0000
commita64d58f02cd1b6d1b8095252ae8ab9316f88bb89 (patch)
tree9a362d63896fb98ef41ca751634a4637e4ef3159 /crawl-ref/source
parent0ed78b3e9b6010b91d329e65d129ee6de297b7a6 (diff)
downloadcrawl-ref-a64d58f02cd1b6d1b8095252ae8ab9316f88bb89.tar.gz
crawl-ref-a64d58f02cd1b6d1b8095252ae8ab9316f88bb89.zip
[2021070] Adding Tiles health/mp bars.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6693 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/libgui.cc28
-rw-r--r--crawl-ref/source/output.cc2
-rw-r--r--crawl-ref/source/tilefont.cc69
3 files changed, 51 insertions, 48 deletions
diff --git a/crawl-ref/source/libgui.cc b/crawl-ref/source/libgui.cc
index 5f032523ad..0d6d2b2b8e 100644
--- a/crawl-ref/source/libgui.cc
+++ b/crawl-ref/source/libgui.cc
@@ -68,34 +68,6 @@ int tile_idx_unseen_terrain(int x, int y, int what)
return t;
}
-static void _draw_hgauge(int x, int y, int ofs, int region, int len, int col)
-{
- int i;
- cgotoxy(x, y, region);
- textcolor(col);
- for (i = 0; i < len; i++)
- {
- switch((i+ ofs) % 10)
- {
- case 0: cprintf("%c",'+'); break;
- case 4: cprintf("%c",'0' + (1+(i+ofs)/10)%10); break;
- case 5: cprintf("%c",'0'); break;
- default: cprintf("%c",'-');
- }
- }
-}
-
-static void _draw_vgauge(int x, int y, int ofs, int region, int len, int col)
-{
- int i;
- textcolor(col);
- for (i = 0; i < len; i++)
- {
- cgotoxy(x, y+i, region);
- cprintf("%02d", ofs+i);
- }
-}
-
int m_getch()
{
return getch();
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index 30ab854b2e..fdcc9380bb 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -136,6 +136,7 @@ class colour_bar
textcolor(m_empty);
putch('-');
}
+#endif
// If some change colour was rendered, redraw in a few
// turns to clear it out.
@@ -143,7 +144,6 @@ class colour_bar
m_request_redraw_after = you.num_turns + 4;
else
m_request_redraw_after = 0;
-#endif
}
textcolor(LIGHTGREY);
diff --git a/crawl-ref/source/tilefont.cc b/crawl-ref/source/tilefont.cc
index f2c3c07e0f..94cbaf8e2f 100644
--- a/crawl-ref/source/tilefont.cc
+++ b/crawl-ref/source/tilefont.cc
@@ -149,7 +149,22 @@ bool FTFont::load_font(const char *font_name, unsigned int font_size)
unsigned char *pixels = new unsigned char[4 * width * height];
memset(pixels, 0, sizeof(unsigned char) * 4 * width * height);
- for (unsigned int c = 0; c < 256; c++)
+ // Special case c = 0 for full block.
+ {
+ m_glyphs[0].renderable = false;
+ for (int x = 0; x < max_width; x++)
+ for (int y = 0; y < max_height; y++)
+ {
+ unsigned int idx = x + y * width;
+ idx *= 4;
+ pixels[idx] = 255;
+ pixels[idx + 1] = 255;
+ pixels[idx + 2] = 255;
+ pixels[idx + 3] = 255;
+ }
+ }
+
+ for (unsigned int c = 1; c < 256; c++)
{
FT_Int glyph_index = FT_Get_Char_Index(face, c);
if (!glyph_index)
@@ -163,7 +178,7 @@ bool FTFont::load_font(const char *font_name, unsigned int font_size)
FT_Bitmap *bmp = &face->glyph->bitmap;
ASSERT(bmp);
- // Some glyphs (e.g. " ") don't get a buffer.
+ // Some glyphs (e.g. ' ') don't get a buffer.
if (!bmp->buffer)
continue;
@@ -235,57 +250,73 @@ void FTFont::render_textblock(unsigned int x_pos, unsigned int y_pos,
for (unsigned int x = 0; x < width; x++)
{
unsigned char c = chars[i];
+ unsigned char col_bg = colours[i] >> 4;
+ unsigned char col_fg = colours[i] & 0xF;
+
+ if (col_bg != 0)
+ {
+ FontVertLayout v;
+ v.tex_x = v.tex_y = 0;
+ v.r = term_colours[col_bg][0];
+ v.g = term_colours[col_bg][1];
+ v.b = term_colours[col_bg][2];
+ v.a = 255;
+
+ v.pos_x = adv.x;
+ v.pos_y = adv.y;
+ verts.push_back(v);
+
+ v.pos_x = adv.x;
+ v.pos_y = adv.y + m_max_advance.y;
+ verts.push_back(v);
+
+ v.pos_x = adv.x + m_max_advance.x;
+ v.pos_y = adv.y + m_max_advance.y;
+ verts.push_back(v);
+
+ v.pos_x = adv.x + m_max_advance.x;
+ v.pos_y = adv.y;
+ verts.push_back(v);
+ }
+
adv.x += m_glyphs[c].offset;
if (m_glyphs[c].renderable)
{
int this_width = m_glyphs[c].width;
- unsigned char col = colours[i];
float tex_x = (float)(c % 16) / 16.0f;
float tex_y = (float)(c / 16) / 16.0f;
float tex_x2 = tex_x + (float)this_width / (float)m_tex.width();
float tex_y2 = tex_y + texcoord_dy;
FontVertLayout v;
+ v.r = term_colours[col_fg][0];
+ v.g = term_colours[col_fg][1];
+ v.b = term_colours[col_fg][2];
+ v.a = 255;
v.pos_x = adv.x;
v.pos_y = adv.y;
v.tex_x = tex_x;
v.tex_y = tex_y;
- v.r = term_colours[col][0];
- v.g = term_colours[col][1];
- v.b = term_colours[col][2];
- v.a = 255;
verts.push_back(v);
v.pos_x = adv.x;
v.pos_y = adv.y + m_max_advance.y;
v.tex_x = tex_x;
v.tex_y = tex_y2;
- v.r = term_colours[col][0];
- v.g = term_colours[col][1];
- v.b = term_colours[col][2];
- v.a = 255;
verts.push_back(v);
v.pos_x = adv.x + this_width;
v.pos_y = adv.y + m_max_advance.y;
v.tex_x = tex_x2;
v.tex_y = tex_y2;
- v.r = term_colours[col][0];
- v.g = term_colours[col][1];
- v.b = term_colours[col][2];
- v.a = 255;
verts.push_back(v);
v.pos_x = adv.x + this_width;
v.pos_y = adv.y;
v.tex_x = tex_x2;
v.tex_y = tex_y;
- v.r = term_colours[col][0];
- v.g = term_colours[col][1];
- v.b = term_colours[col][2];
- v.a = 255;
verts.push_back(v);
}