mirror of https://github.com/axmolengine/axmol.git
issue #2771: fix some compile error in win32
This commit is contained in:
parent
912a9a2887
commit
a8ddca81bd
|
@ -43,7 +43,7 @@ class PhysicsJoint;
|
|||
class PhysicsBodyInfo;
|
||||
|
||||
|
||||
const PhysicsMaterial PHYSICSBODY_MATERIAL_DEFAULT = {1.0f, 1.0f, 1.0f};
|
||||
const PhysicsMaterial PHYSICSBODY_MATERIAL_DEFAULT(1.0f, 1.0f, 1.0f);
|
||||
|
||||
/**
|
||||
* A body affect by physics.
|
||||
|
|
|
@ -44,14 +44,20 @@ typedef struct PhysicsMaterial
|
|||
float restitution;
|
||||
float friction;
|
||||
|
||||
static PhysicsMaterial make(float density, float restitution, float friction)
|
||||
{
|
||||
PhysicsMaterial var = {density, restitution, friction};
|
||||
return var;
|
||||
}
|
||||
PhysicsMaterial()
|
||||
: density(0.0f)
|
||||
, restitution(0.0f)
|
||||
, friction(0.0f)
|
||||
{}
|
||||
|
||||
PhysicsMaterial(float density, float restitution, float friction)
|
||||
: density(density)
|
||||
, restitution(restitution)
|
||||
, friction(friction)
|
||||
{}
|
||||
}PhysicsMaterial;
|
||||
|
||||
const PhysicsMaterial PHYSICSSHAPE_MATERIAL_DEFAULT = {0.0f, 1.0f, 1.0f};
|
||||
const PhysicsMaterial PHYSICSSHAPE_MATERIAL_DEFAULT(0.0f, 1.0f, 1.0f);
|
||||
|
||||
/**
|
||||
* @brief A shape for body. You do not create PhysicsWorld objects directly, instead, you can view PhysicsBody to see how to create it.
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace
|
|||
return layer;
|
||||
}
|
||||
|
||||
static const Color4F STATIC_COLOR = {1.0f, 0.0f, 0.0f, 1.0f};
|
||||
static const Color4F STATIC_COLOR(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
|
||||
|
@ -411,7 +411,7 @@ void PhysicsDemoLogoSmash::onEnter()
|
|||
|
||||
Node* ball = makeBall(2*(x - logo_width/2 + x_jitter) + VisibleRect::getVisibleRect().size.width/2,
|
||||
2*(logo_height-y + y_jitter) + VisibleRect::getVisibleRect().size.height/2 - logo_height/2,
|
||||
0.95f, PhysicsMaterial::make(1.0f, 0.0f, 0.0f));
|
||||
0.95f, PhysicsMaterial(1.0f, 0.0f, 0.0f));
|
||||
|
||||
ball->getPhysicsBody()->setMass(1.0);
|
||||
ball->getPhysicsBody()->setMoment(PHYSICS_INFINITY);
|
||||
|
@ -423,7 +423,7 @@ void PhysicsDemoLogoSmash::onEnter()
|
|||
}
|
||||
|
||||
|
||||
auto bullet = makeBall(400, 0, 10, PhysicsMaterial::make(PHYSICS_INFINITY, 0, 0));
|
||||
auto bullet = makeBall(400, 0, 10, PhysicsMaterial(PHYSICS_INFINITY, 0, 0));
|
||||
bullet->getPhysicsBody()->setVelocity(Point(400, 0));
|
||||
|
||||
bullet->setPosition(Point(-1000, VisibleRect::getVisibleRect().size.height/2));
|
||||
|
@ -454,7 +454,7 @@ void PhysicsDemoPyramidStack::onEnter()
|
|||
{
|
||||
for(int j=0; j<=i; j++)
|
||||
{
|
||||
addGrossiniAtPosition(VisibleRect::bottom() + Point((i/2 - j) * 11, (14 - i) * 23 + 100), 0.2);
|
||||
addGrossiniAtPosition(VisibleRect::bottom() + Point((i/2 - j) * 11, (14 - i) * 23 + 100), 0.2f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -671,7 +671,7 @@ void PhysicsDemoRayCast::update(float delta)
|
|||
break;
|
||||
}
|
||||
|
||||
_angle += 0.25f * M_PI / 180.0f;
|
||||
_angle += 0.25f * (float)M_PI / 180.0f;
|
||||
}
|
||||
|
||||
void PhysicsDemoRayCast::onTouchesEnded(const std::vector<Touch*>& touches, Event* event)
|
||||
|
|
|
@ -37,9 +37,9 @@ public:
|
|||
void toggleDebugCallback(Object* sender);
|
||||
|
||||
void addGrossiniAtPosition(Point p, float scale = 1.0);
|
||||
Sprite* makeBall(float x, float y, float radius, PhysicsMaterial material = {1.0f, 1.0f, 1.0f});
|
||||
Sprite* makeBox(float x, float y, Size size, PhysicsMaterial material = {1.0f, 1.0f, 1.0f});
|
||||
Sprite* makeTriangle(float x, float y, Size size, PhysicsMaterial material = {1.0f, 1.0f, 1.0f});
|
||||
Sprite* makeBall(float x, float y, float radius, PhysicsMaterial material = PhysicsMaterial(1.0f, 1.0f, 1.0f));
|
||||
Sprite* makeBox(float x, float y, Size size, PhysicsMaterial material = PhysicsMaterial(1.0f, 1.0f, 1.0f));
|
||||
Sprite* makeTriangle(float x, float y, Size size, PhysicsMaterial material = PhysicsMaterial(1.0f, 1.0f, 1.0f));
|
||||
|
||||
void onTouchesBegan(const std::vector<Touch*>& touches, Event* event) override;
|
||||
void onTouchesMoved(const std::vector<Touch*>& touches, Event* event) override;
|
||||
|
|
Loading…
Reference in New Issue