Skip to content

Commit

Permalink
Actually creating a new Texture. WIP #2
Browse files Browse the repository at this point in the history
  • Loading branch information
f0rodo committed Aug 10, 2013
1 parent fc8e50f commit 895c5cc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Core/objects/Texture.xs
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ void
texture_DESTROY(bag)
SV *bag
CODE:
objDESTROY(bag, safefree);
objDESTROY(bag, SDL_DestroyTexture);
13 changes: 7 additions & 6 deletions t/106_sdl2_texture.t
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@

use Test::More tests => 2;
use SDL2pp;
use SDL2::Window;
use SDL2::Renderer;
use SDL2::Rect;
use SDL2::Texture;
use SDL2::ConfigData;

BEGIN {
use SDL2::ConfigData;

plan skip_all => 'SDL2::Texture not available' unless SDL2::ConfigData->config('mod2lib')->{'SDL2::Texture'};

}

ok( exists &SDL2::Texture::new, 'new exists');

exit 0 if SDL2pp::init(SDL_INIT_VIDEO) < 0 ; #SDL_INIT_VIDEO

my $win = SDL2::Window->new("FIRST WINDOW", 50, 50, 200, 200, SDL_WINDOW_SHOWN );

my $renderer = SDL2::Renderer->new($win, -1, SDL_RENDERER_SOFTWARE); #Hardware accelerated with software fallback


can_ok('SDL2::Texture', qw/new/);

my $texture = SDL2::Texture->new($renderer, 1, 1, 100, 100);
my $texture = SDL2::Texture->new($renderer, 0, 0, 100, 100);
fail( SDL2pp::get_error() ) unless $texture;

isa_ok($texture, 'SDL2::Texture');

done_testing();

0 comments on commit 895c5cc

Please sign in to comment.