Skip to content

Commit

Permalink
Fixing fonts / rendering with version 3.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
trash80 committed Apr 17, 2024
1 parent b3d50b1 commit 1c37f8b
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 23 deletions.
4 changes: 2 additions & 2 deletions src/font1.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
struct inline_font font_v1_small = {
470,
7,
8,
10,
5,
7,
0,
0,
3,
Expand Down
4 changes: 2 additions & 2 deletions src/font2.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
struct inline_font font_v1_large = {
752,
9,
10,
12,
8,
9,
0,
-40,
4,
Expand Down
6 changes: 3 additions & 3 deletions src/font3.h

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/font4.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
struct inline_font font_v2_large = {
940,
10,
12,
14,
10,
10,
0,
-2,
4,
Expand Down
4 changes: 2 additions & 2 deletions src/font5.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
struct inline_font font_v2_huge = {
1128,
12,
15,
16,
12,
12,
0,
-54,
4,
Expand Down
4 changes: 1 addition & 3 deletions src/inprint2.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,8 @@ void inprint(SDL_Renderer *dst, const char *str, Uint32 x, Uint32 y,
(Uint8)((bgcolor & 0x0000FF00) >> 8),
(Uint8)((bgcolor & 0x000000FF)), 0xFF);
bg_rect = d_rect;
bg_rect.w = selected_inline_font->glyph_x - 1;
bg_rect.w = selected_inline_font->glyph_x;
bg_rect.h = selected_inline_font->glyph_y;
bg_rect.x--;
bg_rect.y--;

SDL_RenderFillRect(dst, &bg_rect);
}
Expand Down
29 changes: 20 additions & 9 deletions src/render.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,28 +121,39 @@ void set_m8_model(unsigned int model) {
switch (model) {
case 1:
m8_hardware_model = 1;
waveform_max_height = 38;
check_and_adjust_window_and_texture_size(480, 320);
break;
default:
m8_hardware_model = 0;
waveform_max_height = 20;
check_and_adjust_window_and_texture_size(320, 240);
break;
}
}

void set_font_mode(unsigned int mode) {
if (mode < 0 || mode > 2) {
//bad font mode
return;
}
if (m8_hardware_model == 1) {
mode += 2;
}
if (font_mode == mode) return;
if (mode >= 0 && mode <= 2) {
if (m8_hardware_model == 1) {
mode += 2;

font_mode = mode;
screen_offset_y = fonts[mode]->screen_offset_y;
text_offset_y = fonts[mode]->text_offset_y;

if (m8_hardware_model == 0) {
waveform_max_height = 20;
} else {
waveform_max_height = 38;
if(font_mode == 4) {
waveform_max_height = 20;
}
font_mode = mode;
screen_offset_y = fonts[mode]->screen_offset_y;
text_offset_y = fonts[mode]->text_offset_y;
change_font(fonts[mode]);
}

change_font(fonts[mode]);
SDL_LogDebug(SDL_LOG_CATEGORY_RENDER,"Font mode %i, Screen offset %i", mode, screen_offset_y);
}

Expand Down

0 comments on commit 1c37f8b

Please sign in to comment.