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/puzzles/puzzle.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/puzzles/puzzle.h') diff --git a/src/puzzles/puzzle.h b/src/puzzles/puzzle.h index cea0dba..21d8944 100644 --- a/src/puzzles/puzzle.h +++ b/src/puzzles/puzzle.h @@ -99,18 +99,26 @@ typedef enum { COLLECTION_ELEMENT_UNKNOWN } CollectionElementType; + typedef struct CollectionElement { Texture2D icon; + Rectangle _previousFramePosition; char *path; char *name; struct CollectionElement *children; + void (*callback)(struct CollectionElement *); size_t childCount; bool IsInitialized; bool hasIcon; + bool isPressed; CollectionElementType type; } CollectionElement; -void InitializeCollection(CollectionElement *el); +/// Accepts an element which children will be created and a generic callback that +/// will be called when the collection enement is selected. +/// The element passes a selected element as a callback argummment +void InitializeCollection(CollectionElement *el, void (*callback)(CollectionElement *)); void DrawCollectionElement(CollectionElement *el, CollectionElement *parent, Rectangle rec); +void UpdateCollectionElement(CollectionElement *el); #endif // PUZZLE_H -- cgit v1.3