]> git.localhorst.tv Git - blank.git/blobdiff - src/app.cpp
get world seed from command line arguments
[blank.git] / src / app.cpp
index 4a890d56a61f0cdc10bf5b7a7d9b5cfc3661d256..b7e71ec681387512db2dc897a4f6063bce6f0d9a 100644 (file)
@@ -6,7 +6,7 @@
 
 namespace blank {
 
-Application::Application()
+Application::Application(unsigned int seed)
 : init_sdl()
 , init_img()
 , init_gl()
@@ -15,14 +15,23 @@ Application::Application()
 , init_glew()
 , program()
 , cam()
-, world()
+, world(seed)
 , interface(world)
+, test_controller(MakeTestEntity(world))
 , running(false) {
        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 +125,7 @@ void Application::HandleEvents() {
 
 void Application::Update(int dt) {
        interface.Update(dt);
+       test_controller.Update(dt);
        world.Update(dt);
 }