Successfully reported this slideshow.

Jogos em Perl

1

Share

Loading in …3
×
1 of 29
1 of 29

More Related Content

Related Books

Free with a 14 day trial from Scribd

See all

Related Audiobooks

Free with a 14 day trial from Scribd

See all

Jogos em Perl

  1. 1. SDL Perl Breno G. de Oliveira garu@cpan.org
  2. 2. SDL Perl?
  3. 3. SDL?
  4. 4. Simple DirectMedia Layer
  5. 5. SDL ● Interface para dispositivos... ... gráficos ... de audio ... de entrada ● Multiplataforma ● FOSS
  6. 6. Usado nas versões Linux de:
  7. 7. Unreal Tournament
  8. 8. Soldier of Fortune Descent³ Unreal Tournament Civilization: Call to Power Doom 3
  9. 9. Soldier of Fortune Sim City 3000 Quake 4 Shadowgrounds Descent³ Unreal Tournament Civilization: Call to Power Heretic II Myth II Sid Meier's Alpha Centauri Doom 3 Heroes of Might and Magic III FreeSpace 2
  10. 10. Enemy Territory: Quake Wars Rune: Halls of Valhalla Soldier of Fortune Sim City 3000 Majesty: The Fantasy Kingdom Sim Quake 4 Simutrans Shadowgrounds Descent³ Unreal Tournament Heavy Metal: F.A.K.K.² Shadowgrounds: Survivor Civilization: Call to Power Heretic II Myth II Rune Sid Meier's Alpha Centauri Doom 3 Heroes of Might and Magic III FreeSpace 2 Shogo: Mobile Armor Division
  11. 11. Usado em:
  12. 12. Usado em:
  13. 13. Usado em:
  14. 14. Usado em:
  15. 15. Usado em:
  16. 16. Arquitetura Aplicativo Multimídia Biblioteca SDL (libSDL) DirectX GDI framebuffer Xlib Quartz etc. Windows Linux OS X etc.
  17. 17. SDL Perl ● Perl bindings para SDL ● API 1:1 com a libSDL (SDL::*) ● API açucarada (SDLx::*)
  18. 18. Instalação cpan> install SDL
  19. 19. Está vivo! use SDLx::App; SDLx::App­>new­>run;
  20. 20. Um pouco mais de controle use SDLx::App; my $app = SDLx::App­>new(     title  => 'meu jogo',     width  => 200,     height => 100, ); $app­>run;
  21. 21. Um pouco mais de controle
  22. 22. Manipulando Eventos #1 use SDL::Event; sub on_event {     my $event = shift;     if ($event­>type == SDL_QUIT) {         return 0;     }     return 1; } $app­>add_event_handler( &on_event );
  23. 23. Game Loop Eventos Atualizações Exibição
  24. 24. Exibindo... algo :) use SDL::Rect; my $rect = SDL::Rect­>new(10,10,10,10); $app­>add_show_handler( sub {     $app­>draw_rect([0,0,$app­>w,$app­>h],0xFFFFFFFF);     $app­>draw_rect($rect, 0xFF0000FF);     $app­>update; });
  25. 25. Manipulando Eventos #2 sub on_event {   my $event = shift;   if ($event­>type == SDL_QUIT) {     return 0;   }   return 1; }
  26. 26. Manipulando Eventos #2 sub on_event {   my $event = shift;   if ($event­>type == SDL_QUIT) {     return 0;   }   elsif ($event­>type == SDL_KEYDOWN) {     given ($event­>key_sym) {       when (SDLK_LEFT ) { $rect­>x( $rect­>x ­ 2 ) };       when (SDLK_RIGHT) { $rect­>x( $rect­>x + 2 ) };       when (SDLK_UP   ) { $rect­>y( $rect­>y ­ 2 ) };       when (SDLK_DOWN ) { $rect­>y( $rect­>y + 2 ) };     };   }   return 1; }
  27. 27. Exemplos! ● Spinner ● Scroller ● Solitaire ● Zumbis
  28. 28. +Goodies ● SDLx::Sprite ● SDLx::Sprite::Animated ● SDLx::Controller::Interface ● SDLx::Layers ● SDLx::Widgets::* ● "Jogo"
  29. 29. Mais informações #sdl em irc.perl.org sdl.perl.org http://github.com/PerlGameDev/

×