SlideShare uma empresa Scribd logo
1 de 42
Baixar para ler offline
Game
Development
With Perl and SDL



       - press start -
Perl
SDL
Perl
SDL
Perl
SDL
Simple DirectMedia Layer
low level access
Video
Audio
Input Devices
cross-platform
Multimedia App


                    libSDL


DirectX   GDI    framebuffer Xlib   Quartz

                                             ...
MS Windows            Linux         OS X
LGPL v2
Round 1   . . .




 F IGH T          !
1:1 API
use   strict;
use   warnings;
use   SDL;
use   SDL::Video;
use   SDL::Surface;
use   SDL::Rect;

SDL::init(SDL_INIT_VIDEO);
my ($screen_w, $screen_h) = (800, 600);
my $screen = SDL::Video::set_video_mode(
                $screen_w,
                $screen_h,
                32,
                SDL_ANYFORMAT
);

my $blue = SDL::Video::map_RGB($screen->format(), 0, 0, 255);
SDL::Video::fill_rect(
              $screen,
              SDL::Rect->new(15, 15, 100, 100),
              $blue
);
SDL::Video::update_rect($screen, 0, 0, $screen_w, $screen_h);

sleep 5; # so we have time to see!
Too low level
Not Perlish at all!
SDLx::* Sugar
use strict;
use warnings;

use SDLx::App;

my $app = SDLx::App->new(
        width => 800,
        height => 600,
);

$app->draw_rect(
        [15, 15, 100, 100], # rect
        [0,0,255,255],      # blue
);

$app->update;

sleep 5; # so we have time to see!
The Game Loop
while ( $running ) {
    get_events();
    update_game();
    render_scene();
}
while( $running ) {
    $loops = 0;
    while(
           get_tick_count() > $next_game_tick
           && $loops < $MAX_FRAMESKIP
    ) {
        get_events();
        update_game();

        $next_game_tick += $SKIP_TICKS;
        $loops++;
    }
    $interpolation = (     get_tick_count()
                         + $SKIP_TICKS - $next_game_tick
                     )
                     / $SKIP_TICKS;

    render_scene( $interpolation );
}
SDLx::App->run;
use SDLx::App;

my $app = SDLx::App->new;

$app->add_move_handler( &update );

$app->add_event_handler( &player_1 );
$app->add_event_handler( &player_2 );

$app->add_show_handler( &scene );

$app->run;
Avenger
Avenger
sugary syntax
use Avenger title => 'My Game';

update { ... };

show { ... };

event 'key_down' => sub { ... };

event 'mouse_left' => sub { ... };

start;
Box2D
integration
use Avenger title => 'My Game';
world->gravity( 0, -100 );

my $player = world->create_dynamic( x => 30, y => 100 );
my $floor = world->create_static(
                y => 50,
                w => app->w -100 ,
                h => 10,
);

update { world->update };

show {
    app->clear( [0, 0, 0, 255] );
    app->draw_rect( $floor->rect, [0, 255, 0, 255] );
    app->draw_rect( $player->rect, [255, 50, 0, 255] );
    app->update;
};

start;
Simple games, easy.
Complex games, possible!
use Avenger;
use MyGame;

start 'MainScreen';
package MyGame::MainScreen;
use Avenger;

load { ... };

unload { ... };

update { ... };

event { ... };

show { ... };

1;
Other SDLx Goodies
my $menu = SDLx::Widget::Menu->new;

$menu->items(
    'New Game'    =>   sub   {   ...   },
    'Load Game'   =>   sub   {   ...   },
    'Options'     =>   sub   {   ...   },
    'Quit'        =>   sub   {   ...   },
);

show { $menu->render( app ) };
my $text = SDLx::Text->new(
    font    => '/path/to/my/font.ttf',
    color   => 'white',
    h_align => 'center',
    shadow => 1,
    bold    => 1,
);

$text->write_to(
   app,
   'All your base are belong to us.'
);
my $music = SDLx::Music->new;

$music->data(
   intro => {
      loops   => 3,
      fade_in => 0.5,
      volume => 72,
   },
   gameover => {
      finished => sub { print 'Done!' },
   },
);

$music->play( 'intro' );
my $sprite = SDLx::Sprite::Animated->new;

$sprite->load( 'hero.png' )->start;

show { $sprite->draw( app ) };
HUGE TODO LIST!
github.com/PerlGameDev


    #sdl   (irc.perl.org)


sdl-devel-subscribe@perl.org


           @SDLPerl
Thank You
For Playing !

  garu@cpan.org
     @garu_rj

Mais conteúdo relacionado

Mais procurados

The Ring programming language version 1.10 book - Part 132 of 212
The Ring programming language version 1.10 book - Part 132 of 212The Ring programming language version 1.10 book - Part 132 of 212
The Ring programming language version 1.10 book - Part 132 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 87 of 185
The Ring programming language version 1.5.4 book - Part 87 of 185The Ring programming language version 1.5.4 book - Part 87 of 185
The Ring programming language version 1.5.4 book - Part 87 of 185Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 130 of 210
The Ring programming language version 1.9 book - Part 130 of 210The Ring programming language version 1.9 book - Part 130 of 210
The Ring programming language version 1.9 book - Part 130 of 210Mahmoud Samir Fayed
 
libGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationlibGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationJussi Pohjolainen
 
Start to Finish: Porting to BlackBerry 10
Start to Finish: Porting to BlackBerry 10Start to Finish: Porting to BlackBerry 10
Start to Finish: Porting to BlackBerry 10ardiri
 
Getting Real With Connected Devices Presentation
Getting Real With Connected Devices PresentationGetting Real With Connected Devices Presentation
Getting Real With Connected Devices Presentationsebastienjouhans
 
Game development with Cocos2d-x Engine
Game development with Cocos2d-x EngineGame development with Cocos2d-x Engine
Game development with Cocos2d-x EngineDuy Tan Geek
 
Cocos2d-x C++ Windows 8 &Windows Phone 8
Cocos2d-x C++ Windows 8 &Windows Phone 8Cocos2d-x C++ Windows 8 &Windows Phone 8
Cocos2d-x C++ Windows 8 &Windows Phone 8Troy Miles
 

Mais procurados (13)

The Ring programming language version 1.10 book - Part 132 of 212
The Ring programming language version 1.10 book - Part 132 of 212The Ring programming language version 1.10 book - Part 132 of 212
The Ring programming language version 1.10 book - Part 132 of 212
 
libGDX: Scene2D
libGDX: Scene2DlibGDX: Scene2D
libGDX: Scene2D
 
libGDX: User Input
libGDX: User InputlibGDX: User Input
libGDX: User Input
 
The Ring programming language version 1.5.4 book - Part 87 of 185
The Ring programming language version 1.5.4 book - Part 87 of 185The Ring programming language version 1.5.4 book - Part 87 of 185
The Ring programming language version 1.5.4 book - Part 87 of 185
 
67WS Seminar Event
67WS Seminar Event67WS Seminar Event
67WS Seminar Event
 
The Ring programming language version 1.9 book - Part 130 of 210
The Ring programming language version 1.9 book - Part 130 of 210The Ring programming language version 1.9 book - Part 130 of 210
The Ring programming language version 1.9 book - Part 130 of 210
 
libGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationlibGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame Animation
 
Start to Finish: Porting to BlackBerry 10
Start to Finish: Porting to BlackBerry 10Start to Finish: Porting to BlackBerry 10
Start to Finish: Porting to BlackBerry 10
 
Getting Real With Connected Devices Presentation
Getting Real With Connected Devices PresentationGetting Real With Connected Devices Presentation
Getting Real With Connected Devices Presentation
 
Game development with Cocos2d-x Engine
Game development with Cocos2d-x EngineGame development with Cocos2d-x Engine
Game development with Cocos2d-x Engine
 
Cocos2d-x C++ Windows 8 &Windows Phone 8
Cocos2d-x C++ Windows 8 &Windows Phone 8Cocos2d-x C++ Windows 8 &Windows Phone 8
Cocos2d-x C++ Windows 8 &Windows Phone 8
 
Maker Movement
Maker MovementMaker Movement
Maker Movement
 
Flappy bird
Flappy birdFlappy bird
Flappy bird
 

Destaque

Perl Moderno, dia1
Perl Moderno, dia1Perl Moderno, dia1
Perl Moderno, dia1garux
 
C language in our world 2015
C language in our world 2015C language in our world 2015
C language in our world 2015Juraj Michálek
 
C game programming - SDL
C game programming - SDLC game programming - SDL
C game programming - SDLWingston
 
Graphics Programming in C under GNU Linux (Ubuntu distribution)
Graphics Programming in C under GNU Linux (Ubuntu distribution)Graphics Programming in C under GNU Linux (Ubuntu distribution)
Graphics Programming in C under GNU Linux (Ubuntu distribution)Tushar B Kute
 
Explorers of the Moon
Explorers of the MoonExplorers of the Moon
Explorers of the MoonLUIS NARBONA
 
Red Rachkam's Treasure
Red Rachkam's TreasureRed Rachkam's Treasure
Red Rachkam's TreasureLUIS NARBONA
 
Lianza 2 Comics For Libraries
Lianza 2 Comics For LibrariesLianza 2 Comics For Libraries
Lianza 2 Comics For LibrariesDylan Horrocks
 

Destaque (16)

Perl Moderno, dia1
Perl Moderno, dia1Perl Moderno, dia1
Perl Moderno, dia1
 
C language in our world 2015
C language in our world 2015C language in our world 2015
C language in our world 2015
 
C game programming - SDL
C game programming - SDLC game programming - SDL
C game programming - SDL
 
Graphics Programming in C under GNU Linux (Ubuntu distribution)
Graphics Programming in C under GNU Linux (Ubuntu distribution)Graphics Programming in C under GNU Linux (Ubuntu distribution)
Graphics Programming in C under GNU Linux (Ubuntu distribution)
 
White tigress 05
White tigress 05White tigress 05
White tigress 05
 
Chninkel 03
Chninkel  03Chninkel  03
Chninkel 03
 
Explorers of the Moon
Explorers of the MoonExplorers of the Moon
Explorers of the Moon
 
Chninkel 01
Chninkel  01Chninkel  01
Chninkel 01
 
03 the hypnotist
03 the hypnotist03 the hypnotist
03 the hypnotist
 
02 The W Group
02 The W Group02 The W Group
02 The W Group
 
Red Rachkam's Treasure
Red Rachkam's TreasureRed Rachkam's Treasure
Red Rachkam's Treasure
 
White tigress 03
White tigress 03White tigress 03
White tigress 03
 
White tigress 04
White tigress 04White tigress 04
White tigress 04
 
White tigress 02
White tigress 02White tigress 02
White tigress 02
 
White tigress 01
White tigress 01White tigress 01
White tigress 01
 
Lianza 2 Comics For Libraries
Lianza 2 Comics For LibrariesLianza 2 Comics For Libraries
Lianza 2 Comics For Libraries
 

Semelhante a Game Development with SDL and Perl

C++ game development with oxygine
C++ game development with oxygineC++ game development with oxygine
C++ game development with oxyginecorehard_by
 
building_games_with_ruby_rubyconf
building_games_with_ruby_rubyconfbuilding_games_with_ruby_rubyconf
building_games_with_ruby_rubyconftutorialsruby
 
building_games_with_ruby_rubyconf
building_games_with_ruby_rubyconfbuilding_games_with_ruby_rubyconf
building_games_with_ruby_rubyconftutorialsruby
 
Teaching Your Machine To Find Fraudsters
Teaching Your Machine To Find FraudstersTeaching Your Machine To Find Fraudsters
Teaching Your Machine To Find FraudstersIan Barber
 
Operation Oriented Web Applications / Yokohama pm7
Operation Oriented Web Applications / Yokohama pm7Operation Oriented Web Applications / Yokohama pm7
Operation Oriented Web Applications / Yokohama pm7Masahiro Nagano
 
R57shell
R57shellR57shell
R57shellady36
 
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011Masahiro Nagano
 
循環参照のはなし
循環参照のはなし循環参照のはなし
循環参照のはなしMasahiro Honma
 
De CRUD à DDD pas à pas
De CRUD à DDD pas à pasDe CRUD à DDD pas à pas
De CRUD à DDD pas à pasCharles Desneuf
 
Wx::Perl::Smart
Wx::Perl::SmartWx::Perl::Smart
Wx::Perl::Smartlichtkind
 
Samrt attendance system using fingerprint
Samrt attendance system using fingerprintSamrt attendance system using fingerprint
Samrt attendance system using fingerprintpraful borad
 
망고100 보드로 놀아보자 15
망고100 보드로 놀아보자 15망고100 보드로 놀아보자 15
망고100 보드로 놀아보자 15종인 전
 
Server side data sync for mobile apps with silex
Server side data sync for mobile apps with silexServer side data sync for mobile apps with silex
Server side data sync for mobile apps with silexMichele Orselli
 
Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)xSawyer
 
Drush. Secrets come out.
Drush. Secrets come out.Drush. Secrets come out.
Drush. Secrets come out.Alex S
 
Crazy things done on PHP
Crazy things done on PHPCrazy things done on PHP
Crazy things done on PHPTaras Kalapun
 

Semelhante a Game Development with SDL and Perl (20)

C++ game development with oxygine
C++ game development with oxygineC++ game development with oxygine
C++ game development with oxygine
 
building_games_with_ruby_rubyconf
building_games_with_ruby_rubyconfbuilding_games_with_ruby_rubyconf
building_games_with_ruby_rubyconf
 
building_games_with_ruby_rubyconf
building_games_with_ruby_rubyconfbuilding_games_with_ruby_rubyconf
building_games_with_ruby_rubyconf
 
Teaching Your Machine To Find Fraudsters
Teaching Your Machine To Find FraudstersTeaching Your Machine To Find Fraudsters
Teaching Your Machine To Find Fraudsters
 
distill
distilldistill
distill
 
Operation Oriented Web Applications / Yokohama pm7
Operation Oriented Web Applications / Yokohama pm7Operation Oriented Web Applications / Yokohama pm7
Operation Oriented Web Applications / Yokohama pm7
 
R57shell
R57shellR57shell
R57shell
 
画像Hacks
画像Hacks画像Hacks
画像Hacks
 
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
 
循環参照のはなし
循環参照のはなし循環参照のはなし
循環参照のはなし
 
De CRUD à DDD pas à pas
De CRUD à DDD pas à pasDe CRUD à DDD pas à pas
De CRUD à DDD pas à pas
 
Wx::Perl::Smart
Wx::Perl::SmartWx::Perl::Smart
Wx::Perl::Smart
 
Samrt attendance system using fingerprint
Samrt attendance system using fingerprintSamrt attendance system using fingerprint
Samrt attendance system using fingerprint
 
망고100 보드로 놀아보자 15
망고100 보드로 놀아보자 15망고100 보드로 놀아보자 15
망고100 보드로 놀아보자 15
 
Server side data sync for mobile apps with silex
Server side data sync for mobile apps with silexServer side data sync for mobile apps with silex
Server side data sync for mobile apps with silex
 
Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)
 
Drush. Secrets come out.
Drush. Secrets come out.Drush. Secrets come out.
Drush. Secrets come out.
 
dotCloud and go
dotCloud and godotCloud and go
dotCloud and go
 
Crazy things done on PHP
Crazy things done on PHPCrazy things done on PHP
Crazy things done on PHP
 
logic321
logic321logic321
logic321
 

Mais de garux

Introdução ao Perl 6
Introdução ao Perl 6Introdução ao Perl 6
Introdução ao Perl 6garux
 
Descobrindo a linguagem Perl
Descobrindo a linguagem PerlDescobrindo a linguagem Perl
Descobrindo a linguagem Perlgarux
 
Communities - Perl edition (RioJS)
Communities - Perl edition (RioJS)Communities - Perl edition (RioJS)
Communities - Perl edition (RioJS)garux
 
Seja um Perl Core Hacker - é (muito) mais fácil do que você pensa
Seja um Perl Core Hacker - é (muito) mais fácil do que você pensaSeja um Perl Core Hacker - é (muito) mais fácil do que você pensa
Seja um Perl Core Hacker - é (muito) mais fácil do que você pensagarux
 
Perl Moderno, dia5
Perl Moderno, dia5Perl Moderno, dia5
Perl Moderno, dia5garux
 
Perl Moderno, dia4
Perl Moderno, dia4Perl Moderno, dia4
Perl Moderno, dia4garux
 
Perl Moderno, dia3
Perl Moderno, dia3Perl Moderno, dia3
Perl Moderno, dia3garux
 
Perl Moderno, dia2
Perl Moderno, dia2Perl Moderno, dia2
Perl Moderno, dia2garux
 
Orientação a Objetos Elegante e Eficiente: Brevíssima Introdução ao Moose
Orientação a Objetos Elegante e Eficiente: Brevíssima Introdução ao MooseOrientação a Objetos Elegante e Eficiente: Brevíssima Introdução ao Moose
Orientação a Objetos Elegante e Eficiente: Brevíssima Introdução ao Moosegarux
 
Perl Quiz 2009 (YAPC::BR)
Perl Quiz 2009 (YAPC::BR)Perl Quiz 2009 (YAPC::BR)
Perl Quiz 2009 (YAPC::BR)garux
 
Jogos em Perl
Jogos em PerlJogos em Perl
Jogos em Perlgarux
 
Logging e depuração enterprise-level com Log4perl
Logging e depuração enterprise-level com Log4perlLogging e depuração enterprise-level com Log4perl
Logging e depuração enterprise-level com Log4perlgarux
 
Novidades no Perl 5.10
Novidades no Perl 5.10Novidades no Perl 5.10
Novidades no Perl 5.10garux
 
Desenvolvimento Rápido de Programas Linha de Comando
Desenvolvimento Rápido de Programas Linha de ComandoDesenvolvimento Rápido de Programas Linha de Comando
Desenvolvimento Rápido de Programas Linha de Comandogarux
 

Mais de garux (14)

Introdução ao Perl 6
Introdução ao Perl 6Introdução ao Perl 6
Introdução ao Perl 6
 
Descobrindo a linguagem Perl
Descobrindo a linguagem PerlDescobrindo a linguagem Perl
Descobrindo a linguagem Perl
 
Communities - Perl edition (RioJS)
Communities - Perl edition (RioJS)Communities - Perl edition (RioJS)
Communities - Perl edition (RioJS)
 
Seja um Perl Core Hacker - é (muito) mais fácil do que você pensa
Seja um Perl Core Hacker - é (muito) mais fácil do que você pensaSeja um Perl Core Hacker - é (muito) mais fácil do que você pensa
Seja um Perl Core Hacker - é (muito) mais fácil do que você pensa
 
Perl Moderno, dia5
Perl Moderno, dia5Perl Moderno, dia5
Perl Moderno, dia5
 
Perl Moderno, dia4
Perl Moderno, dia4Perl Moderno, dia4
Perl Moderno, dia4
 
Perl Moderno, dia3
Perl Moderno, dia3Perl Moderno, dia3
Perl Moderno, dia3
 
Perl Moderno, dia2
Perl Moderno, dia2Perl Moderno, dia2
Perl Moderno, dia2
 
Orientação a Objetos Elegante e Eficiente: Brevíssima Introdução ao Moose
Orientação a Objetos Elegante e Eficiente: Brevíssima Introdução ao MooseOrientação a Objetos Elegante e Eficiente: Brevíssima Introdução ao Moose
Orientação a Objetos Elegante e Eficiente: Brevíssima Introdução ao Moose
 
Perl Quiz 2009 (YAPC::BR)
Perl Quiz 2009 (YAPC::BR)Perl Quiz 2009 (YAPC::BR)
Perl Quiz 2009 (YAPC::BR)
 
Jogos em Perl
Jogos em PerlJogos em Perl
Jogos em Perl
 
Logging e depuração enterprise-level com Log4perl
Logging e depuração enterprise-level com Log4perlLogging e depuração enterprise-level com Log4perl
Logging e depuração enterprise-level com Log4perl
 
Novidades no Perl 5.10
Novidades no Perl 5.10Novidades no Perl 5.10
Novidades no Perl 5.10
 
Desenvolvimento Rápido de Programas Linha de Comando
Desenvolvimento Rápido de Programas Linha de ComandoDesenvolvimento Rápido de Programas Linha de Comando
Desenvolvimento Rápido de Programas Linha de Comando
 

Último

Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...
Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...
Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...First NO1 World Amil baba in Faisalabad
 
Amil Baba in Pakistan Kala jadu Expert Amil baba Black magic Specialist in Is...
Amil Baba in Pakistan Kala jadu Expert Amil baba Black magic Specialist in Is...Amil Baba in Pakistan Kala jadu Expert Amil baba Black magic Specialist in Is...
Amil Baba in Pakistan Kala jadu Expert Amil baba Black magic Specialist in Is...Amil Baba Company
 
Call Girls Near Delhi Pride Hotel New Delhi 9873777170
Call Girls Near Delhi Pride Hotel New Delhi 9873777170Call Girls Near Delhi Pride Hotel New Delhi 9873777170
Call Girls Near Delhi Pride Hotel New Delhi 9873777170Sonam Pathan
 
Call Girls Somajiguda Sarani 7001305949 all area service COD available Any Time
Call Girls Somajiguda Sarani 7001305949 all area service COD available Any TimeCall Girls Somajiguda Sarani 7001305949 all area service COD available Any Time
Call Girls Somajiguda Sarani 7001305949 all area service COD available Any Timedelhimodelshub1
 
NO1 WorldWide Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi ...
NO1 WorldWide Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi ...NO1 WorldWide Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi ...
NO1 WorldWide Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi ...Amil Baba Dawood bangali
 
Vip Delhi Ncr Call Girls Best Services Available
Vip Delhi Ncr Call Girls Best Services AvailableVip Delhi Ncr Call Girls Best Services Available
Vip Delhi Ncr Call Girls Best Services AvailableKomal Khan
 
Aesthetic Design Inspiration by Slidesgo.pptx
Aesthetic Design Inspiration by Slidesgo.pptxAesthetic Design Inspiration by Slidesgo.pptx
Aesthetic Design Inspiration by Slidesgo.pptxsayemalkadripial4
 
Call Girl Contact Number Andheri WhatsApp:+91-9833363713
Call Girl Contact Number Andheri WhatsApp:+91-9833363713Call Girl Contact Number Andheri WhatsApp:+91-9833363713
Call Girl Contact Number Andheri WhatsApp:+91-9833363713Sonam Pathan
 
原版1:1复刻卡尔加里大学毕业证UC毕业证留信学历认证
原版1:1复刻卡尔加里大学毕业证UC毕业证留信学历认证原版1:1复刻卡尔加里大学毕业证UC毕业证留信学历认证
原版1:1复刻卡尔加里大学毕业证UC毕业证留信学历认证gwhohjj
 
No,1 Amil baba Islamabad Astrologer in Karachi amil baba in pakistan amil bab...
No,1 Amil baba Islamabad Astrologer in Karachi amil baba in pakistan amil bab...No,1 Amil baba Islamabad Astrologer in Karachi amil baba in pakistan amil bab...
No,1 Amil baba Islamabad Astrologer in Karachi amil baba in pakistan amil bab...Amil Baba Company
 
VIP Call Girls In Goa 7028418221 Call Girls In Baga Beach Escorts Service
VIP Call Girls In Goa 7028418221 Call Girls In Baga Beach Escorts ServiceVIP Call Girls In Goa 7028418221 Call Girls In Baga Beach Escorts Service
VIP Call Girls In Goa 7028418221 Call Girls In Baga Beach Escorts ServiceApsara Of India
 
Call Girls Sabarmati 7397865700 Ridhima Hire Me Full Night
Call Girls Sabarmati 7397865700 Ridhima Hire Me Full NightCall Girls Sabarmati 7397865700 Ridhima Hire Me Full Night
Call Girls Sabarmati 7397865700 Ridhima Hire Me Full Nightssuser7cb4ff
 
Call Girls In Moti Bagh (8377877756 )-Genuine Rate Girls Service
Call Girls In Moti Bagh (8377877756 )-Genuine Rate Girls ServiceCall Girls In Moti Bagh (8377877756 )-Genuine Rate Girls Service
Call Girls In Moti Bagh (8377877756 )-Genuine Rate Girls Servicedollysharma2066
 
Call Girl Price Andheri WhatsApp:+91-9833363713
Call Girl Price Andheri WhatsApp:+91-9833363713Call Girl Price Andheri WhatsApp:+91-9833363713
Call Girl Price Andheri WhatsApp:+91-9833363713Sonam Pathan
 
NO1 Certified Black magic/kala jadu,manpasand shadi in lahore,karachi rawalpi...
NO1 Certified Black magic/kala jadu,manpasand shadi in lahore,karachi rawalpi...NO1 Certified Black magic/kala jadu,manpasand shadi in lahore,karachi rawalpi...
NO1 Certified Black magic/kala jadu,manpasand shadi in lahore,karachi rawalpi...Amil baba
 
North Avenue Call Girls Services, Hire Now for Full Fun
North Avenue Call Girls Services, Hire Now for Full FunNorth Avenue Call Girls Services, Hire Now for Full Fun
North Avenue Call Girls Services, Hire Now for Full FunKomal Khan
 
Call Girls Near Taurus Sarovar Portico Hotel New Delhi 9873777170
Call Girls Near Taurus Sarovar Portico Hotel New Delhi 9873777170Call Girls Near Taurus Sarovar Portico Hotel New Delhi 9873777170
Call Girls Near Taurus Sarovar Portico Hotel New Delhi 9873777170Sonam Pathan
 
8377087607 Full Enjoy @24/7 Call Girls in Patel Nagar Delhi NCR
8377087607 Full Enjoy @24/7 Call Girls in Patel Nagar Delhi NCR8377087607 Full Enjoy @24/7 Call Girls in Patel Nagar Delhi NCR
8377087607 Full Enjoy @24/7 Call Girls in Patel Nagar Delhi NCRdollysharma2066
 

Último (20)

Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...
Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...
Authentic No 1 Amil Baba In Pakistan Authentic No 1 Amil Baba In Karachi No 1...
 
Amil Baba in Pakistan Kala jadu Expert Amil baba Black magic Specialist in Is...
Amil Baba in Pakistan Kala jadu Expert Amil baba Black magic Specialist in Is...Amil Baba in Pakistan Kala jadu Expert Amil baba Black magic Specialist in Is...
Amil Baba in Pakistan Kala jadu Expert Amil baba Black magic Specialist in Is...
 
Call Girls Near Delhi Pride Hotel New Delhi 9873777170
Call Girls Near Delhi Pride Hotel New Delhi 9873777170Call Girls Near Delhi Pride Hotel New Delhi 9873777170
Call Girls Near Delhi Pride Hotel New Delhi 9873777170
 
Call Girls Somajiguda Sarani 7001305949 all area service COD available Any Time
Call Girls Somajiguda Sarani 7001305949 all area service COD available Any TimeCall Girls Somajiguda Sarani 7001305949 all area service COD available Any Time
Call Girls Somajiguda Sarani 7001305949 all area service COD available Any Time
 
NO1 WorldWide Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi ...
NO1 WorldWide Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi ...NO1 WorldWide Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi ...
NO1 WorldWide Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi ...
 
Vip Delhi Ncr Call Girls Best Services Available
Vip Delhi Ncr Call Girls Best Services AvailableVip Delhi Ncr Call Girls Best Services Available
Vip Delhi Ncr Call Girls Best Services Available
 
Aesthetic Design Inspiration by Slidesgo.pptx
Aesthetic Design Inspiration by Slidesgo.pptxAesthetic Design Inspiration by Slidesgo.pptx
Aesthetic Design Inspiration by Slidesgo.pptx
 
Call Girl Contact Number Andheri WhatsApp:+91-9833363713
Call Girl Contact Number Andheri WhatsApp:+91-9833363713Call Girl Contact Number Andheri WhatsApp:+91-9833363713
Call Girl Contact Number Andheri WhatsApp:+91-9833363713
 
原版1:1复刻卡尔加里大学毕业证UC毕业证留信学历认证
原版1:1复刻卡尔加里大学毕业证UC毕业证留信学历认证原版1:1复刻卡尔加里大学毕业证UC毕业证留信学历认证
原版1:1复刻卡尔加里大学毕业证UC毕业证留信学历认证
 
No,1 Amil baba Islamabad Astrologer in Karachi amil baba in pakistan amil bab...
No,1 Amil baba Islamabad Astrologer in Karachi amil baba in pakistan amil bab...No,1 Amil baba Islamabad Astrologer in Karachi amil baba in pakistan amil bab...
No,1 Amil baba Islamabad Astrologer in Karachi amil baba in pakistan amil bab...
 
VIP Call Girls In Goa 7028418221 Call Girls In Baga Beach Escorts Service
VIP Call Girls In Goa 7028418221 Call Girls In Baga Beach Escorts ServiceVIP Call Girls In Goa 7028418221 Call Girls In Baga Beach Escorts Service
VIP Call Girls In Goa 7028418221 Call Girls In Baga Beach Escorts Service
 
Call Girls Sabarmati 7397865700 Ridhima Hire Me Full Night
Call Girls Sabarmati 7397865700 Ridhima Hire Me Full NightCall Girls Sabarmati 7397865700 Ridhima Hire Me Full Night
Call Girls Sabarmati 7397865700 Ridhima Hire Me Full Night
 
young call girls in Hari Nagar,🔝 9953056974 🔝 escort Service
young call girls in Hari Nagar,🔝 9953056974 🔝 escort Serviceyoung call girls in Hari Nagar,🔝 9953056974 🔝 escort Service
young call girls in Hari Nagar,🔝 9953056974 🔝 escort Service
 
Call Girls In Moti Bagh (8377877756 )-Genuine Rate Girls Service
Call Girls In Moti Bagh (8377877756 )-Genuine Rate Girls ServiceCall Girls In Moti Bagh (8377877756 )-Genuine Rate Girls Service
Call Girls In Moti Bagh (8377877756 )-Genuine Rate Girls Service
 
Call Girls Koti 7001305949 all area service COD available Any Time
Call Girls Koti 7001305949 all area service COD available Any TimeCall Girls Koti 7001305949 all area service COD available Any Time
Call Girls Koti 7001305949 all area service COD available Any Time
 
Call Girl Price Andheri WhatsApp:+91-9833363713
Call Girl Price Andheri WhatsApp:+91-9833363713Call Girl Price Andheri WhatsApp:+91-9833363713
Call Girl Price Andheri WhatsApp:+91-9833363713
 
NO1 Certified Black magic/kala jadu,manpasand shadi in lahore,karachi rawalpi...
NO1 Certified Black magic/kala jadu,manpasand shadi in lahore,karachi rawalpi...NO1 Certified Black magic/kala jadu,manpasand shadi in lahore,karachi rawalpi...
NO1 Certified Black magic/kala jadu,manpasand shadi in lahore,karachi rawalpi...
 
North Avenue Call Girls Services, Hire Now for Full Fun
North Avenue Call Girls Services, Hire Now for Full FunNorth Avenue Call Girls Services, Hire Now for Full Fun
North Avenue Call Girls Services, Hire Now for Full Fun
 
Call Girls Near Taurus Sarovar Portico Hotel New Delhi 9873777170
Call Girls Near Taurus Sarovar Portico Hotel New Delhi 9873777170Call Girls Near Taurus Sarovar Portico Hotel New Delhi 9873777170
Call Girls Near Taurus Sarovar Portico Hotel New Delhi 9873777170
 
8377087607 Full Enjoy @24/7 Call Girls in Patel Nagar Delhi NCR
8377087607 Full Enjoy @24/7 Call Girls in Patel Nagar Delhi NCR8377087607 Full Enjoy @24/7 Call Girls in Patel Nagar Delhi NCR
8377087607 Full Enjoy @24/7 Call Girls in Patel Nagar Delhi NCR
 

Game Development with SDL and Perl

  • 1. Game Development With Perl and SDL - press start -
  • 11. Multimedia App libSDL DirectX GDI framebuffer Xlib Quartz ... MS Windows Linux OS X
  • 13. Round 1 . . . F IGH T !
  • 15. use strict; use warnings; use SDL; use SDL::Video; use SDL::Surface; use SDL::Rect; SDL::init(SDL_INIT_VIDEO); my ($screen_w, $screen_h) = (800, 600); my $screen = SDL::Video::set_video_mode( $screen_w, $screen_h, 32, SDL_ANYFORMAT ); my $blue = SDL::Video::map_RGB($screen->format(), 0, 0, 255); SDL::Video::fill_rect( $screen, SDL::Rect->new(15, 15, 100, 100), $blue ); SDL::Video::update_rect($screen, 0, 0, $screen_w, $screen_h); sleep 5; # so we have time to see!
  • 19. use strict; use warnings; use SDLx::App; my $app = SDLx::App->new( width => 800, height => 600, ); $app->draw_rect( [15, 15, 100, 100], # rect [0,0,255,255], # blue ); $app->update; sleep 5; # so we have time to see!
  • 21. while ( $running ) { get_events(); update_game(); render_scene(); }
  • 22. while( $running ) { $loops = 0; while( get_tick_count() > $next_game_tick && $loops < $MAX_FRAMESKIP ) { get_events(); update_game(); $next_game_tick += $SKIP_TICKS; $loops++; } $interpolation = ( get_tick_count() + $SKIP_TICKS - $next_game_tick ) / $SKIP_TICKS; render_scene( $interpolation ); }
  • 23.
  • 25. use SDLx::App; my $app = SDLx::App->new; $app->add_move_handler( &update ); $app->add_event_handler( &player_1 ); $app->add_event_handler( &player_2 ); $app->add_show_handler( &scene ); $app->run;
  • 29. use Avenger title => 'My Game'; update { ... }; show { ... }; event 'key_down' => sub { ... }; event 'mouse_left' => sub { ... }; start;
  • 31. use Avenger title => 'My Game'; world->gravity( 0, -100 ); my $player = world->create_dynamic( x => 30, y => 100 ); my $floor = world->create_static( y => 50, w => app->w -100 , h => 10, ); update { world->update }; show { app->clear( [0, 0, 0, 255] ); app->draw_rect( $floor->rect, [0, 255, 0, 255] ); app->draw_rect( $player->rect, [255, 50, 0, 255] ); app->update; }; start;
  • 32. Simple games, easy. Complex games, possible!
  • 34. package MyGame::MainScreen; use Avenger; load { ... }; unload { ... }; update { ... }; event { ... }; show { ... }; 1;
  • 36. my $menu = SDLx::Widget::Menu->new; $menu->items( 'New Game' => sub { ... }, 'Load Game' => sub { ... }, 'Options' => sub { ... }, 'Quit' => sub { ... }, ); show { $menu->render( app ) };
  • 37. my $text = SDLx::Text->new( font => '/path/to/my/font.ttf', color => 'white', h_align => 'center', shadow => 1, bold => 1, ); $text->write_to( app, 'All your base are belong to us.' );
  • 38. my $music = SDLx::Music->new; $music->data( intro => { loops => 3, fade_in => 0.5, volume => 72, }, gameover => { finished => sub { print 'Done!' }, }, ); $music->play( 'intro' );
  • 39. my $sprite = SDLx::Sprite::Animated->new; $sprite->load( 'hero.png' )->start; show { $sprite->draw( app ) };
  • 41. github.com/PerlGameDev #sdl (irc.perl.org) sdl-devel-subscribe@perl.org @SDLPerl
  • 42. Thank You For Playing ! garu@cpan.org @garu_rj