Change text over nodes to just be hit points
This commit is contained in:
@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user