X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fapp%2FApplication.hpp;h=9644794c1e7d54a9ff5bade9b0c9a0f9c155a5d5;hb=745729c1935276e6f49d108a0a465214aa93c3cb;hp=c8236ffbf27a72281364c87a69454103845a358a;hpb=b7d09e1e35ef90282c97509e0020b20db3c7ea9f;p=blank.git diff --git a/src/app/Application.hpp b/src/app/Application.hpp index c8236ff..9644794 100644 --- a/src/app/Application.hpp +++ b/src/app/Application.hpp @@ -1,17 +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 "Assets.hpp" +#include "FrameCounter.hpp" +#include "../ai/RandomWalk.hpp" +#include "../audio/Audio.hpp" +#include "../graphics/Viewport.hpp" #include "../ui/Interface.hpp" #include "../world/World.hpp" +#include + namespace blank { +class Window; + class Application { public: @@ -24,13 +28,15 @@ public: World::Config world = World::Config(); }; - explicit Application(const Config &); + Application(Window &, const Config &); + ~Application(); Application(const Application &) = delete; Application &operator =(const Application &) = delete; /// run until user quits void Run(); + /// evaluate a single frame of dt milliseconds void Loop(int dt); /// run for n frames @@ -40,23 +46,23 @@ public: /// run for n frames, assuming t milliseconds for each void RunS(size_t n, size_t t); + /// process all events in SDL's queue void HandleEvents(); + 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 &); 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; + Window &window; + Viewport viewport; + Assets assets; + Audio audio; + FrameCounter counter; + World world; Interface interface;