Change text over nodes to just be hit points

This commit is contained in:
2011-07-01 22:23:16 -04:00
parent a2f36a447b
commit 2bdc7e0e59
3 changed files with 19 additions and 13 deletions

View File

@ -152,15 +152,16 @@ bool DrawUtils::transpare(SDL_Surface* surface, int r, int g, int b)
// Modified from
// http://www.parallelrealities.co.uk/tutorials/basic/tutorial7.php
void DrawUtils::draw_text(SDL_Surface* display, string text, int x, int y,
TTF_Font *font)
TTF_Font *font, unsigned int colour,
bool center_x, bool center_y)
{
SDL_Rect dest;
SDL_Surface *surface;
SDL_Color color;
color.r = 0;
color.g = 0;
color.b = 0;
color.r = (colour >> 16) & 0xff;
color.g = (colour >> 8) & 0xff;
color.b = colour & 0xff;
surface = TTF_RenderUTF8_Blended(font, text.c_str(), color);
@ -174,8 +175,8 @@ void DrawUtils::draw_text(SDL_Surface* display, string text, int x, int y,
}
/* Blit the surface */
dest.x = x;
dest.y = y;
dest.x = center_x ? x - (surface->w / 2) : x;
dest.y = center_y ? y - (surface->h / 2) : y;
dest.w = surface->w;
dest.h = surface->h;