Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: PerlGameDev/SDL6
base: d27302d077
...
head fork: PerlGameDev/SDL6
compare: master
Checking mergeability… Don't worry, you can still create the pull request.
  • 15 commits
  • 19 files changed
  • 0 commit comments
  • 3 contributors
Commits on Sep 18, 2012
@FROGGS FROGGS we will have Inline::C 77ab562
@FROGGS FROGGS better shebang 291713d
@FROGGS FROGGS that was still p5 code 2692743
@FROGGS FROGGS using Inline::C bf8f936
@FROGGS FROGGS requiring Inline instead of NativeCall cceae3c
Commits on Sep 25, 2012
@FROGGS FROGGS forgot to mention NativeCall++ 41c7a71
Commits on Dec 17, 2012
@kthakore kthakore Added a README 09a6558
Commits on Dec 25, 2012
@FROGGS FROGGS do not define return type
When trying to install via panda it tries to precompile the module.
At this stage it thinks the sub would return a Str, so it breaks.
Inline::C should handle this some day, but trying now without return type.
e84c81e
@FROGGS FROGGS Merge branch 'master' of github.com:PerlGameDev/SDL6 2bc5cb3
Commits on Dec 27, 2013
@tadzik tadzik Fix warnings (and bugs) 93b249e
Commits on Jan 13, 2014
@FROGGS FROGGS Merge pull request #2 from tadzik/master
Fix warnings (and bugs)
a5a0775
Commits on Jul 05, 2014
@FROGGS FROGGS remove outdated message about broken dependencies cea398a
@FROGGS FROGGS get rid of unpacking SDL_version struct by ourself
NativeCall supports this since a while very nicely, so just use it.
02722b7
@FROGGS FROGGS silence warning 310dd08
Commits on Mar 02, 2015
@FROGGS FROGGS NativeCall is now in "CORE" 021fd8c
View
2  META.info
@@ -2,6 +2,6 @@
"name" : "SDL",
"version" : "*",
"description" : "A Perl 6 wrapper around SDL 1.2",
- "depends" : [ "NativeCall" ],
+ "depends" : [ "Inline" ],
"source-url" : "git://github.com/PerlGameDev/SDL6.git"
}
View
2  README
@@ -0,0 +1,2 @@
+This module provides access to the Simple DirectMedia Layer (www.libsdl.org) to Perl6. The hope is for this
+module to be implemented in pure Perl 6.
View
20 lib/SDL.pm6
@@ -5,19 +5,11 @@ use NativeCall;
constant SDL_INIT_VIDEO = 32;
-class SDL::Version is repr('CStruct') {
- # this is a workaround, since NativeCall doesn't yet handle sized ints right
- has int8 $!version;
- method major() {
- return $!version +& 0xFF;
- }
- method minor() {
- return ($!version +& 0xFF00) +> 8;
- }
- method patch() {
- return ($!version +& 0xFF0000) +> 16;
- }
-}
+class SDL::Version is repr('CStruct') { # typedef struct {
+ has uint8 $.major; # Uint8 major;
+ has uint8 $.minor; # Uint8 minor;
+ has uint8 $.patch; # Uint8 patch;
+} # } SDL_version;
=begin pod
@@ -260,5 +252,3 @@ our sub init( int32 ) returns Int is native('libSDL') is named('SDL_strupr') {
our sub init( int32 ) returns Int is native('libSDL') is named('SDL_ulltoa') { * }
our sub init( int32 ) returns Int is native('libSDL') is named('SDL_ultoa') { * }
=end DATA
-
-1;
View
2  lib/SDL/App.pm6
@@ -13,5 +13,3 @@ class SDL::App is SDL::Surface {
}
our sub _set_video_mode( Int, Int, Int, Int ) returns OpaquePointer is native('libSDL') is symbol('SDL_SetVideoMode') { * }
-
-1;
View
11 lib/SDL/CompileTestLib.pm
@@ -1,11 +0,0 @@
-module SDL::CompileTestLib;
-
-sub compile_test_lib( $name ) is export {
- my $o = $*VM<config><o>;
- my $so = $*VM<config><load_ext>;
- my $c_line = "$*VM<config><cc> -c $*VM<config><cc_shared> $*VM<config><cc_o_out>$name$o $*VM<config><ccflags> $name.c";
- my $l_line = "$*VM<config><ld> $*VM<config><ld_load_flags> $*VM<config><ldflags> " ~
- "$*VM<config><libs> $*VM<config><ld_out>$name$so $name$o";
- shell($c_line);
- shell($l_line);
-}
View
2  lib/SDL/Controller.pm6
@@ -82,5 +82,3 @@ class SDL::Controller {
our sub _pump_events( ) returns Int is native('libSDL') is symbol('SDL_PumpEvents') { * }
our sub _delay( int32 ) is native('libSDL') is symbol('SDL_Delay') { * }
-
-1;
View
2  lib/SDL/Event.pm6
@@ -418,5 +418,3 @@ constant KMOD_META = KMOD_LMETA +| KMOD_RMETA;
# SDL::Events/repeat
constant SDL_DEFAULT_REPEAT_DELAY = 500;
constant SDL_DEFAULT_REPEAT_INTERVAL = 30;
-
-1;
View
8 lib/SDL/Mixer.pm6
@@ -15,9 +15,9 @@ our constant $MIX_DEFAULT_CHANNELS = 2;
our constant $MIX_MAX_VOLUME = 128;
our constant $MIX_CHANNEL_POST = -2;
-our constant $MIX_NO_FADING = 0,
-our constant $MIX_FADING_OUT = 1,
-our constant $MIX_FADING_IN = 2,
+our constant $MIX_NO_FADING = 0;
+our constant $MIX_FADING_OUT = 1;
+our constant $MIX_FADING_IN = 2;
our constant $MUS_NONE = 0;
our constant $MUS_CMD = 1;
@@ -31,5 +31,3 @@ our constant $MUS_MP3_FLAC = 8;
our sub open_audio( int32, int32, int32, int32 ) returns Int is native('libSDL_mixer') is symbol('Mix_OpenAudio') { * }
our sub close_audio( ) returns Int is native('libSDL_mixer') is symbol('Mix_CloseAudio') { * }
-
-1;
View
2  lib/SDL/Mixer/Channels.pm6
@@ -16,5 +16,3 @@ our sub fading( int ) returns Int is native('libSDL_mi
# wrappers (for example to support optional parameters)
# Note: dont use typed parameters here
our sub play( $channel, $sample, $loops, $time = -1 ) returns Int { _play( $channel, $sample, $loops, $time ) }
-
-1;
View
2  lib/SDL/Mixer/Effects.pm6
@@ -10,5 +10,3 @@ our sub was_init( int32 ) returns Int is native('libSDL') is symbol('SDL_Was
our sub get_ticks( ) returns Int is native('libSDL') is symbol('SDL_GetTicks') { * }
our sub delay( int32 ) is native('libSDL') is symbol('SDL_Delay') { * }
#our sub linked_version( ) returns SDL::Version is native('libSDL') is symbol('SDL_Linked_Version') { * }
-
-1;
View
2  lib/SDL/Mixer/Samples.pm6
@@ -9,5 +9,3 @@ our sub load_WAV( Str $file ) returns OpaquePointer {
}
our sub load_WAV_RW( OpaquePointer, int ) returns OpaquePointer is native('libSDL_mixer') is symbol('Mix_LoadWAV_RW') { * }
our sub rw_from_file( Str, Str ) returns OpaquePointer is native('libSDL') is symbol('SDL_RWFromFile') { * }
-
-1;
View
2  lib/SDL/Rect.pm6
@@ -21,5 +21,3 @@ class SDL::Rect {
$carr
}
}
-
-1;
View
2  lib/SDL/SFont.pm6
@@ -80,5 +80,3 @@ class SDL::SFont is SDL::Surface {
}
}
}
-
-1;
View
25 lib/SDL/Surface.pm6
@@ -1,13 +1,11 @@
module SDL::Surface;
-BEGIN my $dir = IO::Path.new($?FILE).directory;
-
use NativeCall;
use SDL::Rect;
-use SDL::CompileTestLib;
-compile_test_lib( "$dir/memcopy" ) unless "$dir/memcopy{$*VM<config><load_ext>}".IO.e;
+use soft;
+use Inline;
class SDL::Surface {
has OpaquePointer $.pointer;
@@ -227,8 +225,21 @@ our sub _fill_rect( OpaquePointer, CArray[int], int ) returns
our sub _get_clip_rect( OpaquePointer, CArray[int] ) is native('libSDL') is symbol('SDL_GetClipRect') { * }
our sub _map_rgb( OpaquePointer, int, int, int ) returns Int is native('libSDL') is symbol('SDL_MapRGB') { * }
-our sub _get_buf( OpaquePointer, CArray[int], int ) is native("$dir/memcopy") is symbol('GetBuf') { * }
-our sub _get_pointer( int ) returns OpaquePointer is native("$dir/memcopy") is symbol('GetPointer') { * }
+
+our sub _get_buf( OpaquePointer, CArray[int], int ) is inline('C') {'
+DLLEXPORT void *GetBuf( const void *from, void *to, size_t len )
+{
+ return memcpy( to, from, len );
+}
+'}
+
+our sub _get_pointer( int ) is inline('C') {'
+DLLEXPORT void *GetPointer( size_t len )
+{
+ return (void *)len;
+}
+'}
+
our sub get_buf( $pointer, $size, $debug = False ) {
my $struct = CArray[int].new();
my $bytes = ($size / 8 + 0.5).Int;
@@ -240,5 +251,3 @@ our sub get_buf( $pointer, $size, $debug = False ) {
}
return $struct;
}
-
-1;
View
2  lib/SDL/Version.pm6
@@ -10,5 +10,3 @@ module SDL::Version;
#our sub was_init( int32 ) returns Int is native('libSDL') is named('SDL_WasInit') { * }
#our sub get_ticks( ) returns Int is native('libSDL') is named('SDL_GetTicks') { * }
#our sub delay( int32 ) is native('libSDL') is named('SDL_Delay') { * }
-
-1;
View
2  lib/SDL/Video.pm6
@@ -16,5 +16,3 @@ class SDL::VideoInfo is repr('CStruct') {
}
our sub get_video_info( ) returns SDL::VideoInfo is native('libSDL') is symbol('SDL_GetVideoInfo') { * }
-
-1;
View
19 lib/SDL/memcopy.c
@@ -1,19 +0,0 @@
-#include <string.h>
-
-#ifdef WIN32
-#define DLLEXPORT __declspec(dllexport)
-#else
-#define DLLEXPORT extern
-#endif
-
-DLLEXPORT void *GetBuf( const void *from, void *to, size_t len )
-{
- return memcpy( to, from, len );
-}
-
-DLLEXPORT void *GetPointer( size_t len )
-{
- return (void *)len;
-}
-
-
View
4 t/core.t
@@ -1,4 +1,4 @@
-#!/usr/local/bin/perl6
+#!/usr/bin/env perl6
use lib 'lib';
use SDL;
@@ -10,7 +10,7 @@ is SDL::init( 1 ), 0, "SDL::init";
is SDL::was_init( 0 ), 1, "SDL::was_init";
is SDL::init_subsystem( 255 ), 0, "SDL::init_subsystem";
ok SDL::was_init( 0 ) > 1, "SDL::was_init";
-SDL::quit_subsystem( 254 ), pass "SDL::quit_subsystem";
+SDL::quit_subsystem( 254 ); pass "SDL::quit_subsystem";
is SDL::was_init( 0 ), 1, "SDL::was_init";
SDL::delay( 200 );
View
140 t/mixer.t
@@ -1,140 +0,0 @@
-#!/usr/local/bin/perl6
-
-use lib 'lib';
-use SDL::Mixer :mix_init;
-use Test;
-
-plan *;
-
-is $MIX_INIT_FLAC, 0x00000001;
-is $MIX_INIT_MOD, 0x00000002;
-is $MIX_INIT_MP3, 0x00000004;
-is $MIX_INIT_OGG, 0x00000008;
-is $MIX_CHANNELS, 8;
-is $MIX_DEFAULT_FORMAT, 32784;
-is $MIX_DEFAULT_FREQUENCY, 22050;
-is $MIX_DEFAULT_CHANNELS, 2;
-is $MIX_MAX_VOLUME, 128;
-is $MIX_CHANNEL_POST, -2;
-is $MIX_NO_FADING, 0;
-is $MIX_FADING_OUT, 1;
-is $MIX_FADING_IN, 2;
-is $MUS_NONE, 0;
-is $MUS_CMD, 1;
-is $MUS_WAV, 2;
-is $MUS_MOD, 3;
-is $MUS_MID, 4;
-is $MUS_OGG, 5;
-is $MUS_MP3, 6;
-is $MUS_MP3_MAD, 7;
-is $MUS_MP3_FLAC, 8;
-
-#use strict;
-#use warnings;
-#use SDL;
-#use SDL::Config;
-#
-#my $audiodriver;
-#
-#BEGIN {
-# use Config;
-# if ( !$Config{'useithreads'} ) {
-# print("1..0 # Skip: Perl not compiled with 'useithreads'\n");
-# exit(0);
-# }
-#
-# use Test::More;
-# use lib 't/lib';
-# use SDL::TestTool;
-#
-# $audiodriver = $ENV{SDL_AUDIODRIVER};
-# $ENV{SDL_AUDIODRIVER} = 'dummy' unless $ENV{SDL_RELEASE_TESTING};
-#
-# if ( !SDL::TestTool->init(SDL_INIT_AUDIO) ) {
-# plan( skip_all => 'Failed to init sound' );
-# } elsif ( !SDL::Config->has('SDL_mixer') ) {
-# plan( skip_all => 'SDL_mixer support not compiled' );
-# }
-#} #SDL_init(SDL_INIT_AUDIO) + Version bootstrap conflict prevention in windows
-#
-#
-## To reproduce this bug do
-##
-## use SDL; use SDL::Version; SDL::init(SDL_INIT_AUDIO);
-##
-#
-#use SDL::Mixer;
-#use SDL::Version;
-#
-#my $v = SDL::Mixer::linked_version();
-#
-#isa_ok( $v, 'SDL::Version', '[linked_version]' );
-#printf( "got version: %d.%d.%d\n", $v->major, $v->minor, $v->patch );
-#
-#is( MIX_DEFAULT_CHANNELS, 2, 'MIX_DEFAULT_CHANNELS should be imported' );
-#is( MIX_DEFAULT_CHANNELS(), 2,
-# 'MIX_DEFAULT_CHANNELS() should also be available'
-#);
-#is( MIX_DEFAULT_FORMAT, 32784, 'MIX_DEFAULT_FORMAT should be imported' );
-#is( MIX_DEFAULT_FORMAT(), 32784,
-# 'MIX_DEFAULT_FORMAT() should also be available'
-#);
-#is( MIX_DEFAULT_FREQUENCY, 22050, 'MIX_DEFAULT_FREQUENCY should be imported' );
-#is( MIX_DEFAULT_FREQUENCY(), 22050,
-# 'MIX_DEFAULT_FREQUENCY() should also be available'
-#);
-#is( MIX_FADING_IN, 2, 'MIX_FADING_IN should be imported' );
-#is( MIX_FADING_IN(), 2, 'MIX_FADING_IN() should also be available' );
-#is( MIX_FADING_OUT, 1, 'MIX_FADING_OUT should be imported' );
-#is( MIX_FADING_OUT(), 1, 'MIX_FADING_OUT() should also be available' );
-#is( MIX_MAX_VOLUME, 128, 'MIX_MAX_VOLUME should be imported' );
-#is( MIX_MAX_VOLUME(), 128, 'MIX_MAX_VOLUME() should also be available' );
-#is( MIX_NO_FADING, 0, 'MIX_NO_FADING should be imported' );
-#is( MIX_NO_FADING(), 0, 'MIX_NO_FADING() should also be available' );
-#
-#SKIP:
-#{
-# skip( 'Version 1.2.10 needed', 1 ) if $v < 1.2.10;
-# my @flags = ( MIX_INIT_MP3, MIX_INIT_MOD, MIX_INIT_FLAC, MIX_INIT_OGG );
-# my @names = qw/MP3 MOD FLAC OGG/;
-# foreach ( 0 ... 3 ) {
-# my $f = $flags[$_];
-# my $n = $names[$_];
-# ( SDL::Mixer::init($f) != $f )
-# ? print "Tried to init $n" . SDL::get_error() . "\n"
-# : print "You have $n support\n";
-# pass 'Init ran';
-# }
-#}
-#
-#is( SDL::Mixer::open_audio( 44100, SDL::Audio::AUDIO_S16SYS, 2, 4096 ),
-# 0, '[open_audio] ran'
-#);
-#
-#my $data = SDL::Mixer::query_spec();
-#
-#my ( $status, $freq, $format, $chan ) = @{$data};
-#
-#isnt( $status, 0, '[query_spec] ran' );
-#isnt( $freq, 0, '[query_spec] got frequency ' . $freq );
-#isnt( $format, 0, '[query_spec] got format ' );
-#isnt( $chan, 0, '[query_spec] got channels ' . $chan );
-#
-#SDL::Mixer::close_audio();
-#pass '[close_audio] ran';
-#
-#SKIP:
-#{
-# skip( 'Version 1.2.10 needed', 1 ) if $v < 1.2.10;
-# SDL::Mixer::quit();
-# pass '[quit] ran';
-#}
-#
-#if ($audiodriver) {
-# $ENV{SDL_AUDIODRIVER} = $audiodriver;
-#} else {
-# delete $ENV{SDL_AUDIODRIVER};
-#}
-#
-#done_testing();
-#

No commit comments for this range

Something went wrong with that request. Please try again.