diff options
Diffstat (limited to 'src/ui_elements/Button.c')
| -rw-r--r-- | src/ui_elements/Button.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/ui_elements/Button.c b/src/ui_elements/Button.c new file mode 100644 index 0000000..f3ab8fa --- /dev/null +++ b/src/ui_elements/Button.c @@ -0,0 +1,17 @@ +#include "UI.h" +#include <raylib.h> + +void UpdateButton(Button *btn, Rectangle *location) { + if (IsMouseInRec(*location) && IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) { + btn->OnClick(btn->parent); + } +} + +void DrawButton(Button *btn, Rectangle *location) { + DrawTexturePro(*btn->atlas, + btn->textrueLocation, + *location, + (Vector2) { 0 , 0 }, + 0, + WHITE); +} |
