src/fixture.cpp in reflexion-0.1.32 vs src/fixture.cpp in reflexion-0.1.33
- old
+ new
@@ -1,11 +1,11 @@
#include "fixture.h"
#include <assert.h>
-#include <Box2D/Dynamics/b2Fixture.h>
-#include <Box2D/Collision/Shapes/b2CircleShape.h>
+#include <box2d/b2_fixture.h>
+#include <box2d/b2_circle_shape.h>
#include "reflex/exception.h"
#include "reflex/debug.h"
#include "view.h"
#include "world.h"
#include "body.h"
@@ -25,16 +25,16 @@
b2fixture = b2body->CreateFixture(b2shape, 0);
if (!b2fixture)
system_error(__FILE__, __LINE__);
- b2fixture->SetUserData(userdata);
+ b2fixture->GetUserData().pointer = (uintptr_t) userdata;
}
Fixture::~Fixture ()
{
- b2fixture->SetUserData(NULL);
+ b2fixture->GetUserData().pointer = (uintptr_t) NULL;
b2fixture->GetBody()->DestroyFixture(b2fixture);
}
void
Fixture::set_density (float density)
@@ -100,62 +100,10 @@
Fixture::is_sensor () const
{
return b2fixture->IsSensor();
}
- void
- Fixture::set_category_bits (uint bits)
- {
- if (bits > USHRT_MAX)
- {
- argument_error(
- __FILE__, __LINE__, "category_bits must be less then USHRT_MAX.");
- }
-
- if (bits == category_bits())
- return;
-
- for (Fixture* p = this; p; p = p->pnext.get())
- {
- b2Filter f = p->b2fixture->GetFilterData();
- f.categoryBits = bits;
- p->b2fixture->SetFilterData(f);
- }
- }
-
- uint
- Fixture::category_bits () const
- {
- return b2fixture->GetFilterData().categoryBits;
- }
-
- void
- Fixture::set_collision_mask (uint mask)
- {
- if (mask > USHRT_MAX)
- {
- argument_error(
- __FILE__, __LINE__, "collision_mask must be less then USHRT_MAX.");
- }
-
- if (mask == collision_mask())
- return;
-
- for (Fixture* p = this; p; p = p->pnext.get())
- {
- b2Filter f = b2fixture->GetFilterData();
- f.maskBits = mask;
- b2fixture->SetFilterData(f);
- }
- }
-
- uint
- Fixture::collision_mask () const
- {
- return b2fixture->GetFilterData().maskBits;
- }
-
b2Fixture*
Fixture::b2ptr ()
{
return b2fixture;
}
@@ -192,15 +140,13 @@
Fixture_copy_attributes (Fixture* to, const Fixture& from)
{
if (!to)
return;
- to->set_density( from.density());
- to->set_friction( from.friction());
- to->set_restitution( from.restitution());
- to->set_sensor( from.is_sensor());
- to->set_category_bits( from.category_bits());
- to->set_collision_mask(from.collision_mask());
+ to->set_density( from.density());
+ to->set_friction( from.friction());
+ to->set_restitution(from.restitution());
+ to->set_sensor( from.is_sensor());
}
static Body*
get_temporary_body ()
{