From da3ed65e48bd2a1a84bef1082a6039423ff950ff Mon Sep 17 00:00:00 2001 From: Vitaly Driedfruit Date: Wed, 17 Apr 2013 09:24:33 +0400 Subject: [PATCH] Fix SDL_inprint invokation. --- src/draw.c | 24 +++++++++++++----------- src/mainmenu.c | 4 +++- src/rune2.c | 35 +++++++---------------------------- 3 files changed, 23 insertions(+), 40 deletions(-) diff --git a/src/draw.c b/src/draw.c index 40df57b..7f9dbf8 100644 --- a/src/draw.c +++ b/src/draw.c @@ -1,5 +1,7 @@ #include +#include "libs/SDL_inprint/SDL2_inprint.h" + #include "game.h" #include "ui.h" #include "draw.h" @@ -473,8 +475,8 @@ void draw_unitname(SDL_Renderer *screen, unit_t *u, Uint32 y, Uint8 offset) { if (!u->tile) draw_tile(screen, 0, 0, x, y); else draw_tile(screen, tile, frame, x + 2, y); - incolor(bunits[u->tile].color); - incolor(0x00ffffff); + incolor1(&bunits[u->tile].color); + incolor(0x00ffffff, 0); inprint(screen, u->name, x + 17, y + offset); //inprint(screen, bunits[u->tile].title, x + 17, y+8+3); } @@ -526,7 +528,7 @@ void draw_housebox(SDL_Renderer *screen) { draw_tile(screen, 0, h->tile+1, x, y); /* house icon */ y += 3; /* small offset after icon */ - incolor(0x00FFFFFF); + incolor(0x00FFFFFF, 0); infont(large_font); inprint(screen, "Something", x + 17, y); @@ -550,7 +552,7 @@ void draw_housebox(SDL_Renderer *screen) { infont(mid_font); draw_unitname(screen, u, y, 2); - incolor(0x00999999); + incolor(0x00999999, 0); infont(small_font); rprintf(screen, x + 17, y + 8 + 2, "PROG: %d (%d gold)", u->progress, u->gold); @@ -593,16 +595,16 @@ if (!u->tile) draw_tile(screen, 0, 0, x, y); else //draw_tile(screen, tile, frame, x, y); } inprint(screen, u->name, x + 17, y + 3); - incolor(bunits[u->tile].color); + incolor1(&bunits[u->tile].color); inprint(screen, bunits[u->tile].title, x + 17, y+8+3); /* Draw pin */ draw_tile(screen, TILE_UICO_Y, TILE_UICO_X + 4 + u->pin, x + 110, y); draw_tile(screen, TILE_UICO_Y, TILE_UICO_X + icon, x + 26, y + 114); - incolor(state_colors[icon]); + incolor(state_colors[icon], 0); inprint(screen, state_names[icon], x + 16 + 17, y+110+3); - incolor(0xFFFFFFFF); + incolor(0xFFFFFFFF, 0); x += BOX_PADDING; y += BOX_PADDING; @@ -693,7 +695,7 @@ void draw_hintbox(SDL_Renderer *screen) { house_p *h = &bhouses[ui.hint]; infont(large_font); - incolor(0xffffff); + incolor(0xffffff, 0); inprint(screen, h->title, x, y); } @@ -701,17 +703,17 @@ void draw_hintbox(SDL_Renderer *screen) { if (ui.hintType == 1) { // Stat infont(large_font); - incolor(0xffffff); + incolor(0xffffff, 0); inprint(screen, stat_long_names[ui.hint], x, y); y += 32; infont(small_font); - incolor(0x999999); + incolor(0x999999, 0); inprint(screen, stat_descriptions[ui.hint], x, y); y += 32; infont(mid_font); - incolor(0xffffff); + incolor(0xffffff, 0); rprintf(screen, x, y, "1 forcible (100 blood ore)"); } diff --git a/src/mainmenu.c b/src/mainmenu.c index 5068b1f..02fad37 100644 --- a/src/mainmenu.c +++ b/src/mainmenu.c @@ -227,7 +227,9 @@ int mainmenu_loop(SDL_Renderer *renderer) { SDL_Color white = { 0xff, 0xff, 0xff }; bg = ASS_LoadTexture("data/endowment.bmp", NULL); - tiles = ASS_LoadTexture("runelord.bmp", &white); + tiles = ASS_LoadTexture("data/gfx/runelord.bmp", &white); + + printf("Tiles: %p -- %s\n", tiles, SDL_GetError()); int done = 0; diff --git a/src/rune2.c b/src/rune2.c index cabdb62..ef31bf1 100644 --- a/src/rune2.c +++ b/src/rune2.c @@ -442,27 +442,6 @@ void prepare_units() { } } -void reload_assets() { - - SDL_Color tcol = { 0xff, 0xff, 0xff }; - -ASS_Quit(); -ASS_Init(mainRenderer); - - tiles = ASS_LoadTexture("runelord.bmp", &tcol); - -// cfg_load("rune.cfg"); - - uibg = ASS_LoadTexture("woodui.bmp", &tcol); - - SDL_Color magenta = { 0xff, 0, 0xff }; - - small_font = ASS_LoadTexture("data/fonts/oddball6x8.bmp", &magenta); - - mid_font = ASS_LoadTexture("data/fonts/webby8.bmp", &magenta); - -} - void init_game() { init_factions(); @@ -482,13 +461,14 @@ void init_game() { SDL_Color tcol = { 0xff, 0xff, 0xff }; - tiles = ASS_LoadTexture("runelord.bmp", &tcol); + tiles = ASS_LoadTexture("data/gfx/runelord.bmp", &tcol); -// prepare_units(); +printf("Tiles: %p, %s\n", tiles, SDL_GetError()); +// prepare_units(); - cfg_load("rune.cfg"); + cfg_load("data/rune.cfg"); - uibg = ASS_LoadTexture("woodui.bmp", &tcol); + uibg = ASS_LoadTexture("data/gfx/woodui.bmp", &tcol); SDL_Color magenta = { 0xff, 0, 0xff }; @@ -673,8 +653,6 @@ void do_event(SDL_Event *e) { if (e->key.keysym.sym == SDLK_1) ui.game_speed = 25; if (e->key.keysym.sym == SDLK_5) ui.game_speed = 1; - if (e->key.keysym.sym == SDLK_9) reload_assets(); - if (e->key.keysym.sym == SDLK_s) ui.draw_scent = 1 - ui.draw_scent; if (e->key.keysym.sym == SDLK_t) ui.draw_path = 1 - ui.draw_path; if (e->key.keysym.sym == SDLK_f) ui.draw_fog = 1 - ui.draw_fog; @@ -1148,7 +1126,8 @@ int rune_main(int argc, char* argv[]) { ASS_Init(screen); - prepare_inline_font(screen); + inrenderer(screen); + prepare_inline_font(); mainRenderer = screen; -- 2.11.4.GIT