X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fapp.hpp;h=23dcd0cef9cf7b3a21bf143f6204d5c836dc5641;hb=f90ec88e6728ce865bcf892c810a36abd90d9001;hp=d9b70469a527a98870ea279aabccdc6a3f7a4859;hpb=482114e156e91729f2529ea6bb1fe98dacdee97f;p=blank.git diff --git a/src/app.hpp b/src/app.hpp index d9b7046..23dcd0c 100644 --- a/src/app.hpp +++ b/src/app.hpp @@ -1,12 +1,10 @@ #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" @@ -16,19 +14,37 @@ 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; @@ -36,33 +52,16 @@ private: Window window; GLContext ctx; InitGLEW init_glew; - Program program; - - float move_velocity; - float pitch_sensitivity; - float yaw_sensitivity; - - BlockType testBlockType; + DirectionalLighting program; Camera cam; - Chunk chunk; + World world; + Interface interface; - glm::vec3 light_position; - glm::vec3 light_color; - float light_power; - - GLuint m_handle; - GLuint v_handle; - GLuint mv_handle; - GLuint mvp_handle; - GLuint light_position_handle; - GLuint light_color_handle; - GLuint light_power_handle; + RandomWalk test_controller; bool running; - bool front, back, left, right, up, down; - }; }