Skip to content

Instantly share code, notes, and snippets.

@FROGGS

FROGGS/is-rw.p6 Secret

Created March 10, 2015 10:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FROGGS/2148e2b9f241e106963a to your computer and use it in GitHub Desktop.
Save FROGGS/2148e2b9f241e106963a to your computer and use it in GitHub Desktop.
class Box2D::Vec2 is repr<CStruct> {
has num32 $.x;
has num32 $.y;
multi method new(Num(Numeric) $x, Num(Numeric) $y = 0e0) {
my $self = nqp::create(Box2D::Vec2);
nqp::bindattr_n(nqp::decont($self), Box2D::Vec2, '$!x', nqp::unbox_n($x));
nqp::bindattr_n(nqp::decont($self), Box2D::Vec2, '$!y', nqp::unbox_n($y));
$self
}
}
class Box2D::Vec2 is repr<CStruct> {
has num32 $.x is rw;
has num32 $.y is rw;
multi method new(Num(Numeric) $x, Num(Numeric) $y = 0e0) {
self.bless( :$x, :$y )
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment