summaryrefslogtreecommitdiff
path: root/src/overlay.c
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrik@amftech.nl>2023-11-07 20:24:19 +0100
committerAldrik Ramaekers <aldrik@amftech.nl>2023-11-07 20:24:19 +0100
commit92489617eec44b913515404143baf5b094a16473 (patch)
treee6d3d0424491052eb6f495ab3a64b725376ee76a /src/overlay.c
parentcf3cfecbcac3835c84dce3711884b7ce0a81b6b8 (diff)
points
Diffstat (limited to 'src/overlay.c')
-rw-r--r--src/overlay.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/overlay.c b/src/overlay.c
index e1762cd..6aad6d4 100644
--- a/src/overlay.c
+++ b/src/overlay.c
@@ -121,9 +121,43 @@ void draw_debug_stats(platform_window* window) {
renderer->render_text(fnt_20, _global_camera.x, _global_camera.y + fnt_20->px_h*1, update_text, rgb(0,0,0));
}
+void draw_points(platform_window* window) {
+ int x = (int)_global_camera.x + window->width - EDGE_PADDING;
+ int y = (int)_global_camera.y + window->height - EDGE_PADDING;
+ char points_txt[20];
+
+ for (int i = 0; i < MAX_PLAYERS; i++) {
+ if (!players[i].active) continue;
+
+ sprintf(points_txt, "%d", players[i].points);
+
+ y -= fnt_20->px_h;
+ int x1 = renderer->calculate_text_width(fnt_24, points_txt);
+ renderer->render_text(fnt_24, x - x1+1, y+1, points_txt, rgba(0,0,0,120));
+ renderer->render_text(fnt_24, x - x1, y, points_txt, get_color_tint_by_player_index(i));
+
+ for (int t = 0; t < MAX_POINT_ANIMATIONS; t++) {
+ if (!players[i].point_animations[t].active) continue;
+ point_animation animation = players[i].point_animations[t];
+ sprintf(points_txt, "%d", animation.points);
+ int textw = renderer->calculate_text_width(fnt_20, points_txt);
+ int py = y - animation.position.y;
+ int px = x1 - animation.position.x;
+ px += textw+2;
+ color c = get_color_tint_by_player_index(i);
+ c.a = 255*animation.opacity;
+ renderer->render_text(fnt_20, x - px+1, py+1, points_txt, rgba(0,0,0,120*animation.opacity));
+ renderer->render_text(fnt_20, x - px, py, points_txt, c);
+ }
+
+ y -= 8;
+ }
+}
+
void draw_overlay(platform_window* window) {
OVERLAY_RENDER_DEPTH();
draw_gun_info(window);
+ draw_points(window);
draw_leaderboard(window);
draw_debug_stats(window);
} \ No newline at end of file