On Fri, 2010-10-01 at 17:42 +0200, Rouven Raudzus wrote: > Hello, Hello Rouven,
> some time ago i contacted you for some perl sdl talk. atm i got some > time to get into sdl, i'm getting forward tho. Cool. Have a look at the SDL_Manual we are working on. http://sdlperl.ath.cx/releases/SDL_Manual.pdf We have several additions to SDLx::* now that make using SDL easier. > now i got some question. how do i most effectively blit stuff on screen? > > blitting a 320x240 px part out of a 1024x768 px image to the dest > surface with 40 fps tooks like 40% cpu on an atom 1,6ghz. isnt that too > much? If you have an SDLx::App or SDLx::Surface you can do SDLx::Surface->blit(SDLx::Surface, [x,y,w,h]); > > first i create the screen surface with SDL::Video::set_video_mode, then > i load the image with SDL::Image::load and put 320x240 px of it to > screen surface with blit_surface. then i update screen with > SDL::Video::flip. how to make it more cpu effective? > SDLx::App->new( w=> 320, h=> 240) # will make the screen. my $image = SDLx::Surface->new( image => "Image.bmp" ); #will do the image then $image->blit( $app ); Also using flags => SDL_HWSURFACE | SDL_DOUBLEBUF in SDLx::App->new( ...) will make flip() faster then update(). Also surfaces that have a size of 2^n are best for blitting. Finally using 8bpp PNG index for images are the fastest. > i'm working on a package to create graphical menus, popups, etc in perl > sdl using xml files to define them. may i help perl-sdl development by > creating modules? Absolutely! Have a look at Allegro too. It has GUI using SDL and it has a perl module (although it might be old now). > with friendly regards, > rouven raudzus Kartik Thakore -- Kartik Thakore <thakore.kar...@gmail.com>