aboutsummaryrefslogtreecommitdiff
path: root/src/game_loop/ui.c
diff options
context:
space:
mode:
authorUnavailableDev <69792062+UnavailableDev@users.noreply.github.com>2023-04-06 21:35:17 +0200
committerGitHub <noreply@github.com>2023-04-06 21:35:17 +0200
commitb2c58b8d52717f8b5bf04d87b9799c7467e4eeb6 (patch)
tree344243247b21a93311a9cc2173fbddb2d126c040 /src/game_loop/ui.c
parent8be7919774250cca23151bf1505cbb48d1dd45ee (diff)
parente88c48ae60dd48542e44b0cc244b191c91782681 (diff)
Merge pull request #60 from UnavailableDev/dev
random shop items + animation (slimes)
Diffstat (limited to 'src/game_loop/ui.c')
-rw-r--r--src/game_loop/ui.c16
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);
+ }
+}