lav-sdl

SDL верзија програма Лавиринт
git clone https://git.sr.ht/~strahinja/lav-sdl
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

чување 392f8250b82ad25d83200b4259ae4eabc037a8f1
родитељ 7f41402476014e1204971f773eaa6a0b37fada03
Аутор: Страхиња Радић <sr@strahinja.org>
Датум:   Wed,  9 Jul 2025 12:41:32 +0200

Replace 16px Terminus texture with 12px; continue WIP v2.0

Diffstat:
MREADME | 2+-
Mlav-sdl.c | 38+++++++++++++++++++-------------------
Mlocal.h.in | 2+-
Ater12.png | 0
Ater12.xcf.xz | 0
измењених датотека: 5, додавања: 21(+), брисања: 21(-)

diff --git a/README b/README @@ -53,7 +53,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. Sprite sheet sprites.png (source file sprites.xcf.xz) hand drawn/crafted in GIMP by Strahinya Radich. -Sprite sheet ter16.png (source file ter16.xcf.xz) created in GIMP using Terminus +Sprite sheet ter12.png (source file ter12.xcf.xz) created in GIMP using Terminus font 4.49.1. Terminus font Copyright (C) 2020 Dimitar Toshkov Zhekov[1], licensed under SIL Open Font License 1.1. See file OFL.TXT for more information. diff --git a/lav-sdl.c b/lav-sdl.c @@ -17,16 +17,16 @@ #define CELL_SIZE 32 #define DEFAULT_WIDTH 1280 #define DEFAULT_HEIGHT 720 -#define HELP_DIALOG_WIDTH 1200 -#define HELP_DIALOG_HEIGHT 600 +#define HELP_DIALOG_WIDTH 900 +#define HELP_DIALOG_HEIGHT 450 #define LABYRINTH_MAXHEIGHT 20 #define LABYRINTH_MAXWIDTH 40 #define LOCATION_STACK_MAX (LABYRINTH_MAXWIDTH * LABYRINTH_MAXHEIGHT) #define PRINT_BUFSIZE 4096 #define PROGNAME "lav-sdl" -#define SEARCHING_DELAY 0 -#define TER16_WIDTH 8 -#define TER16_HEIGHT 17 +#define SEARCHING_DELAY 5 +#define TER12_WIDTH 6 +#define TER12_HEIGHT 12 #define WIN_TITLE "Lavirint (SDL version)" #define MIN(a, b) (((a) < (b)) ? (a) : (b)) @@ -103,7 +103,7 @@ static int screen_width = DEFAULT_WIDTH; static int screen_height = DEFAULT_HEIGHT; static SDL_Texture* sprites = NULL; static int state = STATE_SEARCHING_PAUSED; -static SDL_Texture* ter16_texture = NULL; +static SDL_Texture* ter12_texture = NULL; static SDL_Texture* background = NULL; static SDL_Window* window = NULL; static float text_scale_factor = 2.0f; @@ -178,8 +178,8 @@ cleanup(void) if (background) SDL_DestroyTexture(background); - if (ter16_texture) - SDL_DestroyTexture(ter16_texture); + if (ter12_texture) + SDL_DestroyTexture(ter12_texture); if (sprites) SDL_DestroyTexture(sprites); if (renderer) @@ -270,8 +270,8 @@ draw(void) SDL_RenderTexture(renderer, sprites, &cell_rect, &dest_rect); /* Render status */ - draw_text(startx, starty + bg_rect.h, TER16_WIDTH, TER16_HEIGHT, - ter16_texture, + draw_text(startx, starty + bg_rect.h, TER12_WIDTH, TER12_HEIGHT, + ter12_texture, "Column: %2d, Row: %2d F1 = Help Status: %s", hero.x + 1, hero.y + 1, state_descriptions[state]); @@ -379,11 +379,11 @@ draw_help_dialog(void) while (*phelp_text) { - draw_text(sx + text_scale_factor * (2 * TER16_WIDTH), - sy + text_scale_factor * (TER16_HEIGHT + 2) - + (phelp_text - help_text) * text_scale_factor - * (TER16_HEIGHT + 2), - TER16_WIDTH, TER16_HEIGHT, ter16_texture, *phelp_text); + draw_text(sx + text_scale_factor * (2 * TER12_WIDTH), + sy + + (phelp_text - help_text + 1) + * text_scale_factor * (TER12_HEIGHT + 2), + TER12_WIDTH, TER12_HEIGHT, ter12_texture, *phelp_text); phelp_text++; } } @@ -607,17 +607,17 @@ load_textures(void) SDL_SetTextureScaleMode(sprites, scale_mode); SDL_DestroySurface(surface); - surface = try_load(TER16_PNG); + surface = try_load(TER12_PNG); if (!surface) return -1; - ter16_texture = SDL_CreateTextureFromSurface(renderer, surface); - if (!ter16_texture) + ter12_texture = SDL_CreateTextureFromSurface(renderer, surface); + if (!ter12_texture) { print_error("SDL_CreateTextureFromSurface failed: %s", SDL_GetError()); exit(1); } - SDL_SetTextureScaleMode(ter16_texture, scale_mode); + SDL_SetTextureScaleMode(ter12_texture, scale_mode); SDL_DestroySurface(surface); return 0; diff --git a/local.h.in b/local.h.in @@ -4,5 +4,5 @@ #define DATADIR "%DATADIR%" #define DEFAULT_DATAFILE "lavirint.dat" -#define TER16_PNG "ter16.png" +#define TER12_PNG "ter12.png" #define SPRITES_PNG "sprites.png" diff --git a/ter12.png b/ter12.png Бинарне датотеке се разликују. diff --git a/ter12.xcf.xz b/ter12.xcf.xz Бинарне датотеке се разликују.