From e515240297e1d8dd6f23308f0bffcda7464486e7 Mon Sep 17 00:00:00 2001 From: physick Date: Mon, 31 Aug 2026 02:13:58 +0500 Subject: collection element callback --- src/scenes/collectionScene.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/scenes/collectionScene.c') diff --git a/src/scenes/collectionScene.c b/src/scenes/collectionScene.c index 17d36c9..fff814a 100644 --- a/src/scenes/collectionScene.c +++ b/src/scenes/collectionScene.c @@ -24,6 +24,11 @@ CollectionSceneData *getData(void *self) { return ((Scene *)self)->data; } +void collectionElement_onSelect(CollectionElement *caller) { + if (caller == NULL) return; + TraceLog(LOG_INFO, "Selected element %s", caller->name); +} + void DrawCollectionName(char *name) { Vector2 width = MeasureTextEx(*GetMainFont(), name, 50, 1); int screen_width = GetScreenWidth(); @@ -44,6 +49,11 @@ char *getCollectionName(char *path) { } bool updateCollectionScene(void *self) { + CollectionSceneData *data = getData(self); + if (data->collection != NULL) + for (size_t i = 0; i < data->collection->childCount; ++i) { + UpdateCollectionElement(&data->collection->children[i]); + } return true; } @@ -93,7 +103,7 @@ Scene *CreatePuzzleCollectionScene(char *path, CollectionElement *el) { data->DirPath = ArenaStrdup(&data->arena, path); data->Name = getCollectionName(path); - if (!el->IsInitialized) InitializeCollection(el); + if (!el->IsInitialized) InitializeCollection(el, collectionElement_onSelect); data->collection = el; outp->data = data; -- cgit v1.3