Skip to content

Commit

Permalink
Move author face to the right for RTL languages
Browse files Browse the repository at this point in the history
This is quite a last-minute thing that was almost getting called off by
me discovering a critical segfault just now in testing this (whew) but
this shouldn't hurt.
  • Loading branch information
Daaaav authored and InfoTeddy committed Jan 10, 2024
1 parent 95c5bd8 commit ff25e18
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions desktop_version/src/Graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ void Graphics::printcrewnamestatus( int x, int y, int t, bool rescued )
}

void Graphics::print_level_creator(
const uint32_t print_flags,
uint32_t print_flags,
const int y,
const std::string& creator,
const uint8_t r,
Expand All @@ -423,11 +423,25 @@ void Graphics::print_level_creator(
* - if anyone is sad about this decision, the happy face will cheer them up anyway :D */
int width_for_face = 17;
int total_width = width_for_face + font::len(print_flags, creator.c_str());
int face_x = (SCREEN_WIDTH_PIXELS - total_width) / 2;
int face_x, text_x, sprite_x;
if (!font::is_rtl(print_flags))
{
face_x = (SCREEN_WIDTH_PIXELS - total_width) / 2;
text_x = face_x + width_for_face;
sprite_x = 7;
}
else
{
face_x = (SCREEN_WIDTH_PIXELS + total_width) / 2;
text_x = face_x - width_for_face;
face_x -= 10; // sprite origin
sprite_x = 103;
print_flags |= PR_RIGHT;
}
set_texture_color_mod(grphx.im_sprites, r, g, b);
draw_texture_part(grphx.im_sprites, face_x, y - 1, 7, 2, 10, 10, 1, 1);
draw_texture_part(grphx.im_sprites, face_x, y - 1, sprite_x, 2, 10, 10, 1, 1);
set_texture_color_mod(grphx.im_sprites, 255, 255, 255);
font::print(print_flags, face_x + width_for_face, y, creator, r, g, b);
font::print(print_flags, text_x, y, creator, r, g, b);
}

int Graphics::set_render_target(SDL_Texture* texture)
Expand Down

0 comments on commit ff25e18

Please sign in to comment.