Skip to content

Commit

Permalink
6x8 font
Browse files Browse the repository at this point in the history
  • Loading branch information
goblinhack committed Jan 17, 2025
1 parent 88f807b commit 7056ee2
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 8 deletions.
Binary file added data/fonts/6x8.tga
Binary file not shown.
Binary file added data/fonts/6x8.xcf
Binary file not shown.
Binary file removed data/fonts/PressStart.tga
Binary file not shown.
Binary file removed data/fonts/PressStart.xcf
Binary file not shown.
2 changes: 1 addition & 1 deletion src/gfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ static void gfx_init_font_ui(void)
"nothing",
};

tile_load_arr("data/fonts/PressStart.tga", "font_ui", UI_FONT_WIDTH, UI_FONT_HEIGHT, ARRAY_SIZE(tiles), tiles);
tile_load_arr("data/fonts/6x8.tga", "font_ui", UI_FONT_WIDTH, UI_FONT_HEIGHT, ARRAY_SIZE(tiles), tiles);
}

static void gfx_ui_init_0(void)
Expand Down
2 changes: 1 addition & 1 deletion src/my_ui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#define UI_CURSOR_COLOR GRAY
#define UI_CURSOR_OTHER_COLOR WHITE
#define UI_FONT_HEIGHT 8
#define UI_FONT_WIDTH 8
#define UI_FONT_WIDTH 6
#define UI_LEFTBAR_WIDTH 20 // In characters
#define UI_RIGHTBAR_WIDTH 20 // In characters
#define UI_LOGGING_EMPTY_LINE "`" // Complete hack, char I use to force space
Expand Down
18 changes: 12 additions & 6 deletions src/sdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -722,14 +722,20 @@ void config_game_gfx_update(void)
LOG("SDL: - term size : %dx%d", TERM_WIDTH, TERM_HEIGHT);
LOG("SDL: - ascii gl size : %ux%u", game_ascii_pix_width_get(game), game_ascii_pix_height_get(game));

//
// If the font has an odd number, it will look bad. Try the next power.
//
font_width = nextpoweroftwo(font_width);
font_height = nextpoweroftwo(font_height);
if (0) {
//
// If the font has an odd number, it will look bad. Try the next power.
//
font_width = nextpoweroftwo(font_width);
font_height = nextpoweroftwo(font_height);
game_ascii_pix_width_set(game, font_width);
game_ascii_pix_height_set(game, font_height);
LOG("SDL: - ascii gl size (pow2) : %ux%u", game_ascii_pix_width_get(game), game_ascii_pix_height_get(game));
}
font_width = 6;
font_height = 8;
game_ascii_pix_width_set(game, font_width);
game_ascii_pix_height_set(game, font_height);
LOG("SDL: - ascii gl size (pow2) : %ux%u", game_ascii_pix_width_get(game), game_ascii_pix_height_get(game));

//
// If we overflow the screen, try to cut a few rows and columns off
Expand Down

0 comments on commit 7056ee2

Please sign in to comment.