1Module::Build::SDL(3) User Contributed Perl DocumentationModule::Build::SDL(3)
2
3
4

NAME

6       Module::Build::SDL - Module::Build subclass for building SDL apps/games
7       [not stable yet]
8

SYNOPSIS

10       When creating a new SDL application/game you can create Build.PL like
11       this:
12
13        use Module::Build::SDL;
14
15        my $builder = Module::Build::SDL->new(
16            module_name   => 'Games::Demo',
17            dist_version  => '1.00',
18            dist_abstract => 'Demo game based on Module::Build::SDL',
19            dist_author   => 'coder@cpan.org',
20            license       => 'perl',
21            requires      => {
22                'SDL'     => 0,
23            },
24            #+ others Module::Build options
25        )->create_build_script();
26
27       Once you have created a SDL application/game via Module::Build::SDL as
28       described above you can use some extra build targets/actions:
29
30       ·   you can create a PAR distribution like:
31
32            $ perl ./Build.PL
33            $ ./Build
34            $ ./Build par
35
36           There are some extra parameters related to 'par' action you can
37           pass to Module::Build::SDL->new():
38
39            parinput  => 'bin/scriptname.pl'
40            paroutput => 'filename.par.exe',
41            parlibs   => [ qw/SDL SDL_main SDL_gfx/ ],  #external libraries (.so/.dll) to be included into PAR
42            parmods   => [ qw/Module::A Module::B/ ],   #extra modules to be included into PAR
43
44       ·   to run the game from distribution directory you can use:
45
46            $ perl ./Build.PL
47            $ ./Build
48            $ ./Build run
49
50       ·   TODO: maybe some additional actions: parexe, parmsi, deb, rpm
51

DESCRIPTION

53       Module::Build::SDL is a subclass of Module::Build created to make easy
54       some tasks specific to SDL applications - e.g. packaging SDL
55       application/game into PAR archive.
56

APPLICATION/GAME LAYOUT

58       Module::Build::SDL expects the following layout in project directory:
59
60        #example: game with the main *.pl script + data files + modules (*.pm)
61        Build.PL
62        lib/
63            Games/
64                  Demo.pm
65        bin/
66            game-script.pl
67        data/
68            whatever_data_files_you_need.jpg
69
70       the most simple game should look like:
71
72        #example: simple one-script apllication/game
73        Build.PL
74        bin/
75           game-script.pl
76
77       In short - there are 3 expected subdirectories:
78
79       ·   bin - one or more perl scripts (*.pl) to start the actual
80           application/game
81
82       ·   lib - application/game specific modules (*.pm) organized in dir
83           structure in "usual perl manners"
84
85       ·   data - directory for storing application data (pictures, sounds
86           etc.). This subdirectory is handled as a "ShareDir" (see
87           File::ShareDir for more details)
88
89       ·   As the project is (or could be) composed as a standard perl
90           distribution it also support standard subdirectory 't' (with
91           tests).
92

RULES TO FOLLOW

94       When creating a SDL application/game based on Module::Build::SDL it is
95       recommended to follow these rules:
96
97       ·   Use the name for your game from Games::* namespace; it will make
98           the later release to CPAN much easier.
99
100       ·   Put all data files into data subdirectory and access the data
101           subdir only via File::ShareDir (namely by calling distdir()
102           function)
103
104       ·   TODO: maybe add more
105
106
107
108perl v5.30.1                      2020-01-30             Module::Build::SDL(3)
Impressum