[WIP] Fixing scaled font draw

This commit is contained in:
KiritoDev 2021-04-22 23:07:16 -05:00
parent b829ddb0f9
commit 7652a630c9
3 changed files with 8 additions and 6 deletions

View File

@ -429,7 +429,7 @@ void print_hud_lut_string(s8 hudLUT, s16 x, s16 y, const u8 *str) {
void print_menu_generic_string(s16 x, s16 y, const u8 *str) {
moon_draw_text(x, y, str, 0.8f);
moon_draw_text(x, y, str, 0.7f);
}
void print_credits_string(s16 x, s16 y, const u8 *str) {

View File

@ -17,15 +17,17 @@ f32 moon_get_text_width(u8* text, float scale, u8 colored) {
return size;
}
void moon_draw_text(s16 x, s16 y, const u8 *str, float scale) {
void moon_draw_text(f32 x, f32 y, const u8 *str, float scale) {
UNUSED s8 mark = DIALOG_MARK_NONE; // unused in EU
s32 strPos = 0;
u8 lineNum = 1;
y += y / scale;
Mtx *_Matrix = (Mtx *) alloc_display_list(sizeof(Mtx));
if (!_Matrix) return;
create_dl_translation_matrix(MENU_MTX_PUSH, x, y, 0.0f);
if (!_Matrix) return;
guScale(_Matrix, scale, scale, 1.f);
create_dl_translation_matrix(MENU_MTX_PUSH, x, y, 0.0f);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(_Matrix), G_MTX_MODELVIEW | G_MTX_MUL | G_MTX_NOPUSH);
while (str[strPos] != DIALOG_CHAR_TERMINATOR) {
@ -61,7 +63,7 @@ void moon_draw_text(s16 x, s16 y, const u8 *str, float scale) {
default:
render_generic_char(str[strPos]);
if (mark != DIALOG_MARK_NONE) {
create_dl_translation_matrix(MENU_MTX_PUSH, 5.0f, 5.0f, 0.0f);
//create_dl_translation_matrix(MENU_MTX_PUSH, 5.0f, 5.0f, 0.0f);
guScale(gDisplayListHead++, scale, scale, scale);
render_generic_char(mark + 0xEF);
gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW);

View File

@ -3,6 +3,6 @@
#include "types.h"
f32 moon_get_text_width(u8* text, float scale, u8 colored);
void moon_draw_text(s16 x, s16 y, const u8 *str, float scale);
void moon_draw_text(f32 x, f32 y, const u8 *str, float scale);
#endif