]> git.localhorst.tv Git - gworm.git/blobdiff - src/gworm.cpp
some lousy world collision, friction, and drag
[gworm.git] / src / gworm.cpp
index efd5757324b36bcd89b8d71fe12ba6c21038f707..3f22adea95abfe73638eae6490bffcc8ca6b55c3 100644 (file)
@@ -1,11 +1,15 @@
 #include "app/Application.h"
 #include "app/SDL.h"
+#include "graphics/const.h"
 #include "graphics/Canvas.h"
 #include "graphics/Window.h"
 #include "world/Entity.h"
 #include "world/World.h"
 
+#include <iostream>
+
 using namespace gworm;
+using namespace std;
 
 
 namespace {
@@ -48,10 +52,19 @@ int main(int argc, const char *argv[]) {
        World world(Vector<int>(500, 500));
        make_planet(world, Vector<int>(250, 250), 220);
 
-       Entity e;
-       e.vel = Vector<float>(-19, 19);
-       e.mass = 1;
-       world.AddEntity(e);
+       Entity orb;
+       orb.vel = Vector<float>(-19, 19);
+       orb.mass = 1;
+       world.AddEntity(orb);
+
+       Entity coll;
+       coll.pos = Vector<float>(250, -25);
+       coll.vel = Vector<float>(-10, 0);
+       coll.mass = 2;
+       world.AddEntity(coll);
+
+       cout << "normal at top: " << world.NormalAt(Vector<float>(250, 30)) << endl;
+       cout << "normal at left: " << world.NormalAt(Vector<float>(30, 250)) << endl;
 
        Application app(canv, world);
        app.Run();