diff options
| author | Physick <96335032+DegustatorPonos@users.noreply.github.com> | 2026-07-07 15:24:11 +0500 |
|---|---|---|
| committer | Physick <96335032+DegustatorPonos@users.noreply.github.com> | 2026-07-07 15:24:11 +0500 |
| commit | ed2a75816a34aee3026cb07c85fb3be11decbf4d (patch) | |
| tree | 47bf13dc6eab7576794de67bad92547bcdb66e3a /src | |
| parent | 5d010fb632964dcf1191f548a07eb1a0dcb83c41 (diff) | |
simple scene logic + raygui import
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.c | 6 | ||||
| -rw-r--r-- | src/scenes/mainMenu.c | 9 | ||||
| -rw-r--r-- | src/scenes/sceneManager.c | 14 | ||||
| -rw-r--r-- | src/scenes/scenes.h | 17 |
4 files changed, 45 insertions, 1 deletions
@@ -1,5 +1,8 @@ #include <stdio.h> #include <raylib.h> +#include "scenes/scenes.h" + +enum SCENE current_scene = MAIN_MENU; int main(void) { printf("Hello, world!\n"); @@ -9,7 +12,8 @@ int main(void) { SetTargetFPS(60); while (!WindowShouldClose()) { BeginDrawing(); - ClearBackground(RED); + UpdateScene(current_scene); + DrawScene(current_scene); EndDrawing(); } diff --git a/src/scenes/mainMenu.c b/src/scenes/mainMenu.c new file mode 100644 index 0000000..07ba34d --- /dev/null +++ b/src/scenes/mainMenu.c @@ -0,0 +1,9 @@ +#include <raylib.h> + +void MainMenuUpdate() { +} + +void MainMenuDraw() { + ClearBackground(SKYBLUE); + DrawText("MAIN MENU", 10, 10, 30, BLACK); +} diff --git a/src/scenes/sceneManager.c b/src/scenes/sceneManager.c new file mode 100644 index 0000000..4d42ed9 --- /dev/null +++ b/src/scenes/sceneManager.c @@ -0,0 +1,14 @@ +#include "scenes.h" + +void UpdateScene(enum SCENE scene) { + switch (scene) { + case MAIN_MENU: MainMenuUpdate(); + } +} + +void DrawScene(enum SCENE scene) { + switch (scene) { + case MAIN_MENU: MainMenuDraw(); + } +} + diff --git a/src/scenes/scenes.h b/src/scenes/scenes.h new file mode 100644 index 0000000..88295e6 --- /dev/null +++ b/src/scenes/scenes.h @@ -0,0 +1,17 @@ +#ifndef SCENES_H +#define SCENES_H + +/// The scene that the action should be executed upon +enum SCENE { + MAIN_MENU, +}; + +void DrawScene(enum SCENE scene); +void UpdateScene(enum SCENE scene); + + +// ========== MAIN MENU ========== +void MainMenuUpdate(); +void MainMenuDraw(); + +#endif // SCENES_H |
