X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fapp.cpp;h=a6f81f1210ecb677e0043341792ab8a0f9dba8ae;hb=d2d3cb877984b97fafb97254f5005cbf4bcf47a6;hp=4a890d56a61f0cdc10bf5b7a7d9b5cfc3661d256;hpb=c3c5045f06327db2a3c97eae77a072bc06677286;p=blank.git diff --git a/src/app.cpp b/src/app.cpp index 4a890d5..a6f81f1 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -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); }