Created
February 9, 2015 14:38
-
-
Save FROGGS/239a936c29bf0873c38f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use NativeCall; | |
class b2Vec2 is repr<CStruct> { | |
has num32 $.x; | |
has num32 $.y; | |
} | |
class b2World is repr<CPPStruct> { | |
has OpaquePointer $.data; | |
method new(b2Vec2) is symbol<b2World::new> is native("libBox2D") { * } | |
method Dump() is symbol<b2World::Dump> is native("libBox2D") { * } | |
} | |
my $vec = b2Vec2.new(x => 42e0, y => 42e0); | |
my $w = b2World.new($vec); | |
$w.Dump; # that will print: | |
# b2Vec2 g(4.200000000000000e+01f, 4.200000000000000e+01f); | |
# m_world->SetGravity(g); | |
# b2Body** bodies = (b2Body**)b2Alloc(0 * sizeof(b2Body*)); | |
# b2Joint** joints = (b2Joint**)b2Alloc(0 * sizeof(b2Joint*)); | |
# b2Free(joints); | |
# b2Free(bodies); | |
# joints = NULL; | |
# bodies = NULL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment