diff options
Diffstat (limited to 'src/game_loop/ui.c')
-rw-r--r-- | src/game_loop/ui.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/game_loop/ui.c b/src/game_loop/ui.c index 3354d43..60dbfc2 100644 --- a/src/game_loop/ui.c +++ b/src/game_loop/ui.c @@ -16,7 +16,6 @@ void hh_ui_show_hp(int* idx, hh_entity* player, uint8_t max_hp, vec_cor cam_pos) }); } } - void hh_ui_show_char(int* idx, char* str, vec2 pos) { int i = 0; int tilemap_idx, @@ -38,10 +37,23 @@ void hh_ui_show_char(int* idx, char* str, vec2 pos) { .horizontal_flip = false, .vertical_flip = false, .palette_index = palette_idx, .tilemap_index = tilemap_idx, - .position_x = 8 + i*15, .position_y = 8 + .position_x = pos.x + i*15, .position_y = pos.y } }); i++; } } + +void itoa(char *c, int i) { + c[0] = i + '0'; + c[1] = '\0'; +} + +void hh_shift_selected(uint8_t *pos, bool dir, uint8_t min, uint8_t max) { + if (dir) { + *pos = MIN(*pos+1,max); + } else { + *pos = MAX(*pos-1,min); + } +} |