summaryrefslogtreecommitdiff
path: root/src/scenes
diff options
context:
space:
mode:
Diffstat (limited to 'src/scenes')
-rw-r--r--src/scenes/collectionScene.c12
1 files changed, 11 insertions, 1 deletions
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;