Fixes colors to use defines.
This commit is contained in:
parent
2462e4cf33
commit
bbe4526947
|
@ -30,7 +30,7 @@ actiontext_create(Sprite *sprite)
|
||||||
t->timer = timer_create();
|
t->timer = timer_create();
|
||||||
t->dead = false;
|
t->dead = false;
|
||||||
t->velocity = (Vector2d) { 0, -100 };
|
t->velocity = (Vector2d) { 0, -100 };
|
||||||
t->color = (SDL_Color) { 255, 255, 255, 255 };
|
t->color = C_WHITE;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
25
src/gui.c
25
src/gui.c
|
@ -340,8 +340,6 @@ gui_update_player_stats(Gui *gui, Player *player, Map *map, SDL_Renderer *render
|
||||||
static int current_potion_sips = -1;
|
static int current_potion_sips = -1;
|
||||||
static int current_dagger_count = -1;
|
static int current_dagger_count = -1;
|
||||||
|
|
||||||
static SDL_Color color = { 255, 255, 255, 255 };
|
|
||||||
|
|
||||||
char buffer[200];
|
char buffer[200];
|
||||||
|
|
||||||
ExperienceData data = player_get_xp_data(player);
|
ExperienceData data = player_get_xp_data(player);
|
||||||
|
@ -361,42 +359,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, color, renderer);
|
texture_load_from_text(gui->labels[DUNGEON_LEVEL_LABEL]->textures[0], buffer, C_WHITE, C_BLACK, 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, color, renderer);
|
texture_load_from_text(gui->labels[HEALTH_POTION_LABEL]->textures[0], buffer, C_WHITE, C_BLACK, 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, color, renderer);
|
texture_load_from_text(gui->labels[DAGGER_LABEL]->textures[0], buffer, C_WHITE, C_BLACK, 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, color, renderer);
|
texture_load_from_text(gui->labels[GOLD_LABEL]->textures[0], buffer, C_WHITE, C_BLACK, 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, color, renderer);
|
texture_load_from_text(gui->labels[CURRENT_XP_LABEL]->textures[0], buffer, C_WHITE, C_BLACK, 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, color, renderer);
|
texture_load_from_text(gui->labels[LEVEL_LABEL]->textures[0], buffer, C_WHITE, C_BLACK, 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;
|
||||||
}
|
}
|
||||||
|
@ -562,9 +560,6 @@ gui_event_message(const char *fmt, ...)
|
||||||
void
|
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 ocolor = { 0, 0, 0, 255 };
|
|
||||||
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned int render_count;
|
unsigned int render_count;
|
||||||
SDL_Rect box = { 16, 0, 16, 16 };
|
SDL_Rect box = { 16, 0, 16, 16 };
|
||||||
|
@ -577,7 +572,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, ocolor, cam->renderer);
|
texture_load_from_text(t, log_data.log[i], C_WHITE, C_BLACK, 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,8 +582,6 @@ gui_render_log(Gui *gui, Camera *cam)
|
||||||
void
|
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 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)
|
||||||
|
@ -601,8 +594,8 @@ gui_render_event_message(Gui *gui, Camera *cam)
|
||||||
if (event_messages.count > 0) {
|
if (event_messages.count > 0) {
|
||||||
texture_load_from_text(gui->event_message,
|
texture_load_from_text(gui->event_message,
|
||||||
event_messages.messages[0],
|
event_messages.messages[0],
|
||||||
fg_color,
|
C_WHITE,
|
||||||
o_color,
|
C_BLACK,
|
||||||
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);
|
||||||
|
|
|
@ -54,7 +54,7 @@ create_particle(void)
|
||||||
p->lifetime = 100;
|
p->lifetime = 100;
|
||||||
p->fixed = false;
|
p->fixed = false;
|
||||||
p->blend_mode = SDL_BLENDMODE_MOD;
|
p->blend_mode = SDL_BLENDMODE_MOD;
|
||||||
p->color = (SDL_Color) { 255, 255, 255, 255 };
|
p->color = C_WHITE;
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ particle_engine_bloodspray(Position pos, Dimension dim, unsigned int count)
|
||||||
p->movetime = mt;
|
p->movetime = mt;
|
||||||
p->lifetime = lt;
|
p->lifetime = lt;
|
||||||
p->dim = (Dimension) { w, h };
|
p->dim = (Dimension) { w, h };
|
||||||
p->color = (SDL_Color) { 255, 0, 0, 255 };
|
p->color = C_RED;
|
||||||
linkedlist_append(&engine->game_particles, p);
|
linkedlist_append(&engine->game_particles, p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,7 +201,7 @@ player_sip_health(Player *player)
|
||||||
--player->potion_sips;
|
--player->potion_sips;
|
||||||
++player->stats.hp;
|
++player->stats.hp;
|
||||||
mixer_play_effect(BUBBLE0 + get_random(2));
|
mixer_play_effect(BUBBLE0 + get_random(2));
|
||||||
gui_log("You take a sip of health potion");
|
gui_log("You take a sip from a health potion");
|
||||||
actiontextbuilder_create_text("+1", C_GREEN, &player->sprite->pos);
|
actiontextbuilder_create_text("+1", C_GREEN, &player->sprite->pos);
|
||||||
} else {
|
} else {
|
||||||
gui_log("You have nothing to sip");
|
gui_log("You have nothing to sip");
|
||||||
|
|
|
@ -212,21 +212,6 @@ roommatrix_render_mouse_square(RoomMatrix *matrix, Camera *cam)
|
||||||
SDL_RenderFillRect(cam->renderer, &box);
|
SDL_RenderFillRect(cam->renderer, &box);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LIGHTMAPDEBUG
|
|
||||||
static Texture *
|
|
||||||
create_light_texture(int light, Camera *cam)
|
|
||||||
{
|
|
||||||
static SDL_Color color = { 255, 255, 0, 0 };
|
|
||||||
|
|
||||||
char buffer[4];
|
|
||||||
Texture *t = texture_create();
|
|
||||||
texture_load_font(t, "GUI/SDS_8x8.ttf", 8);
|
|
||||||
m_sprintf(buffer, 4, "%d", light);
|
|
||||||
texture_load_from_text(t, buffer, color, cam->renderer);
|
|
||||||
return t;
|
|
||||||
}
|
|
||||||
#endif // LIGHTMAPDEBUG
|
|
||||||
|
|
||||||
void
|
void
|
||||||
roommatrix_render_lightmap(RoomMatrix *matrix, Camera *cam)
|
roommatrix_render_lightmap(RoomMatrix *matrix, Camera *cam)
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,8 +30,6 @@
|
||||||
static void
|
static void
|
||||||
load_texture(SkillBar *bar, const char *path, SDL_Renderer *renderer)
|
load_texture(SkillBar *bar, const char *path, SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
static SDL_Color c_yellow = { 255, 255, 0, 255 };
|
|
||||||
|
|
||||||
Texture *t = texturecache_add(path);
|
Texture *t = texturecache_add(path);
|
||||||
t->dim.width = 16;
|
t->dim.width = 16;
|
||||||
t->dim.height = 16;
|
t->dim.height = 16;
|
||||||
|
@ -44,7 +42,7 @@ load_texture(SkillBar *bar, const char *path, SDL_Renderer *renderer)
|
||||||
s->fixed = true;
|
s->fixed = true;
|
||||||
sprite_load_text_texture(s, "GUI/SDS_8x8.ttf", 0, 8, 0);
|
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, c_yellow, renderer);
|
texture_load_from_text(s->textures[0], buffer, C_YELLOW, C_BLACK, renderer);
|
||||||
linkedlist_append(&bar->sprites, s);
|
linkedlist_append(&bar->sprites, s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,12 +145,11 @@ render_activation_indicator(SkillBar *bar, Camera *cam)
|
||||||
static void
|
static void
|
||||||
render_skill_countdown(SkillBar *bar, int index, unsigned int count, Camera *cam)
|
render_skill_countdown(SkillBar *bar, int index, unsigned int count, Camera *cam)
|
||||||
{
|
{
|
||||||
static SDL_Color color = { 255, 255, 255, 255 };
|
|
||||||
char buffer[5];
|
char buffer[5];
|
||||||
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, color, cam->renderer);
|
texture_load_from_text(s->textures[0], buffer, C_WHITE, C_BLACK, cam->renderer);
|
||||||
sprite_render(s, cam);
|
sprite_render(s, cam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue