]> git.localhorst.tv Git - blank.git/blobdiff - src/app/Application.hpp
avoid library rand()
[blank.git] / src / app / Application.hpp
index 99f0dc4fbad0b168249c20e18fc97797a19524ad..bae8435a0084811151300e825b9c5fec402f35d8 100644 (file)
@@ -1,30 +1,21 @@
 #ifndef BLANK_APP_APPLICATION_HPP_
 #define BLANK_APP_APPLICATION_HPP_
 
-#include "init.hpp"
-#include "RandomWalk.hpp"
-#include "../graphics/BlockLighting.hpp"
-#include "../graphics/Camera.hpp"
-#include "../graphics/DirectionalLighting.hpp"
-#include "../ui/Interface.hpp"
-#include "../world/World.hpp"
+#include <SDL.h>
+#include <stack>
 
 
 namespace blank {
 
+class Environment;
+class State;
+class Window;
+
 class Application {
 
 public:
-       struct Config {
-               bool vsync = true;
-               bool doublebuf = true;
-               int multisampling = 1;
-
-               Interface::Config interface = Interface::Config();
-               World::Config world = World::Config();
-       };
-
-       explicit Application(const Config &);
+       explicit Application(Environment &);
+       ~Application();
 
        Application(const Application &) = delete;
        Application &operator =(const Application &) = delete;
@@ -43,30 +34,22 @@ public:
 
        /// process all events in SDL's queue
        void HandleEvents();
+       void Handle(const SDL_Event &);
+       void Handle(const SDL_WindowEvent &);
        /// integrate to the next step with dt milliseconds passed
        void Update(int dt);
        /// push the current state to display
        void Render();
 
-       static Entity &MakeTestEntity(World &);
+       void PushState(State *);
+       State *PopState();
+       State *SwitchState(State *);
+       State &GetState();
+       bool HasState() const noexcept;
 
 private:
-       InitSDL init_sdl;
-       InitIMG init_img;
-       InitGL init_gl;
-       Window window;
-       GLContext ctx;
-       InitGLEW init_glew;
-       BlockLighting chunk_prog;
-       DirectionalLighting entity_prog;
-
-       Camera cam;
-       World world;
-       Interface interface;
-
-       RandomWalk test_controller;
-
-       bool running;
+       Environment &env;
+       std::stack<State *> states;
 
 };