X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fapp.hpp;h=e6226dc50454dff487aa8596460b68dcfdf0670a;hb=83ed3de28841d1eecfca39ff540e804cf6809b32;hp=9ec5f1f9b7de81c710aa74c9ce60247a995f86ca;hpb=b314df303ffedbd6d2e81872908d12fc9712801a;p=blank.git diff --git a/src/app.hpp b/src/app.hpp index 9ec5f1f..e6226dc 100644 --- a/src/app.hpp +++ b/src/app.hpp @@ -1,11 +1,12 @@ #ifndef BLANK_APP_HPP_ #define BLANK_APP_HPP_ -#include -#include - +#include "camera.hpp" +#include "controller.hpp" #include "init.hpp" +#include "interface.hpp" #include "shader.hpp" +#include "world.hpp" namespace blank { @@ -13,29 +14,52 @@ namespace blank { class Application { public: - Application(); - ~Application(); + 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 &); Application(const Application &) = delete; Application &operator =(const Application &) = delete; + /// run until user quits void Run(); void Loop(int dt); + /// run for n frames + void RunN(size_t n); + /// run for t milliseconds + void RunT(size_t t); + /// run for n frames, assuming t milliseconds for each + void RunS(size_t n, size_t t); + void HandleEvents(); + void Update(int dt); void Render(); + static Entity &MakeTestEntity(World &); + private: InitSDL init_sdl; + InitIMG init_img; InitGL init_gl; Window window; GLContext ctx; InitGLEW init_glew; - Program program; + BlockLighting chunk_prog; + DirectionalLighting entity_prog; + + Camera cam; + World world; + Interface interface; - GLuint vtx_buf; - glm::mat4 mvp; - GLuint mvp_handle; + RandomWalk test_controller; bool running;