Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Made a module ... I think

  • Loading branch information...
commit 416572bc2677800a0c1f97ade101caa8bd98fffd 1 parent eeeb191
@kthakore kthakore authored
Showing with 48 additions and 0 deletions.
  1. +7 −0 META.info
  2. +16 −0 lib/SDL.pm
  3. +25 −0 t/00-basic.t
View
7 META.info
@@ -0,0 +1,7 @@
+{
+ "name" : "SDL",
+ "version" : "2011.06",
+ "description" : "A Perl 6 NCI wrapper around SDL 1.2",
+ "depends" : [ "NativeCall", "Test", "Test::Mock" ],
+ "source-url" : "git://github.com/PerlGameDev/SDL6.git"
+}
View
16 lib/SDL.pm
@@ -0,0 +1,16 @@
+use v6;
+use NativeCall;
+
+class SDL_Surface is OpaquePointer;
+
+
+sub SDL_SetVideoMode( Int $width, Int $height, Int $bpp, Int $flags )
+
+ returns SDL_Surface
+
+ is native('libSDL') { }
+
+sub SDL_Quit()
+ is native('libSDL') { }
+
+
View
25 t/00-basic.t
@@ -0,0 +1,25 @@
+use v6;
+use Test;
+use Text::Mock;
+use SDL;
+
+plan 2;
+
+class Foo{
+ method video( Int $width, Int $height, Int $bpp, Int $flags ) { return SDL_SetVideoMode(200,200,32,0); }
+ method quit() { SDL_Quit(); }
+}
+
+my $x = mocked(Foo);
+
+my $video = $x.video(200,200,32,0);
+
+sleep(2);
+
+$x.quit();
+
+check-mock($x,
+ *.called('video', times => 1),
+ *.called('quit', times => 1),
+ );
+
Please sign in to comment.
Something went wrong with that request. Please try again.