rename button to clickable

This commit is contained in:
jacekpoz 2024-08-12 23:48:14 +02:00
parent 50197a6a21
commit b95ddb45a0
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8

View file

@ -24,7 +24,7 @@ typedef enum {
PTK_COMPONENT_TYPE_TRIANGLE = 1, PTK_COMPONENT_TYPE_TRIANGLE = 1,
PTK_COMPONENT_TYPE_RECT = 2, PTK_COMPONENT_TYPE_RECT = 2,
PTK_COMPONENT_TYPE_ELLIPSE = 3, PTK_COMPONENT_TYPE_ELLIPSE = 3,
PTK_COMPONENT_TYPE_BUTTON = 4, PTK_COMPONENT_TYPE_CLICKABLE = 4,
} PtkComponentType; } PtkComponentType;
PTK_LIST_DEFINE(PtkHandle); PTK_LIST_DEFINE(PtkHandle);
@ -58,7 +58,7 @@ PTK_COMPONENT_DEFINE(PtkEllipse,
typedef void (*MouseButtonCallback)(int button, int action, int mods); typedef void (*MouseButtonCallback)(int button, int action, int mods);
PTK_COMPONENT_DEFINE(PtkButton, PTK_COMPONENT_DEFINE(PtkClickable,
PtkHandle hitbox; PtkHandle hitbox;
MouseButtonCallback on_press; MouseButtonCallback on_press;
); );
@ -69,7 +69,7 @@ PtkHandle ptk_rect(PtkPos top_left, PtkSize size, PtkColor color);
PtkHandle ptk_square(PtkPos top_left, float size, PtkColor color); PtkHandle ptk_square(PtkPos top_left, float size, PtkColor color);
PtkHandle ptk_ellipse(PtkPos center, PtkSize radii, PtkColor color); PtkHandle ptk_ellipse(PtkPos center, PtkSize radii, PtkColor color);
PtkHandle ptk_circle(PtkPos center, float radius, PtkColor color); PtkHandle ptk_circle(PtkPos center, float radius, PtkColor color);
PtkHandle ptk_button(PtkHandle hitbox, MouseButtonCallback on_press); PtkHandle ptk_clickable(PtkHandle hitbox, MouseButtonCallback on_press);
#define PTK_BOX(...) ptk_box(sizeof((PtkHandle []){ __VA_ARGS__ }) / sizeof(PtkHandle), (PtkHandle []) { __VA_ARGS__ }) #define PTK_BOX(...) ptk_box(sizeof((PtkHandle []){ __VA_ARGS__ }) / sizeof(PtkHandle), (PtkHandle []) { __VA_ARGS__ })