diff options
Diffstat (limited to 'src/game_loop')
-rw-r--r-- | src/game_loop/shop.c | 7 | ||||
-rw-r--r-- | src/game_loop/shop.h | 2 | ||||
-rw-r--r-- | src/game_loop/ui.c | 9 | ||||
-rw-r--r-- | src/game_loop/ui.h | 2 |
4 files changed, 15 insertions, 5 deletions
diff --git a/src/game_loop/shop.c b/src/game_loop/shop.c index 60fc70b..ab2a1a0 100644 --- a/src/game_loop/shop.c +++ b/src/game_loop/shop.c @@ -4,7 +4,7 @@ #include "game_loop/ui.h" -void hh_shop(hh_e_game_state* hh_game_state, hh_level_entity* level_shop){ +void hh_shop(hh_e_game_state* hh_game_state, hh_level_entity* level_shop, int current_level){ static hh_e_shop_states hh_e_shop = hh_e_shop_show; static hh_e_upgrades upgrades[HH_SHOP_UPG_DISPLAY] = {0}; static uint8_t selected = 0; @@ -22,7 +22,10 @@ void hh_shop(hh_e_game_state* hh_game_state, hh_level_entity* level_shop){ selected = HH_SHOP_UPG_DISPLAY/2; hh_shop_display(selected, &upgrades); int idx = 16; - hh_ui_show_char(&idx,"aBYz09",(vec2){32,32}); + // hh_ui_show_char(&idx,"abyz09",(vec2){32,32}); + char* c[3]; + itoa(c,current_level); + hh_ui_show_char(&idx,c,(vec2){304-16-8,0}); hh_e_shop = hh_e_shop_main; break; diff --git a/src/game_loop/shop.h b/src/game_loop/shop.h index 6f8f5a7..cce0817 100644 --- a/src/game_loop/shop.h +++ b/src/game_loop/shop.h @@ -34,4 +34,4 @@ void hh_shop_display(uint8_t selected, hh_e_upgrades* upgrades); /** @brief moves 'cursor' through selection field */ void hh_shift_selected(uint8_t* pos, bool dir, uint8_t min, uint8_t max); -void hh_shop(hh_e_game_state* ,hh_level_entity* ); +void hh_shop(hh_e_game_state* ,hh_level_entity* , int); diff --git a/src/game_loop/ui.c b/src/game_loop/ui.c index 3354d43..8980d03 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,16 @@ 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'; +} + diff --git a/src/game_loop/ui.h b/src/game_loop/ui.h index 7a8ffbd..527cc74 100644 --- a/src/game_loop/ui.h +++ b/src/game_loop/ui.h @@ -17,3 +17,5 @@ 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); +/** @brief converts char* [0] to i and [1]='\0' */ +void itoa(char *c, int i); |