[flatland-cvs] flatland/demo complex.cpp,1.3,1.4 demo.cpp,1.3,1.4 demo.h,1.4,1.5 platform.h,1.3,1.4
Status: Alpha
Brought to you by:
prideout
From: Philip R. <pri...@us...> - 2006-04-29 21:59:55
|
Update of /cvsroot/flatland/flatland/demo In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23272/demo Modified Files: complex.cpp demo.cpp demo.h platform.h simple.cpp Log Message: change GetObject to GetFlatlandObject Index: demo.cpp =================================================================== RCS file: /cvsroot/flatland/flatland/demo/demo.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** demo.cpp 3 Jul 2005 20:00:50 -0000 1.3 --- demo.cpp 29 Apr 2006 21:59:51 -0000 1.4 *************** *** 201,205 **** { Composite::Insert(space); ! GetObject()->Rotate(theta); } --- 201,205 ---- { Composite::Insert(space); ! GetFlatlandObject()->Rotate(theta); } *************** *** 207,211 **** { Composite::InsertFront(space); ! GetObject()->Rotate(theta); } --- 207,211 ---- { Composite::InsertFront(space); ! GetFlatlandObject()->Rotate(theta); } *************** *** 747,766 **** dJointID App::Glue(Object* a, Object* b) { ! return world.Glue(*a->GetObject(), *b->GetObject()); } dJointID App::Anchor(Object* a, Object* b, vec2 p, float mu, float erp) { ! return world.Anchor(*a->GetObject(), *b->GetObject(), p, mu, erp); } dJointID App::Anchor(Object* a, vec2 p, float mu, float erp) { ! return world.Anchor(*a->GetObject(), p, mu, erp); } dJointID App::AnchorAxis(Object* a, vec2 axis) { ! return world.AnchorAxis(*a->GetObject(), axis); } --- 747,766 ---- dJointID App::Glue(Object* a, Object* b) { ! return world.Glue(*a->GetFlatlandObject(), *b->GetFlatlandObject()); } dJointID App::Anchor(Object* a, Object* b, vec2 p, float mu, float erp) { ! return world.Anchor(*a->GetFlatlandObject(), *b->GetFlatlandObject(), p, mu, erp); } dJointID App::Anchor(Object* a, vec2 p, float mu, float erp) { ! return world.Anchor(*a->GetFlatlandObject(), p, mu, erp); } dJointID App::AnchorAxis(Object* a, vec2 axis) { ! return world.AnchorAxis(*a->GetFlatlandObject(), axis); } *************** *** 785,789 **** start = end; } ! previous->GetObject()->SetCenter(end - delta / 2); } --- 785,789 ---- start = end; } ! previous->GetFlatlandObject()->SetCenter(end - delta / 2); } *************** *** 858,866 **** { arm = new Block(center, width, height); ! arm->GetObject()->SetMass(1); AppInstance.Anchor(arm, hinge); this->hinge = new Point(hinge); ! this->hinge->GetObject()->Property().collisionMask = 0; AppInstance.Anchor(this->hinge, hinge); } --- 858,866 ---- { arm = new Block(center, width, height); ! arm->GetFlatlandObject()->SetMass(1); AppInstance.Anchor(arm, hinge); this->hinge = new Point(hinge); ! this->hinge->GetFlatlandObject()->Property().collisionMask = 0; AppInstance.Anchor(this->hinge, hinge); } *************** *** 874,878 **** void Catapult::Rotate(float theta) { ! arm->GetObject()->Rotate(theta); } --- 874,878 ---- void Catapult::Rotate(float theta) { ! arm->GetFlatlandObject()->Rotate(theta); } *************** *** 880,884 **** { const float offset = Point::Size / 2; ! Flatland::Quad& quad = static_cast<Flatland::Quad&>(arm->GetObject()->GetGeometry()); const vec2* corners = quad.GetCorners(); vec2 v = corners[2] + vec2(offset, offset); --- 880,884 ---- { const float offset = Point::Size / 2; ! Flatland::Quad& quad = static_cast<Flatland::Quad&>(arm->GetFlatlandObject()->GetGeometry()); const vec2* corners = quad.GetCorners(); vec2 v = corners[2] + vec2(offset, offset); *************** *** 892,896 **** { const float offset = Point::Size / 2; ! Flatland::Quad& quad = static_cast<Flatland::Quad&>(arm->GetObject()->GetGeometry()); const vec2* corners = quad.GetCorners(); vec2 v = corners[3] + vec2(-offset, offset); --- 892,896 ---- { const float offset = Point::Size / 2; ! Flatland::Quad& quad = static_cast<Flatland::Quad&>(arm->GetFlatlandObject()->GetGeometry()); const vec2* corners = quad.GetCorners(); vec2 v = corners[3] + vec2(-offset, offset); *************** *** 904,908 **** { const float offset = Point::Size / 2; ! Flatland::Quad& quad = static_cast<Flatland::Quad&>(arm->GetObject()->GetGeometry()); const vec2* corners = quad.GetCorners(); vec2 v = corners[1] + vec2(offset, -offset); --- 904,908 ---- { const float offset = Point::Size / 2; ! Flatland::Quad& quad = static_cast<Flatland::Quad&>(arm->GetFlatlandObject()->GetGeometry()); const vec2* corners = quad.GetCorners(); vec2 v = corners[1] + vec2(offset, -offset); *************** *** 916,920 **** { const float offset = Point::Size / 2; ! Flatland::Quad& quad = static_cast<Flatland::Quad&>(arm->GetObject()->GetGeometry()); const vec2* corners = quad.GetCorners(); vec2 v = corners[0] + vec2(-offset, -offset); --- 916,920 ---- { const float offset = Point::Size / 2; ! Flatland::Quad& quad = static_cast<Flatland::Quad&>(arm->GetFlatlandObject()->GetGeometry()); const vec2* corners = quad.GetCorners(); vec2 v = corners[0] + vec2(-offset, -offset); Index: demo.h =================================================================== RCS file: /cvsroot/flatland/flatland/demo/demo.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** demo.h 23 Apr 2006 17:23:50 -0000 1.4 --- demo.h 29 Apr 2006 21:59:51 -0000 1.5 *************** *** 60,64 **** virtual ~Object() {} virtual void Draw() const = 0; ! virtual Flatland::Object* GetObject() { return 0; } virtual void Insert(Space& space); virtual void InsertFront(Space& space); --- 60,64 ---- virtual ~Object() {} virtual void Draw() const = 0; ! virtual Flatland::Object* GetFlatlandObject() { return 0; } virtual void Insert(Space& space); virtual void InsertFront(Space& space); *************** *** 80,84 **** Block(vec2 center, float width, float height); void Draw() const; ! Flatland::Object* GetObject() { return &object; } private: Dynamic<Flatland::Block> object; --- 80,84 ---- Block(vec2 center, float width, float height); void Draw() const; ! Flatland::Object* GetFlatlandObject() { return &object; } private: Dynamic<Flatland::Block> object; *************** *** 91,95 **** Wall(float left, float top, float right, float bottom); void Draw() const; ! Flatland::Object* GetObject() { return &object; } private: Static<Flatland::Block> object; --- 91,95 ---- Wall(float left, float top, float right, float bottom); void Draw() const; ! Flatland::Object* GetFlatlandObject() { return &object; } private: Static<Flatland::Block> object; *************** *** 101,105 **** Line(vec2 a, vec2 b); void Draw() const; ! Flatland::Object* GetObject() { return &object; } private: Static<Flatland::Line> object; --- 101,105 ---- Line(vec2 a, vec2 b); void Draw() const; ! Flatland::Object* GetFlatlandObject() { return &object; } private: Static<Flatland::Line> object; *************** *** 113,117 **** vec2 Origin() const { return object.GetGeometry().Origin(); } vec2 End() const { return object.GetGeometry().End(); } ! Flatland::Object* GetObject() { return &object; } private: Dynamic<Flatland::Line> object; --- 113,117 ---- vec2 Origin() const { return object.GetGeometry().Origin(); } vec2 End() const { return object.GetGeometry().End(); } ! Flatland::Object* GetFlatlandObject() { return &object; } private: Dynamic<Flatland::Line> object; *************** *** 143,147 **** void Insert(Space& space); void Draw() const; ! Flatland::Object* GetObject() { return &object; } Line* InsertWestBorder(Space& space) const; Line* InsertEastBorder(Space& space) const; --- 143,147 ---- void Insert(Space& space); void Draw() const; ! Flatland::Object* GetFlatlandObject() { return &object; } Line* InsertWestBorder(Space& space) const; Line* InsertEastBorder(Space& space) const; *************** *** 159,163 **** Ball(vec2 center, float radius); void Draw() const; ! Flatland::Object* GetObject() { return &object; } private: Dynamic<Flatland::Circle> object; --- 159,163 ---- Ball(vec2 center, float radius); void Draw() const; ! Flatland::Object* GetFlatlandObject() { return &object; } private: Dynamic<Flatland::Circle> object; *************** *** 169,173 **** Point(vec2 center); void Draw() const; ! Flatland::Object* GetObject() { return &object; } static const float Size; private: --- 169,173 ---- Point(vec2 center); void Draw() const; ! Flatland::Object* GetFlatlandObject() { return &object; } static const float Size; private: *************** *** 181,185 **** void Draw() const; void SetTexture(Texture t) { texture = t; } ! Flatland::Object* GetObject() { return &object; } private: Dynamic<Flatland::Circle> object; --- 181,185 ---- void Draw() const; void SetTexture(Texture t) { texture = t; } ! Flatland::Object* GetFlatlandObject() { return &object; } private: Dynamic<Flatland::Circle> object; *************** *** 208,212 **** Composite(vec2 centroid); void Draw() const; ! Flatland::Object* GetObject() { return &object; } virtual void Insert(Space& space); virtual void InsertFront(Space& space); --- 208,212 ---- Composite(vec2 centroid); void Draw() const; ! Flatland::Object* GetFlatlandObject() { return &object; } virtual void Insert(Space& space); virtual void InsertFront(Space& space); Index: simple.cpp =================================================================== RCS file: /cvsroot/flatland/flatland/demo/simple.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** simple.cpp 23 Apr 2006 17:23:50 -0000 1.3 --- simple.cpp 29 Apr 2006 21:59:51 -0000 1.4 *************** *** 66,70 **** { Wheel* wheel = new Wheel(vec2(390, 550), 50); ! wheel->GetObject()->SetMass(5000); wheel->Property().outlineThickness = 1; wheel->Insert(space); --- 66,70 ---- { Wheel* wheel = new Wheel(vec2(390, 550), 50); ! wheel->GetFlatlandObject()->SetMass(5000); wheel->Property().outlineThickness = 1; wheel->Insert(space); Index: complex.cpp =================================================================== RCS file: /cvsroot/flatland/flatland/demo/complex.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** complex.cpp 3 Jul 2005 20:00:50 -0000 1.3 --- complex.cpp 29 Apr 2006 21:59:51 -0000 1.4 *************** *** 239,243 **** if (wheel) ! SetTarget(wheel->GetObject()->GetGeometry().Center() - vec2(width / 2, height * 0.75)); if (keystate[SDLK_INSERT]) --- 239,243 ---- if (wheel) ! SetTarget(wheel->GetFlatlandObject()->GetGeometry().Center() - vec2(width / 2, height * 0.75)); if (keystate[SDLK_INSERT]) *************** *** 348,352 **** void ComplexApp::boostCallback(ContactList& contacts) { ! if (contacts.Other() != app.wheel->GetObject()) return; --- 348,352 ---- void ComplexApp::boostCallback(ContactList& contacts) { ! if (contacts.Other() != app.wheel->GetFlatlandObject()) return; *************** *** 360,364 **** void ComplexApp::rope1Callback(ContactList& contacts) { ! if (contacts.Other() != app.wheel->GetObject()) return; --- 360,364 ---- void ComplexApp::rope1Callback(ContactList& contacts) { ! if (contacts.Other() != app.wheel->GetFlatlandObject()) return; *************** *** 391,395 **** void ComplexApp::cannonCallback(ContactList& contacts) { ! if (contacts.Other() != app.wheel->GetObject() || !app.cannonAnchor) return; --- 391,395 ---- void ComplexApp::cannonCallback(ContactList& contacts) { ! if (contacts.Other() != app.wheel->GetFlatlandObject() || !app.cannonAnchor) return; *************** *** 401,405 **** void ComplexApp::bubbleCallback(ContactList& contacts) { ! if (contacts.Other() != app.wheel->GetObject() || !app.bubbleAnchor) return; --- 401,405 ---- void ComplexApp::bubbleCallback(ContactList& contacts) { ! if (contacts.Other() != app.wheel->GetFlatlandObject() || !app.bubbleAnchor) return; *************** *** 407,412 **** app.bubbleAnchor = 0; ! Flatland::Object& front = *app.wheel->GetObject(); ! Flatland::Object& back = *app.wheel2->GetObject(); front.Move(); back.Move(); --- 407,412 ---- app.bubbleAnchor = 0; ! Flatland::Object& front = *app.wheel->GetFlatlandObject(); ! Flatland::Object& back = *app.wheel2->GetFlatlandObject(); front.Move(); back.Move(); *************** *** 414,425 **** vec2 end = back.GetGeometry().Center(); Beam* beam = new Beam(start, end, 2); ! beam->GetObject()->Property().collisionMask = 0; ! beam->GetObject()->SetMass(0.01); beam->Property().outlineThickness = 0; beam->Property().fillColor = Color(0.25, 0.35, 0.6, 1); beam->InsertFront(app.space); ! app.world.Anchor(*beam->GetObject(), front, start, 0, 0.01); ! app.world.Anchor(*beam->GetObject(), back, end, 0, 0.01); } --- 414,425 ---- vec2 end = back.GetGeometry().Center(); Beam* beam = new Beam(start, end, 2); ! beam->GetFlatlandObject()->Property().collisionMask = 0; ! beam->GetFlatlandObject()->SetMass(0.01); beam->Property().outlineThickness = 0; beam->Property().fillColor = Color(0.25, 0.35, 0.6, 1); beam->InsertFront(app.space); ! app.world.Anchor(*beam->GetFlatlandObject(), front, start, 0, 0.01); ! app.world.Anchor(*beam->GetFlatlandObject(), back, end, 0, 0.01); } *************** *** 427,431 **** void ComplexApp::feederCallback(ContactList& contacts) { ! if (contacts.Other() != app.wheel->GetObject() && contacts.Other() != app.wheel2->GetObject()) return; --- 427,431 ---- void ComplexApp::feederCallback(ContactList& contacts) { ! if (contacts.Other() != app.wheel->GetFlatlandObject() && contacts.Other() != app.wheel2->GetFlatlandObject()) return; *************** *** 453,460 **** wheel = new Wheel(vec2(400, 475), radius); wheel->SetTexture(wheelTexture); ! wheel->GetObject()->Property().frictionMask = 15; ! wheel->GetObject()->Property().collisionMask = ~7; wheel->Insert(space); ! motor = world.AddMotor(*wheel->GetObject()); // Create the back wheel. --- 453,460 ---- wheel = new Wheel(vec2(400, 475), radius); wheel->SetTexture(wheelTexture); ! wheel->GetFlatlandObject()->Property().frictionMask = 15; ! wheel->GetFlatlandObject()->Property().collisionMask = ~7; wheel->Insert(space); ! motor = world.AddMotor(*wheel->GetFlatlandObject()); // Create the back wheel. *************** *** 462,468 **** vec2 center(3500, 890 - carLength); wheel2 = new Wheel(center, radius); ! wheel2->GetObject()->SetMass(0.01); ! wheel2->GetObject()->Property().frictionMask = 7; ! wheel2->GetObject()->Property().collisionMask = ~7; wheel2->SetTexture(wheelTexture); wheel2->Insert(space); --- 462,468 ---- vec2 center(3500, 890 - carLength); wheel2 = new Wheel(center, radius); ! wheel2->GetFlatlandObject()->SetMass(0.01); ! wheel2->GetFlatlandObject()->Property().frictionMask = 7; ! wheel2->GetFlatlandObject()->Property().collisionMask = ~7; wheel2->SetTexture(wheelTexture); wheel2->Insert(space); *************** *** 470,476 **** bubble->Property().outlineThickness = 3; bubble->Property().fillColor = Color(1,0,0,.1); ! bubble->GetObject()->Property().collisionMask = 4; ! bubble->GetObject()->Property().friction = dInfinity; ! bubble->GetObject()->Property().callback = bubbleCallback; bubble->Insert(space); bubbleAnchor = Glue(bubble, wheel2); --- 470,476 ---- bubble->Property().outlineThickness = 3; bubble->Property().fillColor = Color(1,0,0,.1); ! bubble->GetFlatlandObject()->Property().collisionMask = 4; ! bubble->GetFlatlandObject()->Property().friction = dInfinity; ! bubble->GetFlatlandObject()->Property().callback = bubbleCallback; bubble->Insert(space); bubbleAnchor = Glue(bubble, wheel2); *************** *** 489,493 **** t->Add(vec2(2500, 400)); t->Add(vec2(4100, 400)); ! t->GetObject()->Property().friction = dInfinity; t->Insert(space); --- 489,493 ---- t->Add(vec2(2500, 400)); t->Add(vec2(4100, 400)); ! t->GetFlatlandObject()->Property().friction = dInfinity; t->Insert(space); *************** *** 508,512 **** t->Add(vec2(4000, 890)); t->Insert(space); ! t->GetObject()->Property().collisionMask = ~3; // Hang a rope between the two previous terrains. --- 508,512 ---- t->Add(vec2(4000, 890)); t->Insert(space); ! t->GetFlatlandObject()->Property().collisionMask = ~3; // Hang a rope between the two previous terrains. *************** *** 550,556 **** tether->Add(cannonball); ! tether->GetObject()->Property().callback = cannonCallback; ! tether->GetObject()->SetMass(100); ! tether->GetObject()->Property().frictionMask = 0; Anchor(tether, start); --- 550,556 ---- tether->Add(cannonball); ! tether->GetFlatlandObject()->Property().callback = cannonCallback; ! tether->GetFlatlandObject()->SetMass(100); ! tether->GetFlatlandObject()->Property().frictionMask = 0; Anchor(tether, start); *************** *** 570,575 **** c.a = 0.9; block->Property().fillColor = c; ! block->GetObject()->SetMass(40); ! block->GetObject()->Property().frictionMask = 1 + i % 2; block->Insert(space); } --- 570,575 ---- c.a = 0.9; block->Property().fillColor = c; ! block->GetFlatlandObject()->SetMass(40); ! block->GetFlatlandObject()->Property().frictionMask = 1 + i % 2; block->Insert(space); } *************** *** 588,593 **** center += vec2(90, -50); Block* b = new Block(center, 10, 10); ! b->GetObject()->SetMass(0.5); ! b->GetObject()->Property().friction = dInfinity; b->Property().fillColor = Color::PaleYellow; b->Property().outlineColor = Color::PaleYellow; --- 588,593 ---- center += vec2(90, -50); Block* b = new Block(center, 10, 10); ! b->GetFlatlandObject()->SetMass(0.5); ! b->GetFlatlandObject()->Property().friction = dInfinity; b->Property().fillColor = Color::PaleYellow; b->Property().outlineColor = Color::PaleYellow; *************** *** 596,601 **** center.x -= 14; b = new Block(center, 10, 10); ! b->GetObject()->SetMass(0.5); ! b->GetObject()->Property().friction = dInfinity; b->Property().fillColor = Color::PaleYellow; b->Property().outlineColor = Color::PaleYellow; --- 596,601 ---- center.x -= 14; b = new Block(center, 10, 10); ! b->GetFlatlandObject()->SetMass(0.5); ! b->GetFlatlandObject()->Property().friction = dInfinity; b->Property().fillColor = Color::PaleYellow; b->Property().outlineColor = Color::PaleYellow; *************** *** 620,626 **** Wheel* w = new Wheel(end, 100); w->Insert(space); ! w->GetObject()->Property().collisionMask = 0; ! Anchor(w, w->GetObject()->GetGeometry().Center()); ! blockFeeder = world.AddMotor(*w->GetObject()); Object::Default().outlineThickness = 4; --- 620,626 ---- Wheel* w = new Wheel(end, 100); w->Insert(space); ! w->GetFlatlandObject()->Property().collisionMask = 0; ! Anchor(w, w->GetFlatlandObject()->GetGeometry().Center()); ! blockFeeder = world.AddMotor(*w->GetFlatlandObject()); Object::Default().outlineThickness = 4; *************** *** 628,632 **** // Pusher Beam* pusher = new Beam(start - vec2(length, 0), start, 50); ! pusher->GetObject()->Property().collisionMask = 8; pusher->Insert(space); AnchorAxis(pusher, vec2(1, 0)); --- 628,632 ---- // Pusher Beam* pusher = new Beam(start - vec2(length, 0), start, 50); ! pusher->GetFlatlandObject()->Property().collisionMask = 8; pusher->Insert(space); AnchorAxis(pusher, vec2(1, 0)); *************** *** 636,640 **** Beam* transmission = new Beam(start, end, 20); transmission->Insert(space); ! transmission->GetObject()->Property().collisionMask = 0; Anchor(transmission, w, end); Anchor(transmission, pusher, start); --- 636,640 ---- Beam* transmission = new Beam(start, end, 20); transmission->Insert(space); ! transmission->GetFlatlandObject()->Property().collisionMask = 0; Anchor(transmission, w, end); Anchor(transmission, pusher, start); *************** *** 667,674 **** Flatland::Object::PopProperties(); ! buffer6->GetObject()->Property().callback = feederCallback; Line* l = new Line(vec2(4000, 890), vec2(4000, 1640)); ! l->GetObject()->Property().frictionMask = 2; l->Insert(space); } --- 667,674 ---- Flatland::Object::PopProperties(); ! buffer6->GetFlatlandObject()->Property().callback = feederCallback; Line* l = new Line(vec2(4000, 890), vec2(4000, 1640)); ! l->GetFlatlandObject()->Property().frictionMask = 2; l->Insert(space); } *************** *** 695,700 **** b->Property().fillColor = Color::Black; b->Insert(space); ! b->GetObject()->Property().friction = dInfinity; ! squareWheelMotor = world.AddMotor(*b->GetObject()); // West block --- 695,700 ---- b->Property().fillColor = Color::Black; b->Insert(space); ! b->GetFlatlandObject()->Property().friction = dInfinity; ! squareWheelMotor = world.AddMotor(*b->GetFlatlandObject()); // West block *************** *** 758,764 **** t->Add(vec2(4100, 0)); t->Add(vec2(5000, 0)); ! t->GetObject()->Property().friction = dInfinity; ! t->GetObject()->Property().collisionMask = ~8; ! t->GetObject()->Property().frictionMask = 4; t->Insert(space); --- 758,764 ---- t->Add(vec2(4100, 0)); t->Add(vec2(5000, 0)); ! t->GetFlatlandObject()->Property().friction = dInfinity; ! t->GetFlatlandObject()->Property().collisionMask = ~8; ! t->GetFlatlandObject()->Property().frictionMask = 4; t->Insert(space); *************** *** 774,779 **** // Speed boost Point* boost = new Point(vec2(1000 + 32, 3425 + 32)); ! boost->GetObject()->Property().callback = boostCallback; ! boost->GetObject()->Property().collisionMask = 0; boost->Insert(space); Anchor(boost, vec2(1000 + 32, 3425 + 32)); --- 774,779 ---- // Speed boost Point* boost = new Point(vec2(1000 + 32, 3425 + 32)); ! boost->GetFlatlandObject()->Property().callback = boostCallback; ! boost->GetFlatlandObject()->Property().collisionMask = 0; boost->Insert(space); Anchor(boost, vec2(1000 + 32, 3425 + 32)); Index: platform.h =================================================================== RCS file: /cvsroot/flatland/flatland/demo/platform.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** platform.h 3 Jul 2005 20:00:50 -0000 1.3 --- platform.h 29 Apr 2006 21:59:51 -0000 1.4 *************** *** 18,22 **** #include <GL/wglext.h> void fatalf(const char* format, ...); - #undef GetObject #undef min --- 18,21 ---- |