X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fapp%2FApplication.hpp;h=bae8435a0084811151300e825b9c5fec402f35d8;hb=afd253b2dd10fdf2d4655d3d4a5766e6aa8c1a2c;hp=636b82e85899c389a7f69437a001495b638ec428;hpb=7c2a8b8285278b8a3077b311d82f05ea0463a96e;p=blank.git diff --git a/src/app/Application.hpp b/src/app/Application.hpp index 636b82e..bae8435 100644 --- a/src/app/Application.hpp +++ b/src/app/Application.hpp @@ -1,33 +1,20 @@ #ifndef BLANK_APP_APPLICATION_HPP_ #define BLANK_APP_APPLICATION_HPP_ -#include "Assets.hpp" -#include "FrameCounter.hpp" -#include "init.hpp" -#include "RandomWalk.hpp" -#include "../audio/Audio.hpp" -#include "../graphics/Viewport.hpp" -#include "../ui/Interface.hpp" -#include "../world/World.hpp" - #include +#include 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; @@ -47,27 +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: - Init init; - Viewport viewport; - Assets assets; - Audio audio; - FrameCounter counter; - - World world; - Interface interface; - - RandomWalk test_controller; - - bool running; + Environment &env; + std::stack states; };