From daedd308547752e0c6ea1ced8742893572957c80 Mon Sep 17 00:00:00 2001 From: huaqo-games Date: Fri, 17 Oct 2025 18:17:05 +0200 Subject: [PATCH] refactor: takes vectors instead of single ints --- external/engine/gui.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/external/engine/gui.h b/external/engine/gui.h index da9b353..cd73a3a 100644 --- a/external/engine/gui.h +++ b/external/engine/gui.h @@ -10,10 +10,13 @@ typedef struct char *text; } Button; -void initButton(Button *b, char *text, int buttonWidth, int buttonHeight, int buttonPosX, int buttonPosY) +Button initButton(char *text, Vector2 dimensions, Vector2 position) { - b->rec = (Rectangle){buttonPosX - buttonWidth / 2, buttonPosY - buttonHeight / 2, buttonWidth, buttonHeight}; - b->text = text; + Button b; + + b.rec = (Rectangle){position.x - dimensions.x / 2, position.y - dimensions.y / 2, dimensions.x, dimensions.y}; + b.text = text; + return b; } int isButtonClicked(Button *b)