Nicer labels in many places.

This commit is contained in:
Linus Probert 2018-05-15 14:12:38 +02:00
parent b88318097f
commit 6d5acc698e
12 changed files with 92 additions and 42 deletions

View File

@ -45,6 +45,20 @@ addons:
name: "LiquidityC/breakhack" name: "LiquidityC/breakhack"
description: "Build submitted via Travis CI" description: "Build submitted via Travis CI"
notification_email: linus.probert@gmail.com notification_email: linus.probert@gmail.com
build_command_prepend: "mkdir -p build; cd build; cmake .." build_command_prepend: "mkdir -p _build; cd _build; cmake .."
build_command: "make" build_command: "make"
branch_pattern: coverity_scan branch_pattern: coverity_scan
before_deploy:
- cmake package
deploy:
provider: releases
api_key:
secure: "KeT/BC2ck2eqs1q4keoLe/Y9KIk+AR5shiAnA2oMQzbLWoZmxUx3Kol7rLPJ0Hfgb+aCpSpTM1njX6Kw7Nl8j4NrOkgadb3ZmfqRthFazzb93reRt+0dZZcurilHpWtMeteaZLWGWaG0j09xnI3CPPjmth6BB+/roGRsQyo1QKk0pZYsQD6ZKfGAUR1576dFyRzvsIrnfLd7rZVSNZ8HtPwN2rmSLD/cGxMCf+IafcBInPyv9p6bCoVLIDFnDdCr+kwBuSlGudT15EtDx3d9Abab3ZIS3NUpnXr2s0BmknCpyb59YsG9V0YXIQsIkwioEWiJskcAznXT/yB4XqDCq693b+0sxldsUVPw2JkMU+40V5ay2itH3SeP/LyXVFUARdWB+nn6avaFRVaZ1nHYP95CrBXC8JGB1bd7ejeEm9+cOvBOgvsZp71uRJ2OdEXN5Z3i373cyvWXPFHVbQRJS5l1dRBJR0sozYcPe8BMQ4Pv+xahFWIeyDAErUwJSiOf1Uv/x6PNxJaZTTZKCYGSRo6Ywb15bw4YnlOzDXllBxNg3IsJjJes1qFBJGR1eRMq/U9Ne+eHLk7cn2r7Fa77DtFsbONTDHftXDFHk46LDLF+HlL2wHIoTJVzLl/tXyBm3MJuaghGEvvZSwalWS3UnvMTQOBlDG0qC/ww6mlkv+Y="
file:
- "package/breakhack*.tar.gz"
- "package/breakhack*.tar.Z"
skip_cleanup: true
on:
tags: true

View File

@ -29,7 +29,7 @@ actiontext_create(Sprite *sprite)
t->sprite = sprite; t->sprite = sprite;
t->timer = timer_create(); t->timer = timer_create();
t->dead = false; t->dead = false;
t->velocity = (Vector2d) { 100, -100 }; t->velocity = (Vector2d) { 0, -100 };
t->color = (SDL_Color) { 255, 255, 255, 255 }; t->color = (SDL_Color) { 255, 255, 255, 255 };
return t; return t;
} }

View File

@ -34,13 +34,15 @@ actiontextbuilder_init(SDL_Renderer *renderer)
void void
actiontextbuilder_create_text(const char *msg, SDL_Color color, Position *p) actiontextbuilder_create_text(const char *msg, SDL_Color color, Position *p)
{ {
static SDL_Color o_color = { 0, 0, 0, 255 };
assert (gRenderer != NULL); assert (gRenderer != NULL);
Sprite *sprite = sprite_create(); Sprite *sprite = sprite_create();
sprite->pos = *p; sprite->pos = *p;
sprite_load_text_texture(sprite, "GUI/SDS_8x8.ttf", 0, 14); sprite_load_text_texture(sprite, "GUI/SDS_8x8.ttf", 0, 11, 1);
texture_load_from_text(sprite->textures[0], msg, color, gRenderer); texture_load_from_text(sprite->textures[0], msg, color, o_color, gRenderer);
sprite->dim = sprite->textures[0]->dim; sprite->dim = sprite->textures[0]->dim;
linkedlist_push(&actiontexts, actiontext_create(sprite)); linkedlist_append(&actiontexts, actiontext_create(sprite));
} }
void void
@ -53,7 +55,7 @@ actiontextbuilder_update(UpdateData *data)
actiontext_destroy(text); actiontext_destroy(text);
} else { } else {
actiontext_update(text, data); actiontext_update(text, data);
linkedlist_push(&remaining, text); linkedlist_append(&remaining, text);
} }
} }
actiontexts = remaining; actiontexts = remaining;

View File

@ -103,7 +103,7 @@ create_label_sprite(Position pos)
Sprite *s = sprite_create(); Sprite *s = sprite_create();
s->fixed = true; s->fixed = true;
s->pos = pos; s->pos = pos;
sprite_load_text_texture(s, "GUI/SDS_8x8.ttf", 0, LABEL_FONT_SIZE); sprite_load_text_texture(s, "GUI/SDS_8x8.ttf", 0, LABEL_FONT_SIZE, 0);
return s; return s;
} }
@ -195,12 +195,12 @@ gui_create(Camera *cam)
for (i = 0; i < LOG_LINES_COUNT; ++i) { for (i = 0; i < LOG_LINES_COUNT; ++i) {
t = texture_create(); t = texture_create();
texture_load_font(t, "GUI/SDS_8x8.ttf", LOG_FONT_SIZE); texture_load_font(t, "GUI/SDS_8x8.ttf", LOG_FONT_SIZE, 0);
gui->log_lines[i] = t; gui->log_lines[i] = t;
} }
gui->event_message = texture_create(); gui->event_message = texture_create();
texture_load_font(gui->event_message, "GUI/SDS_8x8.ttf", EVENT_MESSAGE_FONT_SIZE); texture_load_font(gui->event_message, "GUI/SDS_8x8.ttf", EVENT_MESSAGE_FONT_SIZE, 2);
gui->event_message_timer = timer_create(); gui->event_message_timer = timer_create();
gui->labels[CURRENT_XP_LABEL] = create_label_sprite((Position) { 16, POS_Y_XPBAR + 18 }); gui->labels[CURRENT_XP_LABEL] = create_label_sprite((Position) { 16, POS_Y_XPBAR + 18 });
@ -361,42 +361,42 @@ gui_update_player_stats(Gui *gui, Player *player, Map *map, SDL_Renderer *render
if (dungeon_level != (unsigned int) map->level) { if (dungeon_level != (unsigned int) map->level) {
m_sprintf(buffer, 200, "Dungeon level: %d", map->level); m_sprintf(buffer, 200, "Dungeon level: %d", map->level);
texture_load_from_text(gui->labels[DUNGEON_LEVEL_LABEL]->textures[0], buffer, color, renderer); texture_load_from_text(gui->labels[DUNGEON_LEVEL_LABEL]->textures[0], buffer, color, color, renderer);
gui->labels[DUNGEON_LEVEL_LABEL]->dim = gui->labels[DUNGEON_LEVEL_LABEL]->textures[0]->dim; gui->labels[DUNGEON_LEVEL_LABEL]->dim = gui->labels[DUNGEON_LEVEL_LABEL]->textures[0]->dim;
dungeon_level = (unsigned int) map->level; dungeon_level = (unsigned int) map->level;
} }
if (current_potion_sips != (int) player->potion_sips) { if (current_potion_sips != (int) player->potion_sips) {
m_sprintf(buffer, 200, "x %u", (unsigned int) player->potion_sips); m_sprintf(buffer, 200, "x %u", (unsigned int) player->potion_sips);
texture_load_from_text(gui->labels[HEALTH_POTION_LABEL]->textures[0], buffer, color, renderer); texture_load_from_text(gui->labels[HEALTH_POTION_LABEL]->textures[0], buffer, color, color, renderer);
gui->labels[HEALTH_POTION_LABEL]->dim = gui->labels[HEALTH_POTION_LABEL]->textures[0]->dim; gui->labels[HEALTH_POTION_LABEL]->dim = gui->labels[HEALTH_POTION_LABEL]->textures[0]->dim;
current_potion_sips = player->potion_sips; current_potion_sips = player->potion_sips;
} }
if (current_dagger_count != (int) player->daggers) { if (current_dagger_count != (int) player->daggers) {
m_sprintf(buffer, 200, "x %u", (unsigned int) player->daggers); m_sprintf(buffer, 200, "x %u", (unsigned int) player->daggers);
texture_load_from_text(gui->labels[DAGGER_LABEL]->textures[0], buffer, color, renderer); texture_load_from_text(gui->labels[DAGGER_LABEL]->textures[0], buffer, color, color, renderer);
gui->labels[DAGGER_LABEL]->dim = gui->labels[DAGGER_LABEL]->textures[0]->dim; gui->labels[DAGGER_LABEL]->dim = gui->labels[DAGGER_LABEL]->textures[0]->dim;
current_dagger_count = (int) player->daggers; current_dagger_count = (int) player->daggers;
} }
if (last_gold != player->gold) { if (last_gold != player->gold) {
m_sprintf(buffer, 200, "x %.2f", player->gold); m_sprintf(buffer, 200, "x %.2f", player->gold);
texture_load_from_text(gui->labels[GOLD_LABEL]->textures[0], buffer, color, renderer); texture_load_from_text(gui->labels[GOLD_LABEL]->textures[0], buffer, color, color, renderer);
gui->labels[GOLD_LABEL]->dim = gui->labels[GOLD_LABEL]->textures[0]->dim; gui->labels[GOLD_LABEL]->dim = gui->labels[GOLD_LABEL]->textures[0]->dim;
last_gold = player->gold; last_gold = player->gold;
} }
if (last_xp != (int) data.current) { if (last_xp != (int) data.current) {
m_sprintf(buffer, 200, "XP: %u / %u", data.current, data.nextLevel); m_sprintf(buffer, 200, "XP: %u / %u", data.current, data.nextLevel);
texture_load_from_text(gui->labels[CURRENT_XP_LABEL]->textures[0], buffer, color, renderer); texture_load_from_text(gui->labels[CURRENT_XP_LABEL]->textures[0], buffer, color, color, renderer);
gui->labels[CURRENT_XP_LABEL]->dim = gui->labels[CURRENT_XP_LABEL]->textures[0]->dim; gui->labels[CURRENT_XP_LABEL]->dim = gui->labels[CURRENT_XP_LABEL]->textures[0]->dim;
last_xp = data.current; last_xp = data.current;
} }
if (last_level != data.level) { if (last_level != data.level) {
m_sprintf(buffer, 200, "Level: %u", data.level); m_sprintf(buffer, 200, "Level: %u", data.level);
texture_load_from_text(gui->labels[LEVEL_LABEL]->textures[0], buffer, color, renderer); texture_load_from_text(gui->labels[LEVEL_LABEL]->textures[0], buffer, color, color, renderer);
gui->labels[LEVEL_LABEL]->dim = gui->labels[LEVEL_LABEL]->textures[0]->dim; gui->labels[LEVEL_LABEL]->dim = gui->labels[LEVEL_LABEL]->textures[0]->dim;
last_level = data.level; last_level = data.level;
} }
@ -563,6 +563,7 @@ void
gui_render_log(Gui *gui, Camera *cam) gui_render_log(Gui *gui, Camera *cam)
{ {
static SDL_Color color = { 255, 255, 255, 255 }; static SDL_Color color = { 255, 255, 255, 255 };
static SDL_Color ocolor = { 0, 0, 0, 255 };
unsigned int i; unsigned int i;
unsigned int render_count; unsigned int render_count;
@ -576,7 +577,7 @@ gui_render_log(Gui *gui, Camera *cam)
Texture *t; Texture *t;
box.y = 16 + ((LOG_FONT_SIZE+5) * i); box.y = 16 + ((LOG_FONT_SIZE+5) * i);
t = gui->log_lines[i]; t = gui->log_lines[i];
texture_load_from_text(t, log_data.log[i], color, cam->renderer); texture_load_from_text(t, log_data.log[i], color, ocolor, cam->renderer);
box.w = t->dim.width; box.w = t->dim.width;
box.h = t->dim.height; box.h = t->dim.height;
texture_render(t, &box, cam); texture_render(t, &box, cam);
@ -587,6 +588,7 @@ void
gui_render_event_message(Gui *gui, Camera *cam) gui_render_event_message(Gui *gui, Camera *cam)
{ {
static SDL_Color fg_color = { 255, 255, 255, 255 }; static SDL_Color fg_color = { 255, 255, 255, 255 };
static SDL_Color o_color = { 0, 0, 0, 255 };
static SDL_Rect box = { 0, 0, 150, 50 }; static SDL_Rect box = { 0, 0, 150, 50 };
if (timer_started(gui->event_message_timer) if (timer_started(gui->event_message_timer)
@ -600,6 +602,7 @@ gui_render_event_message(Gui *gui, Camera *cam)
texture_load_from_text(gui->event_message, texture_load_from_text(gui->event_message,
event_messages.messages[0], event_messages.messages[0],
fg_color, fg_color,
o_color,
cam->renderer); cam->renderer);
box.x = (GAME_VIEW_WIDTH/2) - (gui->event_message->dim.width/2); box.x = (GAME_VIEW_WIDTH/2) - (gui->event_message->dim.width/2);

View File

@ -77,8 +77,9 @@ static SDL_Rect rightGuiViewport;
static SDL_Rect menuViewport; static SDL_Rect menuViewport;
static Turn currentTurn = PLAYER; static Turn currentTurn = PLAYER;
static SDL_Color C_MENU_DEFAULT = { 255, 255, 0, 0 }; static SDL_Color C_MENU_DEFAULT = { 255, 255, 0 };
static SDL_Color C_MENU_HOVER = { 255, 0, 0, 0 }; static SDL_Color C_MENU_OUTLINE_DEFAULT = { 0, 0, 0, };
static SDL_Color C_MENU_HOVER = { 255, 0, 0 };
struct MENU_ITEM { struct MENU_ITEM {
char label[20]; char label[20];
@ -260,9 +261,9 @@ createMenu(Menu **menu, struct MENU_ITEM menu_items[], unsigned int size)
unsigned int hcenter; unsigned int hcenter;
Sprite *s1 = sprite_create(); Sprite *s1 = sprite_create();
sprite_load_text_texture(s1, "GUI/SDS_8x8.ttf", 0, 25); sprite_load_text_texture(s1, "GUI/SDS_8x8.ttf", 0, 25, 2);
texture_load_from_text(s1->textures[0], menu_items[i].label, texture_load_from_text(s1->textures[0], menu_items[i].label,
C_MENU_DEFAULT, gRenderer); C_MENU_DEFAULT, C_MENU_OUTLINE_DEFAULT, gRenderer);
hcenter = (SCREEN_WIDTH/2) - (s1->textures[0]->dim.width/2); hcenter = (SCREEN_WIDTH/2) - (s1->textures[0]->dim.width/2);
s1->pos = (Position) { (int) hcenter, (int) 200 + (i*50) }; s1->pos = (Position) { (int) hcenter, (int) 200 + (i*50) };
@ -270,9 +271,9 @@ createMenu(Menu **menu, struct MENU_ITEM menu_items[], unsigned int size)
s1->fixed = true; s1->fixed = true;
Sprite *s2 = sprite_create(); Sprite *s2 = sprite_create();
sprite_load_text_texture(s2, "GUI/SDS_8x8.ttf", 0, 25); sprite_load_text_texture(s2, "GUI/SDS_8x8.ttf", 0, 25, 2);
texture_load_from_text(s2->textures[0], menu_items[i].label, texture_load_from_text(s2->textures[0], menu_items[i].label,
C_MENU_HOVER, gRenderer); C_MENU_HOVER, C_MENU_OUTLINE_DEFAULT, gRenderer);
s2->pos = (Position) { (int) hcenter, (int) 200 + (i*50) }; s2->pos = (Position) { (int) hcenter, (int) 200 + (i*50) };
s2->dim = s2->textures[0]->dim; s2->dim = s2->textures[0]->dim;

View File

@ -279,8 +279,8 @@ monster_hit(Monster *monster, unsigned int dmg)
p.y += 8; p.y += 8;
Dimension d = { 8, 8 }; Dimension d = { 8, 8 };
particle_engine_bloodspray(p, d, dmg); particle_engine_bloodspray(p, d, dmg);
char msg[5]; char msg[10];
m_sprintf(msg, 5, "-%d", dmg); m_sprintf(msg, 10, "-%d", dmg);
actiontextbuilder_create_text(msg, actiontextbuilder_create_text(msg,
c_red, c_red,
&monster->sprite->pos); &monster->sprite->pos);

View File

@ -76,7 +76,7 @@ player_gain_xp(Player *player, unsigned int xp_gain)
{ {
static SDL_Color c_green = { 0, 255, 0, 255 }; static SDL_Color c_green = { 0, 255, 0, 255 };
char msg[10]; char msg[10];
m_sprintf(msg, 5, "+%dxp", xp_gain); m_sprintf(msg, 10, "+%dxp", xp_gain);
actiontextbuilder_create_text(msg, c_green, &player->sprite->pos); actiontextbuilder_create_text(msg, c_green, &player->sprite->pos);
player->xp += xp_gain; player->xp += xp_gain;
@ -121,6 +121,11 @@ has_collided(Player *player, RoomMatrix *matrix, Vector2d direction)
RoomSpace *space = &matrix->spaces[matrixPos.x][matrixPos.y]; RoomSpace *space = &matrix->spaces[matrixPos.x][matrixPos.y];
collided = space->occupied; collided = space->occupied;
if (collided) {
player->sprite->pos.x -= TILE_DIMENSION * (int)direction.x;
player->sprite->pos.y -= TILE_DIMENSION * (int)direction.y;
}
if (space->monster != NULL) { if (space->monster != NULL) {
unsigned int hit = stats_fight(&player->stats, unsigned int hit = stats_fight(&player->stats,
&space->monster->stats); &space->monster->stats);
@ -185,10 +190,7 @@ move(Player *player, RoomMatrix *matrix, Vector2d direction)
set_clip_for_direction(player, &direction); set_clip_for_direction(player, &direction);
player->sprite->pos.x += TILE_DIMENSION * (int) direction.x; player->sprite->pos.x += TILE_DIMENSION * (int) direction.x;
player->sprite->pos.y += TILE_DIMENSION * (int) direction.y; player->sprite->pos.y += TILE_DIMENSION * (int) direction.y;
if (has_collided(player, matrix, direction)) { if (!has_collided(player, matrix, direction)) {
player->sprite->pos.x -= TILE_DIMENSION * (int) direction.x;
player->sprite->pos.y -= TILE_DIMENSION * (int) direction.y;
} else {
player_step(player); player_step(player);
} }
} }

View File

@ -41,9 +41,9 @@ load_texture(SkillBar *bar, const char *path, SDL_Renderer *renderer)
s->pos = (Position) { i * 32 + 20, 20 }; s->pos = (Position) { i * 32 + 20, 20 };
s->dim = (Dimension) { 8, 8 }; s->dim = (Dimension) { 8, 8 };
s->fixed = true; s->fixed = true;
sprite_load_text_texture(s, "GUI/SDS_8x8.ttf", 0, 8); sprite_load_text_texture(s, "GUI/SDS_8x8.ttf", 0, 8, 0);
m_sprintf(buffer, 4, "%u", i+1 < 10 ? i+1 : 0); m_sprintf(buffer, 4, "%u", i+1 < 10 ? i+1 : 0);
texture_load_from_text(s->textures[0], buffer, c_yellow, renderer); texture_load_from_text(s->textures[0], buffer, c_yellow, c_yellow, renderer);
linkedlist_append(&bar->sprites, s); linkedlist_append(&bar->sprites, s);
} }
} }
@ -53,7 +53,7 @@ load_countdown_sprites(SkillBar *bar)
{ {
for (int i = 0; i < PLAYER_SKILL_COUNT; ++i) { for (int i = 0; i < PLAYER_SKILL_COUNT; ++i) {
Sprite *s = sprite_create(); Sprite *s = sprite_create();
sprite_load_text_texture(s, "GUI/SDS_8x8.ttf", 0, 16); sprite_load_text_texture(s, "GUI/SDS_8x8.ttf", 0, 16, 0);
s->fixed = true; s->fixed = true;
s->pos = (Position) { 8 + (32 * i), 8 }; s->pos = (Position) { 8 + (32 * i), 8 };
s->dim = (Dimension) { 16, 16 }; s->dim = (Dimension) { 16, 16 };
@ -151,7 +151,7 @@ render_skill_countdown(SkillBar *bar, int index, unsigned int count, Camera *cam
Sprite *s = bar->countdowns[index]; Sprite *s = bar->countdowns[index];
m_sprintf(buffer, 5, "%u", count); m_sprintf(buffer, 5, "%u", count);
texture_load_from_text(s->textures[0], buffer, color, cam->renderer); texture_load_from_text(s->textures[0], buffer, color, color, cam->renderer);
sprite_render(s, cam); sprite_render(s, cam);
} }

View File

@ -68,7 +68,7 @@ sprite_load_texture(Sprite *sprite,
sprite->destroyTextures = true; sprite->destroyTextures = true;
} }
void sprite_load_text_texture(Sprite *sprite, char * path, int index, int size) void sprite_load_text_texture(Sprite *sprite, char * path, int index, int size, int outline)
{ {
if (index > 1) if (index > 1)
fatal("in sprite_load_texture() index out of bounds"); fatal("in sprite_load_texture() index out of bounds");
@ -79,7 +79,7 @@ void sprite_load_text_texture(Sprite *sprite, char * path, int index, int size)
} }
sprite->textures[index] = texture_create(); sprite->textures[index] = texture_create();
texture_load_font(sprite->textures[index], path, size); texture_load_font(sprite->textures[index], path, size, outline);
sprite->destroyTextures = true; sprite->destroyTextures = true;
} }

View File

@ -48,7 +48,7 @@ Sprite* sprite_create(void);
void sprite_load_texture(Sprite *, char *path, int index, SDL_Renderer *); void sprite_load_texture(Sprite *, char *path, int index, SDL_Renderer *);
void sprite_load_text_texture(Sprite *, char *path, int index, int size); void sprite_load_text_texture(Sprite *, char *path, int index, int size, int outline);
void sprite_set_texture(Sprite *, Texture *, int index); void sprite_set_texture(Sprite *, Texture *, int index);

View File

@ -33,6 +33,7 @@ texture_create(void)
t->dim.width = 0; t->dim.width = 0;
t->texture = NULL; t->texture = NULL;
t->font = NULL; t->font = NULL;
t->outlineFont = NULL;
t->lastAccess = SDL_GetTicks(); t->lastAccess = SDL_GetTicks();
t->path = ""; t->path = "";
t->textureAccessType = SDL_TEXTUREACCESS_STATIC; t->textureAccessType = SDL_TEXTUREACCESS_STATIC;
@ -107,12 +108,18 @@ texture_load_from_file(Texture *texture,
} }
void void
texture_load_font(Texture *t, const char *path, unsigned int size) texture_load_font(Texture *t, const char *path, unsigned int size, int outline)
{ {
if (t->font) if (t->font)
TTF_CloseFont(t->font); TTF_CloseFont(t->font);
if (t->outlineFont)
TTF_CloseFont(t->outlineFont);
t->font = TTF_OpenFontRW(io_load_rwops(path), true, size); t->font = TTF_OpenFontRW(io_load_rwops(path), true, size);
if (outline) {
t->outlineFont = TTF_OpenFontRW(io_load_rwops(path), true, size);
TTF_SetFontOutline(t->outlineFont, outline);
}
if (t->font == NULL) { if (t->font == NULL) {
error("Failed to load font %s: %s", error("Failed to load font %s: %s",
@ -148,9 +155,28 @@ void
texture_load_from_text(Texture *t, texture_load_from_text(Texture *t,
const char *text, const char *text,
SDL_Color c, SDL_Color c,
SDL_Color oc,
SDL_Renderer *renderer) SDL_Renderer *renderer)
{ {
SDL_Surface *surface = TTF_RenderText_Solid( t->font, text, c ); SDL_Surface *bg_surface = NULL;
SDL_Surface *fg_surface = NULL;
if (t->outlineFont) {
bg_surface = TTF_RenderText_Blended(t->outlineFont, text, oc);
fg_surface = TTF_RenderText_Blended(t->font, text, c);
}
else {
fg_surface = TTF_RenderText_Solid(t->font, text, c);
}
SDL_Surface *surface = fg_surface;
if (bg_surface) {
int outline = TTF_GetFontOutline(t->outlineFont);
SDL_Rect rect = { outline, outline, fg_surface->w, fg_surface->h };
SDL_SetSurfaceBlendMode(fg_surface, SDL_BLENDMODE_BLEND);
SDL_BlitSurface(fg_surface, NULL, bg_surface, &rect);
surface = bg_surface;
SDL_FreeSurface(fg_surface);
}
if (surface == NULL) if (surface == NULL)
{ {
error("Unable to create texture from rendered text: %s", error("Unable to create texture from rendered text: %s",

View File

@ -28,6 +28,7 @@
typedef struct { typedef struct {
SDL_Texture *texture; SDL_Texture *texture;
TTF_Font *font; TTF_Font *font;
TTF_Font *outlineFont;
Dimension dim; Dimension dim;
const char *path; const char *path;
unsigned long lastAccess; unsigned long lastAccess;
@ -53,13 +54,14 @@ void
texture_load_from_file(Texture*, const char *path, SDL_Renderer*); texture_load_from_file(Texture*, const char *path, SDL_Renderer*);
void void
texture_load_font(Texture*, const char *path, unsigned int size); texture_load_font(Texture*, const char *path, unsigned int size, int outline);
void void
texture_load_from_text(Texture*, texture_load_from_text(Texture*,
const char *text, const char *text,
SDL_Color, SDL_Color,
SDL_Renderer*); SDL_Color,
SDL_Renderer*);
void void
texture_load_from_text_shaded(Texture*, texture_load_from_text_shaded(Texture*,