From 7ac57c976d95bce5a7a98e0f269e4cd3d61f3055 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Sat, 5 Apr 2025 16:41:32 +0100 Subject: Pass screen width and height into HudPaint events This makes it unnecessary to call hud_screensize in basically every handler. --- src/xhair.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/xhair.c') diff --git a/src/xhair.c b/src/xhair.c index 1f9d1a6..1ba87f1 100644 --- a/src/xhair.c +++ b/src/xhair.c @@ -54,11 +54,9 @@ static inline void drawrect(int x0, int y0, int x1, int y1, struct rgba colour, if (outline) hud_drawrect(x0, y0, x1, y1, (struct rgba){.a = 255}, false); } -HANDLE_EVENT(HudPaint) { +HANDLE_EVENT(HudPaint, int w, int h) { if (!con_getvari(sst_xhair)) return; if (has_vtidx_IsInGame && engclient && !IsInGame(engclient)) return; - int w, h; - hud_screensize(&w, &h); int thick = con_getvari(sst_xhair_thickness); int thick1 = (thick + 1) / 2, thick2 = thick - thick1; int sz = con_getvari(sst_xhair_size); -- cgit v1.2.3-54-g00ecf