diff options
| author | physick <mynameisgennadiy@vk.com> | 2026-08-31 02:13:58 +0500 |
|---|---|---|
| committer | physick <mynameisgennadiy@vk.com> | 2026-08-31 02:13:58 +0500 |
| commit | e515240297e1d8dd6f23308f0bffcda7464486e7 (patch) | |
| tree | 3f684236b27b99a8712456f844cba01503d2b360 /src/puzzles/puzzle.h | |
| parent | ce9cbb6c0dbd8c920fdb87389332028cdd60ccc1 (diff) | |
collection element callback
Diffstat (limited to 'src/puzzles/puzzle.h')
| -rw-r--r-- | src/puzzles/puzzle.h | 10 |
1 files changed, 9 insertions, 1 deletions
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 |
