ptk/examples/button.c

40 lines
982 B
C
Raw Normal View History

2024-09-08 12:00:31 +02:00
// Copyright (jacekpoz 2024). Licensed under the EUPL-1.2 or later.
Squashed commit of the following: commit ef2fdaab863af71f7afcf23b469f4f220c538d8b Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 14:22:09 2024 +0200 improve all vector types by deunionifying them commit e9948256687a767e2e81a5c1aee2fd47942548c2 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 14:19:56 2024 +0200 use w and h for radii in ellipse intersects commit 2eb53fb8a3045c3f3b5679a278158e6efecb8e98 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:47:03 2024 +0200 add PTK_LIST_CLEAR commit a63f65067ded311192358c4aa54f207e307a8e02 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:46:29 2024 +0200 remove semicolon from filled macro commit 4ac6a1bb70833579898034b4e44486ba62d5cfa6 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:31:13 2024 +0200 ... commit 5142127ae0a73a83534561c6b3873b1cfb74ffab Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:50:08 2024 +0200 add clickable to components if encountered commit b1f31b79650ed7cb74715864b1332973382298fc Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:41:52 2024 +0200 stupid fucking switch syntax commit 8ff74e7235c34ed5a85258f568516d61a38dd416 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:40:05 2024 +0200 remove redundant vertex update commit 448e9fed146fa547293a6ce4eb36841a53e26c6f Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:10:48 2024 +0200 handle button hitboxes properly commit a4025fa924b50eb1e51676626f30da8c54a1c34a Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:04:11 2024 +0200 add more const on local variables commit c7386ddfbff8e52ad21964c021e3d22b90c1010d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:02:24 2024 +0200 fix rect triangle comments (xd) commit ca212ac65ec903ea448cb1cd8ae62b89b60fe5d3 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 11:57:33 2024 +0200 spam const over local variables and function parameters commit 43707826d93d1f9a7a25306f76d4d78277bcbff7 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 11:31:50 2024 +0200 improve rect triangle init readability commit 2b3f4c58c44277b8ee33b8a32449b807e28928f0 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 02:08:18 2024 +0200 set ellipse rect's type to the ellipse's type commit 4872e59e16f1f1db8fc1bd504656c131d0d00be7 Merge: 336aadc 565aa4d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:29:01 2024 +0200 Merge branch 'main' into button commit 336aadc7a01a2bdd9de2555638de92ac7c393b98 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:25:13 2024 +0200 whoops forgot about this one commit 29f0d9f56a7439f8f224cc18be73d99b0b73705f Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:22:45 2024 +0200 improve component initialization compound literals zero-initialize all omitted fields including children.size, now we don't have to explicitly do that in each function commit 913286e9e70539a01d6ee5c8f1922db0785cb9fc Merge: 425e670 520b0b9 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:18:39 2024 +0200 Merge branch 'main' into button commit 425e6709b4fd07ef958fa83c7e201f6cbd284615 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:16:38 2024 +0200 initialize children size to 0 on childless components commit 70ef0e030fb63aeb9a18e003494d0f56f3e721e8 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:13:39 2024 +0200 fix vertex input attribute description commit 44204b56777fee3fb5d60f9445d52dd61a641c78 Merge: 0788992 f95c47d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:03:26 2024 +0200 Merge branch 'main' into button commit 0788992af425ec90bb0b998e6cfa99b50a938b11 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:45:13 2024 +0200 remove vk_clickable from components commit 7cc71d31771b0dd5b3a29db17693e4b2268a5ff7 Merge: 3020724 b74186b Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:44:02 2024 +0200 Merge branch 'main' into button commit 30207243196ea3692565d3414d2bf8884462aed9 Merge: 83c7968 80a8069 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:18:31 2024 +0200 Merge branch 'main' into button commit 83c7968d480a773c62d99d1c170cd2ec38f7b38d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:03:51 2024 +0200 a few component changes before separating them from shapes commit 4b1fdf8e04b3c68aeb977a84730ce3faa3061057 Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:49:52 2024 +0200 rename button to clickable in one more place commit 6aeb2124d94d502e08f857bd2010ec2bc2d55081 Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:49:39 2024 +0200 improve box creation commit af3066ab7bcd555ca355695291f80a591638acff Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:48:39 2024 +0200 add pointer versions of add and remove all in ptk list commit b95ddb45a02f49cc4e424a284249b56d9babd9ba Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:48:14 2024 +0200 rename button to clickable commit 50197a6a2158fe6e141ecdbb23a0f7212453956b Author: jacekpoz <jacekpoz@proton.me> Date: Sun Aug 11 21:09:02 2024 +0200 change default component members and add PTK_COMPONENT_DEFINE commit 2b5be4c732242461b5b20e0342f1a305a5f23aa3 Author: jacekpoz <jacekpoz@proton.me> Date: Sun Aug 11 21:07:53 2024 +0200 extract PTK_LIST_STATIC_INIT into PTK_ARRAY commit 276138043dea71d6647e6c8d38b58f6fdb6a94ee Author: jacekpoz <jacekpoz@proton.me> Date: Fri Aug 9 22:04:01 2024 +0200 make the example target not remove the binary commit c101379150352dc014e0d3b92347d7cab465ad17 Author: jacekpoz <jacekpoz@proton.me> Date: Fri Aug 9 17:16:35 2024 +0200 initial button test
2024-08-13 14:39:11 +02:00
#include <stdlib.h>
#include <ptk.h>
2024-08-14 00:09:17 +02:00
#include <ptk_color.h>
Squashed commit of the following: commit ef2fdaab863af71f7afcf23b469f4f220c538d8b Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 14:22:09 2024 +0200 improve all vector types by deunionifying them commit e9948256687a767e2e81a5c1aee2fd47942548c2 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 14:19:56 2024 +0200 use w and h for radii in ellipse intersects commit 2eb53fb8a3045c3f3b5679a278158e6efecb8e98 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:47:03 2024 +0200 add PTK_LIST_CLEAR commit a63f65067ded311192358c4aa54f207e307a8e02 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:46:29 2024 +0200 remove semicolon from filled macro commit 4ac6a1bb70833579898034b4e44486ba62d5cfa6 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:31:13 2024 +0200 ... commit 5142127ae0a73a83534561c6b3873b1cfb74ffab Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:50:08 2024 +0200 add clickable to components if encountered commit b1f31b79650ed7cb74715864b1332973382298fc Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:41:52 2024 +0200 stupid fucking switch syntax commit 8ff74e7235c34ed5a85258f568516d61a38dd416 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:40:05 2024 +0200 remove redundant vertex update commit 448e9fed146fa547293a6ce4eb36841a53e26c6f Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:10:48 2024 +0200 handle button hitboxes properly commit a4025fa924b50eb1e51676626f30da8c54a1c34a Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:04:11 2024 +0200 add more const on local variables commit c7386ddfbff8e52ad21964c021e3d22b90c1010d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:02:24 2024 +0200 fix rect triangle comments (xd) commit ca212ac65ec903ea448cb1cd8ae62b89b60fe5d3 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 11:57:33 2024 +0200 spam const over local variables and function parameters commit 43707826d93d1f9a7a25306f76d4d78277bcbff7 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 11:31:50 2024 +0200 improve rect triangle init readability commit 2b3f4c58c44277b8ee33b8a32449b807e28928f0 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 02:08:18 2024 +0200 set ellipse rect's type to the ellipse's type commit 4872e59e16f1f1db8fc1bd504656c131d0d00be7 Merge: 336aadc 565aa4d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:29:01 2024 +0200 Merge branch 'main' into button commit 336aadc7a01a2bdd9de2555638de92ac7c393b98 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:25:13 2024 +0200 whoops forgot about this one commit 29f0d9f56a7439f8f224cc18be73d99b0b73705f Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:22:45 2024 +0200 improve component initialization compound literals zero-initialize all omitted fields including children.size, now we don't have to explicitly do that in each function commit 913286e9e70539a01d6ee5c8f1922db0785cb9fc Merge: 425e670 520b0b9 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:18:39 2024 +0200 Merge branch 'main' into button commit 425e6709b4fd07ef958fa83c7e201f6cbd284615 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:16:38 2024 +0200 initialize children size to 0 on childless components commit 70ef0e030fb63aeb9a18e003494d0f56f3e721e8 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:13:39 2024 +0200 fix vertex input attribute description commit 44204b56777fee3fb5d60f9445d52dd61a641c78 Merge: 0788992 f95c47d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:03:26 2024 +0200 Merge branch 'main' into button commit 0788992af425ec90bb0b998e6cfa99b50a938b11 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:45:13 2024 +0200 remove vk_clickable from components commit 7cc71d31771b0dd5b3a29db17693e4b2268a5ff7 Merge: 3020724 b74186b Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:44:02 2024 +0200 Merge branch 'main' into button commit 30207243196ea3692565d3414d2bf8884462aed9 Merge: 83c7968 80a8069 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:18:31 2024 +0200 Merge branch 'main' into button commit 83c7968d480a773c62d99d1c170cd2ec38f7b38d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:03:51 2024 +0200 a few component changes before separating them from shapes commit 4b1fdf8e04b3c68aeb977a84730ce3faa3061057 Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:49:52 2024 +0200 rename button to clickable in one more place commit 6aeb2124d94d502e08f857bd2010ec2bc2d55081 Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:49:39 2024 +0200 improve box creation commit af3066ab7bcd555ca355695291f80a591638acff Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:48:39 2024 +0200 add pointer versions of add and remove all in ptk list commit b95ddb45a02f49cc4e424a284249b56d9babd9ba Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:48:14 2024 +0200 rename button to clickable commit 50197a6a2158fe6e141ecdbb23a0f7212453956b Author: jacekpoz <jacekpoz@proton.me> Date: Sun Aug 11 21:09:02 2024 +0200 change default component members and add PTK_COMPONENT_DEFINE commit 2b5be4c732242461b5b20e0342f1a305a5f23aa3 Author: jacekpoz <jacekpoz@proton.me> Date: Sun Aug 11 21:07:53 2024 +0200 extract PTK_LIST_STATIC_INIT into PTK_ARRAY commit 276138043dea71d6647e6c8d38b58f6fdb6a94ee Author: jacekpoz <jacekpoz@proton.me> Date: Fri Aug 9 22:04:01 2024 +0200 make the example target not remove the binary commit c101379150352dc014e0d3b92347d7cab465ad17 Author: jacekpoz <jacekpoz@proton.me> Date: Fri Aug 9 17:16:35 2024 +0200 initial button test
2024-08-13 14:39:11 +02:00
#include <ptk_log.h>
2024-08-14 00:09:17 +02:00
static const float step = 5.0f;
static float hue = 360.0f;
2024-08-13 16:58:00 +02:00
2024-09-04 19:42:59 +02:00
static void on_press(PtkClickable *self, const int button, const int mods) {
2024-08-13 16:58:00 +02:00
(void)button; (void)mods;
PTK_DEBUG("pressed!");
2024-08-14 00:09:17 +02:00
hue += step;
if (hue > 360.0f) {
hue = 0.0f;
Squashed commit of the following: commit ef2fdaab863af71f7afcf23b469f4f220c538d8b Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 14:22:09 2024 +0200 improve all vector types by deunionifying them commit e9948256687a767e2e81a5c1aee2fd47942548c2 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 14:19:56 2024 +0200 use w and h for radii in ellipse intersects commit 2eb53fb8a3045c3f3b5679a278158e6efecb8e98 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:47:03 2024 +0200 add PTK_LIST_CLEAR commit a63f65067ded311192358c4aa54f207e307a8e02 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:46:29 2024 +0200 remove semicolon from filled macro commit 4ac6a1bb70833579898034b4e44486ba62d5cfa6 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:31:13 2024 +0200 ... commit 5142127ae0a73a83534561c6b3873b1cfb74ffab Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:50:08 2024 +0200 add clickable to components if encountered commit b1f31b79650ed7cb74715864b1332973382298fc Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:41:52 2024 +0200 stupid fucking switch syntax commit 8ff74e7235c34ed5a85258f568516d61a38dd416 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:40:05 2024 +0200 remove redundant vertex update commit 448e9fed146fa547293a6ce4eb36841a53e26c6f Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:10:48 2024 +0200 handle button hitboxes properly commit a4025fa924b50eb1e51676626f30da8c54a1c34a Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:04:11 2024 +0200 add more const on local variables commit c7386ddfbff8e52ad21964c021e3d22b90c1010d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:02:24 2024 +0200 fix rect triangle comments (xd) commit ca212ac65ec903ea448cb1cd8ae62b89b60fe5d3 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 11:57:33 2024 +0200 spam const over local variables and function parameters commit 43707826d93d1f9a7a25306f76d4d78277bcbff7 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 11:31:50 2024 +0200 improve rect triangle init readability commit 2b3f4c58c44277b8ee33b8a32449b807e28928f0 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 02:08:18 2024 +0200 set ellipse rect's type to the ellipse's type commit 4872e59e16f1f1db8fc1bd504656c131d0d00be7 Merge: 336aadc 565aa4d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:29:01 2024 +0200 Merge branch 'main' into button commit 336aadc7a01a2bdd9de2555638de92ac7c393b98 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:25:13 2024 +0200 whoops forgot about this one commit 29f0d9f56a7439f8f224cc18be73d99b0b73705f Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:22:45 2024 +0200 improve component initialization compound literals zero-initialize all omitted fields including children.size, now we don't have to explicitly do that in each function commit 913286e9e70539a01d6ee5c8f1922db0785cb9fc Merge: 425e670 520b0b9 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:18:39 2024 +0200 Merge branch 'main' into button commit 425e6709b4fd07ef958fa83c7e201f6cbd284615 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:16:38 2024 +0200 initialize children size to 0 on childless components commit 70ef0e030fb63aeb9a18e003494d0f56f3e721e8 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:13:39 2024 +0200 fix vertex input attribute description commit 44204b56777fee3fb5d60f9445d52dd61a641c78 Merge: 0788992 f95c47d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:03:26 2024 +0200 Merge branch 'main' into button commit 0788992af425ec90bb0b998e6cfa99b50a938b11 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:45:13 2024 +0200 remove vk_clickable from components commit 7cc71d31771b0dd5b3a29db17693e4b2268a5ff7 Merge: 3020724 b74186b Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:44:02 2024 +0200 Merge branch 'main' into button commit 30207243196ea3692565d3414d2bf8884462aed9 Merge: 83c7968 80a8069 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:18:31 2024 +0200 Merge branch 'main' into button commit 83c7968d480a773c62d99d1c170cd2ec38f7b38d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:03:51 2024 +0200 a few component changes before separating them from shapes commit 4b1fdf8e04b3c68aeb977a84730ce3faa3061057 Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:49:52 2024 +0200 rename button to clickable in one more place commit 6aeb2124d94d502e08f857bd2010ec2bc2d55081 Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:49:39 2024 +0200 improve box creation commit af3066ab7bcd555ca355695291f80a591638acff Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:48:39 2024 +0200 add pointer versions of add and remove all in ptk list commit b95ddb45a02f49cc4e424a284249b56d9babd9ba Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:48:14 2024 +0200 rename button to clickable commit 50197a6a2158fe6e141ecdbb23a0f7212453956b Author: jacekpoz <jacekpoz@proton.me> Date: Sun Aug 11 21:09:02 2024 +0200 change default component members and add PTK_COMPONENT_DEFINE commit 2b5be4c732242461b5b20e0342f1a305a5f23aa3 Author: jacekpoz <jacekpoz@proton.me> Date: Sun Aug 11 21:07:53 2024 +0200 extract PTK_LIST_STATIC_INIT into PTK_ARRAY commit 276138043dea71d6647e6c8d38b58f6fdb6a94ee Author: jacekpoz <jacekpoz@proton.me> Date: Fri Aug 9 22:04:01 2024 +0200 make the example target not remove the binary commit c101379150352dc014e0d3b92347d7cab465ad17 Author: jacekpoz <jacekpoz@proton.me> Date: Fri Aug 9 17:16:35 2024 +0200 initial button test
2024-08-13 14:39:11 +02:00
}
2024-08-14 00:09:17 +02:00
2024-09-04 19:42:59 +02:00
PtkRect *r = (PtkRect *)self->children.data[0];
2024-08-14 00:09:17 +02:00
r->color = ptk_hsv_to_rgb((PtkHSV){ .h = hue, .s = 360.0f, .v = 360.0f });
Squashed commit of the following: commit ef2fdaab863af71f7afcf23b469f4f220c538d8b Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 14:22:09 2024 +0200 improve all vector types by deunionifying them commit e9948256687a767e2e81a5c1aee2fd47942548c2 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 14:19:56 2024 +0200 use w and h for radii in ellipse intersects commit 2eb53fb8a3045c3f3b5679a278158e6efecb8e98 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:47:03 2024 +0200 add PTK_LIST_CLEAR commit a63f65067ded311192358c4aa54f207e307a8e02 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:46:29 2024 +0200 remove semicolon from filled macro commit 4ac6a1bb70833579898034b4e44486ba62d5cfa6 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:31:13 2024 +0200 ... commit 5142127ae0a73a83534561c6b3873b1cfb74ffab Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:50:08 2024 +0200 add clickable to components if encountered commit b1f31b79650ed7cb74715864b1332973382298fc Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:41:52 2024 +0200 stupid fucking switch syntax commit 8ff74e7235c34ed5a85258f568516d61a38dd416 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:40:05 2024 +0200 remove redundant vertex update commit 448e9fed146fa547293a6ce4eb36841a53e26c6f Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:10:48 2024 +0200 handle button hitboxes properly commit a4025fa924b50eb1e51676626f30da8c54a1c34a Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:04:11 2024 +0200 add more const on local variables commit c7386ddfbff8e52ad21964c021e3d22b90c1010d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:02:24 2024 +0200 fix rect triangle comments (xd) commit ca212ac65ec903ea448cb1cd8ae62b89b60fe5d3 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 11:57:33 2024 +0200 spam const over local variables and function parameters commit 43707826d93d1f9a7a25306f76d4d78277bcbff7 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 11:31:50 2024 +0200 improve rect triangle init readability commit 2b3f4c58c44277b8ee33b8a32449b807e28928f0 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 02:08:18 2024 +0200 set ellipse rect's type to the ellipse's type commit 4872e59e16f1f1db8fc1bd504656c131d0d00be7 Merge: 336aadc 565aa4d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:29:01 2024 +0200 Merge branch 'main' into button commit 336aadc7a01a2bdd9de2555638de92ac7c393b98 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:25:13 2024 +0200 whoops forgot about this one commit 29f0d9f56a7439f8f224cc18be73d99b0b73705f Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:22:45 2024 +0200 improve component initialization compound literals zero-initialize all omitted fields including children.size, now we don't have to explicitly do that in each function commit 913286e9e70539a01d6ee5c8f1922db0785cb9fc Merge: 425e670 520b0b9 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:18:39 2024 +0200 Merge branch 'main' into button commit 425e6709b4fd07ef958fa83c7e201f6cbd284615 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:16:38 2024 +0200 initialize children size to 0 on childless components commit 70ef0e030fb63aeb9a18e003494d0f56f3e721e8 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:13:39 2024 +0200 fix vertex input attribute description commit 44204b56777fee3fb5d60f9445d52dd61a641c78 Merge: 0788992 f95c47d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:03:26 2024 +0200 Merge branch 'main' into button commit 0788992af425ec90bb0b998e6cfa99b50a938b11 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:45:13 2024 +0200 remove vk_clickable from components commit 7cc71d31771b0dd5b3a29db17693e4b2268a5ff7 Merge: 3020724 b74186b Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:44:02 2024 +0200 Merge branch 'main' into button commit 30207243196ea3692565d3414d2bf8884462aed9 Merge: 83c7968 80a8069 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:18:31 2024 +0200 Merge branch 'main' into button commit 83c7968d480a773c62d99d1c170cd2ec38f7b38d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:03:51 2024 +0200 a few component changes before separating them from shapes commit 4b1fdf8e04b3c68aeb977a84730ce3faa3061057 Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:49:52 2024 +0200 rename button to clickable in one more place commit 6aeb2124d94d502e08f857bd2010ec2bc2d55081 Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:49:39 2024 +0200 improve box creation commit af3066ab7bcd555ca355695291f80a591638acff Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:48:39 2024 +0200 add pointer versions of add and remove all in ptk list commit b95ddb45a02f49cc4e424a284249b56d9babd9ba Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:48:14 2024 +0200 rename button to clickable commit 50197a6a2158fe6e141ecdbb23a0f7212453956b Author: jacekpoz <jacekpoz@proton.me> Date: Sun Aug 11 21:09:02 2024 +0200 change default component members and add PTK_COMPONENT_DEFINE commit 2b5be4c732242461b5b20e0342f1a305a5f23aa3 Author: jacekpoz <jacekpoz@proton.me> Date: Sun Aug 11 21:07:53 2024 +0200 extract PTK_LIST_STATIC_INIT into PTK_ARRAY commit 276138043dea71d6647e6c8d38b58f6fdb6a94ee Author: jacekpoz <jacekpoz@proton.me> Date: Fri Aug 9 22:04:01 2024 +0200 make the example target not remove the binary commit c101379150352dc014e0d3b92347d7cab465ad17 Author: jacekpoz <jacekpoz@proton.me> Date: Fri Aug 9 17:16:35 2024 +0200 initial button test
2024-08-13 14:39:11 +02:00
}
int main(void) {
if (!ptk_init(800, 600, "button", (PtkVersion){ .major = 0, .minor = 1, .patch = 0 })) {
return EXIT_FAILURE;
}
return ptk_run(
2024-09-04 19:42:59 +02:00
ptk_clickable(
ptk_rect(
(PtkPos){ .x = 100.0f, .y = 100.0f },
(PtkSize){ .w = 100.0f, .h = 50.0f },
(PtkRGB){ .r = 1.0f, .g = 0.0f, .b = 0.0f }
),
on_press
)
Squashed commit of the following: commit ef2fdaab863af71f7afcf23b469f4f220c538d8b Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 14:22:09 2024 +0200 improve all vector types by deunionifying them commit e9948256687a767e2e81a5c1aee2fd47942548c2 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 14:19:56 2024 +0200 use w and h for radii in ellipse intersects commit 2eb53fb8a3045c3f3b5679a278158e6efecb8e98 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:47:03 2024 +0200 add PTK_LIST_CLEAR commit a63f65067ded311192358c4aa54f207e307a8e02 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:46:29 2024 +0200 remove semicolon from filled macro commit 4ac6a1bb70833579898034b4e44486ba62d5cfa6 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 13:31:13 2024 +0200 ... commit 5142127ae0a73a83534561c6b3873b1cfb74ffab Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:50:08 2024 +0200 add clickable to components if encountered commit b1f31b79650ed7cb74715864b1332973382298fc Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:41:52 2024 +0200 stupid fucking switch syntax commit 8ff74e7235c34ed5a85258f568516d61a38dd416 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:40:05 2024 +0200 remove redundant vertex update commit 448e9fed146fa547293a6ce4eb36841a53e26c6f Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:10:48 2024 +0200 handle button hitboxes properly commit a4025fa924b50eb1e51676626f30da8c54a1c34a Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:04:11 2024 +0200 add more const on local variables commit c7386ddfbff8e52ad21964c021e3d22b90c1010d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 12:02:24 2024 +0200 fix rect triangle comments (xd) commit ca212ac65ec903ea448cb1cd8ae62b89b60fe5d3 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 11:57:33 2024 +0200 spam const over local variables and function parameters commit 43707826d93d1f9a7a25306f76d4d78277bcbff7 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 11:31:50 2024 +0200 improve rect triangle init readability commit 2b3f4c58c44277b8ee33b8a32449b807e28928f0 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 02:08:18 2024 +0200 set ellipse rect's type to the ellipse's type commit 4872e59e16f1f1db8fc1bd504656c131d0d00be7 Merge: 336aadc 565aa4d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:29:01 2024 +0200 Merge branch 'main' into button commit 336aadc7a01a2bdd9de2555638de92ac7c393b98 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:25:13 2024 +0200 whoops forgot about this one commit 29f0d9f56a7439f8f224cc18be73d99b0b73705f Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:22:45 2024 +0200 improve component initialization compound literals zero-initialize all omitted fields including children.size, now we don't have to explicitly do that in each function commit 913286e9e70539a01d6ee5c8f1922db0785cb9fc Merge: 425e670 520b0b9 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:18:39 2024 +0200 Merge branch 'main' into button commit 425e6709b4fd07ef958fa83c7e201f6cbd284615 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:16:38 2024 +0200 initialize children size to 0 on childless components commit 70ef0e030fb63aeb9a18e003494d0f56f3e721e8 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:13:39 2024 +0200 fix vertex input attribute description commit 44204b56777fee3fb5d60f9445d52dd61a641c78 Merge: 0788992 f95c47d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 01:03:26 2024 +0200 Merge branch 'main' into button commit 0788992af425ec90bb0b998e6cfa99b50a938b11 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:45:13 2024 +0200 remove vk_clickable from components commit 7cc71d31771b0dd5b3a29db17693e4b2268a5ff7 Merge: 3020724 b74186b Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:44:02 2024 +0200 Merge branch 'main' into button commit 30207243196ea3692565d3414d2bf8884462aed9 Merge: 83c7968 80a8069 Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:18:31 2024 +0200 Merge branch 'main' into button commit 83c7968d480a773c62d99d1c170cd2ec38f7b38d Author: jacekpoz <jacekpoz@proton.me> Date: Tue Aug 13 00:03:51 2024 +0200 a few component changes before separating them from shapes commit 4b1fdf8e04b3c68aeb977a84730ce3faa3061057 Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:49:52 2024 +0200 rename button to clickable in one more place commit 6aeb2124d94d502e08f857bd2010ec2bc2d55081 Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:49:39 2024 +0200 improve box creation commit af3066ab7bcd555ca355695291f80a591638acff Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:48:39 2024 +0200 add pointer versions of add and remove all in ptk list commit b95ddb45a02f49cc4e424a284249b56d9babd9ba Author: jacekpoz <jacekpoz@proton.me> Date: Mon Aug 12 23:48:14 2024 +0200 rename button to clickable commit 50197a6a2158fe6e141ecdbb23a0f7212453956b Author: jacekpoz <jacekpoz@proton.me> Date: Sun Aug 11 21:09:02 2024 +0200 change default component members and add PTK_COMPONENT_DEFINE commit 2b5be4c732242461b5b20e0342f1a305a5f23aa3 Author: jacekpoz <jacekpoz@proton.me> Date: Sun Aug 11 21:07:53 2024 +0200 extract PTK_LIST_STATIC_INIT into PTK_ARRAY commit 276138043dea71d6647e6c8d38b58f6fdb6a94ee Author: jacekpoz <jacekpoz@proton.me> Date: Fri Aug 9 22:04:01 2024 +0200 make the example target not remove the binary commit c101379150352dc014e0d3b92347d7cab465ad17 Author: jacekpoz <jacekpoz@proton.me> Date: Fri Aug 9 17:16:35 2024 +0200 initial button test
2024-08-13 14:39:11 +02:00
);
}