summaryrefslogtreecommitdiff
path: root/src/overlay.c
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrik@amftech.nl>2023-11-04 16:48:51 +0100
committerAldrik Ramaekers <aldrik@amftech.nl>2023-11-04 16:48:51 +0100
commitc162e010ae85c636131ff59e8d810be4e9960caa (patch)
tree03d2e88a7fdb7730b54eb4524abf436c098b8249 /src/overlay.c
parent88e4037c0b526e33cd03f0b62783b198d8585768 (diff)
throwables ui
Diffstat (limited to 'src/overlay.c')
-rw-r--r--src/overlay.c39
1 files changed, 32 insertions, 7 deletions
diff --git a/src/overlay.c b/src/overlay.c
index 6388d5b..485373b 100644
--- a/src/overlay.c
+++ b/src/overlay.c
@@ -11,16 +11,41 @@ static void draw_gun_info(platform_window* window) {
gun g = get_gun_by_type(p->guntype);
-
- int y = window->height - fnt_24->px_h - EDGE_PADDING;
+ int y = window->height - fnt_32->px_h - EDGE_PADDING;
int x = EDGE_PADDING;
+ int icon_h = 26;
+
+ { // Ammo
+ char ammo_txt[50];
+ sprintf(ammo_txt, "%d/%d", p->ammo_in_mag, p->total_ammo);
+ renderer->render_text(fnt_32, _global_camera.x + x+1, _global_camera.y + y+1, ammo_txt, rgba(0,0,0,120));
+ renderer->render_text(fnt_32, _global_camera.x + x, _global_camera.y + y, ammo_txt, rgb(255,255,255));
+ }
- renderer->render_text(fnt_24, (int)_global_camera.x + x, (int)_global_camera.y + y, g.name, rgb(255,255,255));
- y -= fnt_24->px_h;
+ y -= icon_h + 5;
+
+ { // Throwables
+ int offset_x = 0;
+ for (int i = 0; i < p->throwables.grenades; i++)
+ {
+ renderer->render_image_tint(img_icon_grenade, _global_camera.x + x-1 + offset_x, _global_camera.y + y-1, icon_h, icon_h, rgba(0,0,0,100));
+ renderer->render_image(img_icon_grenade, _global_camera.x + x + offset_x, _global_camera.y + y, icon_h, icon_h);
+
+ offset_x += icon_h/3;
+ }
+
+ y -= icon_h + 5;
+
+ offset_x = 0;
+ for (int i = 0; i < p->throwables.molotovs; i++)
+ {
+ renderer->render_image_tint(img_icon_molotov, _global_camera.x + x-1 + offset_x, _global_camera.y + y-1, icon_h, icon_h, rgba(0,0,0,100));
+ renderer->render_image(img_icon_molotov, _global_camera.x + x + offset_x, _global_camera.y + y, icon_h, icon_h);
+
+ offset_x += icon_h/3;
+ }
+ }
- char ammo_txt[50];
- sprintf(ammo_txt, "%d / %d", p->ammo_in_mag, p->total_ammo);
- renderer->render_text(fnt_20, (int)_global_camera.x + x, (int)_global_camera.y + y, ammo_txt, rgb(255,255,255));
}
static void draw_leaderboard_entry(int x, int y, int w, int h, char* name, char* kills, char* deaths, char* ping, bool highlighted, bool disconnected) {