#include #include #include static PtkRect *r; static void on_press(const int button, const int action, const int mods) { (void)button; (void)action; (void)mods; PTK_DEBUG("pressed!"); r->color.r = r->color.r + (1.0f / 255.0f); if (r->color.r == 256.0f) { r->color.r = 0.0f; } } int main(void) { if (!ptk_init(800, 600, "button", (PtkVersion){ .major = 0, .minor = 1, .patch = 0 })) { return EXIT_FAILURE; } r = (PtkRect *)ptk_rect( (PtkPos){ .x = 100.0f, .y = 100.0f }, (PtkSize){ .w = 100.0f, .h = 50.0f }, (PtkColor){ .r = 1.0f, .g = 0.0f, .b = 0.0f } ); return ptk_run( ptk_clickable((PtkHandle)r, on_press) ); }