]> git.localhorst.tv Git - blank.git/blobdiff - src/app.cpp
fixed light propagation
[blank.git] / src / app.cpp
index 4a890d56a61f0cdc10bf5b7a7d9b5cfc3661d256..a6f81f1210ecb677e0043341792ab8a0f9dba8ae 100644 (file)
@@ -6,23 +6,34 @@
 
 namespace blank {
 
-Application::Application()
+Application::Application(const Config &config)
 : init_sdl()
 , init_img()
-, init_gl()
+, init_gl(config.doublebuf, config.multisampling)
 , window()
 , ctx(window.CreateContext())
 , init_glew()
 , program()
 , cam()
-, world()
-, interface(world)
+, world(config.world)
+, interface(config.interface, world)
+, test_controller(MakeTestEntity(world))
 , running(false) {
-       GLContext::EnableVSync();
+       if (config.vsync) {
+               GLContext::EnableVSync();
+       }
 
        glClearColor(0.0, 0.0, 0.0, 1.0);
 }
 
+Entity &Application::MakeTestEntity(World &world) {
+       Entity &e = world.AddEntity();
+       e.Position({ 0.0f, 0.0f, 0.0f });
+       e.SetShape(world.BlockTypes()[1]->shape, { 1.0f, 1.0f, 0.0f });
+       e.AngularVelocity(glm::quat(glm::vec3{ 0.00001f, 0.000006f, 0.000013f }));
+       return e;
+}
+
 
 void Application::RunN(size_t n) {
        Uint32 last = SDL_GetTicks();
@@ -116,6 +127,7 @@ void Application::HandleEvents() {
 
 void Application::Update(int dt) {
        interface.Update(dt);
+       test_controller.Update(dt);
        world.Update(dt);
 }