|
@@ -18,8 +18,10 @@ package("box2d")
|
|
import("package.tools.cmake").build(package, configs, {buildir = "build"})
|
|
import("package.tools.cmake").build(package, configs, {buildir = "build"})
|
|
if package:is_plat("windows") then
|
|
if package:is_plat("windows") then
|
|
os.trycp(path.join("build", "src", "*", "*.lib"), package:installdir("lib"))
|
|
os.trycp(path.join("build", "src", "*", "*.lib"), package:installdir("lib"))
|
|
|
|
+ os.trycp(path.join("build", "bin", "*", "*.lib"), package:installdir("lib"))
|
|
else
|
|
else
|
|
os.trycp("build/src/*.a", package:installdir("lib"))
|
|
os.trycp("build/src/*.a", package:installdir("lib"))
|
|
|
|
+ os.trycp("build/bin/*.a", package:installdir("lib"))
|
|
end
|
|
end
|
|
os.cp("include", package:installdir())
|
|
os.cp("include", package:installdir())
|
|
end)
|
|
end)
|
|
@@ -28,6 +30,26 @@ package("box2d")
|
|
assert(package:check_cxxsnippets({test = [[
|
|
assert(package:check_cxxsnippets({test = [[
|
|
void test(int argc, char** argv) {
|
|
void test(int argc, char** argv) {
|
|
b2World world(b2Vec2(0.0f, -10.0f));
|
|
b2World world(b2Vec2(0.0f, -10.0f));
|
|
|
|
+ b2BodyDef bodyDef;
|
|
|
|
+ bodyDef.type = b2_dynamicBody;
|
|
|
|
+ bodyDef.position.Set(0.0f, 4.0f);
|
|
|
|
+ b2Body* body = world.CreateBody(&bodyDef);
|
|
|
|
+ b2PolygonShape dynamicBox;
|
|
|
|
+ dynamicBox.SetAsBox(1.0f, 1.0f);
|
|
|
|
+ b2FixtureDef fixtureDef;
|
|
|
|
+ fixtureDef.shape = &dynamicBox;
|
|
|
|
+ fixtureDef.density = 1.0f;
|
|
|
|
+ fixtureDef.friction = 0.3f;
|
|
|
|
+ body->CreateFixture(&fixtureDef);
|
|
|
|
+ float timeStep = 1.0f / 60.0f;
|
|
|
|
+ int32 velocityIterations = 6;
|
|
|
|
+ int32 positionIterations = 2;
|
|
|
|
+ for (int32 i = 0; i < 60; ++i)
|
|
|
|
+ {
|
|
|
|
+ world.Step(timeStep, velocityIterations, positionIterations);
|
|
|
|
+ b2Vec2 position = body->GetPosition();
|
|
|
|
+ float angle = body->GetAngle();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
]]}, {configs = {languages = "c++11"}, includes = "box2d/box2d.h"}))
|
|
]]}, {configs = {languages = "c++11"}, includes = "box2d/box2d.h"}))
|
|
end)
|
|
end)
|