summaryrefslogtreecommitdiff
path: root/themes/main.cpp~
diff options
context:
space:
mode:
authormattkae <mattkae@protonmail.com>2022-05-01 18:37:59 -0400
committermattkae <mattkae@protonmail.com>2022-05-01 18:37:59 -0400
commitdfc387644939aada1edb69f8f730e62f116f1ae3 (patch)
treed38b17d0b21fd579f1330546394462964a08600e /themes/main.cpp~
parent1db914466663a1e4d0d827b8b9bd18840d7742eb (diff)
Fetching bunny model
Diffstat (limited to 'themes/main.cpp~')
-rw-r--r--themes/main.cpp~120
1 files changed, 0 insertions, 120 deletions
diff --git a/themes/main.cpp~ b/themes/main.cpp~
deleted file mode 100644
index 3889d97..0000000
--- a/themes/main.cpp~
+++ /dev/null
@@ -1,120 +0,0 @@
-#include "WebglContext.h"
-#include "MainLoop.h"
-#include "Renderer2d.h"
-#include "types.h"
-#include "TreeShape.h"
-
-enum Theme {
- Default = 0,
- Autumn
-};
-
-struct AutumnTheme {
- TreeShape tree;
-
- void load(Renderer2d* renderer);
- void update(float32 dtSeconds);
- void render(Renderer2d* renderer);
- voud unload();
-};
-
-void load(Theme theme);
-void unload();
-void update(float32 dtSeconds, void* userData);
-EM_BOOL selectNone(int eventType, const EmscriptenMouseEvent* mouseEvent, void* userData);
-EM_BOOL selectAutumn(int eventType, const EmscriptenMouseEvent* mouseEvent, void* userData);
-
-WebglContext context;
-Renderer2d renderer;
-MainLoop mainLoop;
-Theme activeTheme = Theme::Default;
-AutumnTheme autumnTheme;
-
-int main() {
- context.init("#theme_canvas");
- emscripten_set_click_callback("#theme_button_default", NULL, false, selectNone);
- emscripten_set_click_callback("#theme_button_autumn", NULL, false, selectAutumn);
-
- return 0;
-}
-
-// -- Scene loading, updating, and unloading logic
-void load(Theme theme) {
- if (activeTheme == theme) {
- printf("This theme is already active.\n");
- return;
- }
-
- unload(); // Try and unload before we load, so that we start fresh
-
- activeTheme = theme;
- renderer.load(&context);
- mainLoop.run(update);
-
- switch (activeTheme) {
- case Theme::Autumn:
- autumnTheme.load(renderer);
- break;
- }
-}
-
-void update(float32 dtSeconds, void* userData) {
- // -- Update
- switch (activeTheme) {
- case Theme::Autumn:
- autumnTheme.update(dtSeconds);
- break;
- }
-
- // -- Render
- renderer.render();
- switch (activeTheme) {
- case Theme::Autumn:
- autumnTheme.render();
- break;
- }
-}
-
-void unload() {
- switch (activeTheme) {
- case Theme::Autumn:
- autumnTheme.unload();
- break;
- }
-
- activeTheme = Theme::Default;
- if (mainLoop.isRunning) {
- mainLoop.stop();
- renderer.unload();
- }
-}
-
-// -- HTML5 callbacks
-EM_BOOL selectNone(int eventType, const EmscriptenMouseEvent* mouseEvent, void* userData) {
- printf("Default theme selected\n");
- unload();
- return true;
-}
-
-EM_BOOL selectAutumn(int eventType, const EmscriptenMouseEvent* mouseEvent, void* userData) {
- printf("Autumn theme selected\n");
- load(Theme::Autumn);
- return true;
-}
-
-// -- Autumn theme
-void AutumnTheme::load(Renderer2d* renderer) {
-
-}
-
-void AutumnTheme::update(float32 dtSeconds) {
-
-}
-
-void AutumnTheme::render(Renderer2d* renderer) {
-
-}
-
-voud AutumnTheme::unload() {
-
-}