summaryrefslogtreecommitdiff
path: root/src/scenes
diff options
context:
space:
mode:
authorPhysick <96335032+DegustatorPonos@users.noreply.github.com>2026-07-07 19:05:45 +0500
committerPhysick <96335032+DegustatorPonos@users.noreply.github.com>2026-07-07 19:05:45 +0500
commit1a095735b1d8e7ade61ac4f936032e0c9dcc044f (patch)
treed4b61b54b170cf47e88381095baedb03eb26433d /src/scenes
parentde52d82dc62db5d6883cf870a2c3cdc08a178b4f (diff)
Resources loading
Diffstat (limited to 'src/scenes')
-rw-r--r--src/scenes/puzzleScene.c46
-rw-r--r--src/scenes/scenes.h2
2 files changed, 48 insertions, 0 deletions
diff --git a/src/scenes/puzzleScene.c b/src/scenes/puzzleScene.c
new file mode 100644
index 0000000..10e3fc9
--- /dev/null
+++ b/src/scenes/puzzleScene.c
@@ -0,0 +1,46 @@
+#include <raylib.h>
+#include <stdlib.h>
+#include "scenes.h"
+#include "../resources/resources.h"
+
+typedef struct {
+ Puzzle *PuzzlePtr;
+} puzzleSceneData;
+
+
+bool updatePuzzleScene(void *self) {
+ return true;
+}
+
+Vector2 PuzzleNamePos = { .x = 0, .y = 0 };
+
+bool drawPuzzleScene(void *self) {
+ puzzleSceneData *data = ((Scene *)self)->data;
+ ClearBackground(SKYBLUE);
+
+ DrawTextEx(*GetMainFont(),
+ data->PuzzlePtr->Name,
+ PuzzleNamePos,
+ 100, 1, BLACK);
+
+ return true;
+}
+
+void deinitPuzzleScene(void *self) {
+ TraceLog(LOG_INFO, "Deleting a puzzle scene");
+ free((puzzleSceneData *)((Scene *)self)->data);
+ free((Scene *)self);
+}
+
+Scene *CreatePuzzleScene(Puzzle *puzzle) {
+ Scene *outp = malloc(sizeof(Scene));
+ outp->Update = updatePuzzleScene;
+ outp->Draw = drawPuzzleScene;
+ outp->Deint = deinitPuzzleScene;
+
+ puzzleSceneData *data = malloc(sizeof(puzzleSceneData));
+ data->PuzzlePtr = puzzle;
+
+ outp->data = data;
+ return outp;
+}
diff --git a/src/scenes/scenes.h b/src/scenes/scenes.h
index 7ad34af..22d9a41 100644
--- a/src/scenes/scenes.h
+++ b/src/scenes/scenes.h
@@ -1,4 +1,5 @@
#include <stdbool.h>
+#include "../puzzles/puzzle.h"
#ifndef SCENES_H
#define SCENES_H
@@ -26,5 +27,6 @@ bool DrawScene();
bool UpdateScene();
Scene *CreateMainMenu();
+Scene *CreatePuzzleScene(Puzzle *puzzle);
#endif // SCENES_H