1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
|
# Copyright (C) 2001-2012, Parrot Foundation.
=head1 NAME
mines.pir - a minesweeper clone for parrot (with parrot's SDL bindings)
=head1 SYNOPSIS
To run this game, be in the Parrot directory and run the following command:
$ parrot examples/sdl/minesweeper/mines.pir
$
=head1 DESCRIPTION
This is a PIR program of a minesweeper clone for Parrot.
=head1 FUNCTIONS
=over 4
=item _main
The main function.
=cut
.sub _main :main
.param pmc args
.local pmc field
.local pmc screen
.local int debug
# the debug mode is activated if you pass in any argument
debug = args
dec debug
load_bytecode "library/SDL/App.pir"
load_bytecode "library/SDL/Event.pir"
load_bytecode "library/SDL/EventHandler.pir"
load_bytecode "library/SDL/Rect.pir"
load_bytecode "library/SDL/Surface.pir"
load_bytecode "library/SDL/Color.pir"
load_bytecode "library/SDL/Image.pir"
load_bytecode "examples/sdl/minesweeper/field.pir"
# setup the screen properties
$P0 = new 'Hash'
$P0["height"] = 480
$P0["width"] = 640
$P0["bpp"] = 32
$P0["flags"] = 5
# create the SDL object
$P0 = new ['SDL'; 'App'], $P0
screen = $P0."surface"()
# choose a "random" field
$I0 = time
# setup field properties
$P0 = new 'Hash'
$P0['width'] = 40
$P0['height'] = 28
$P0['mines'] = 0.1075
# $P0['mines'] = 0.0075
$P0['level'] = $I0
$P0['screen'] = screen
$P0['debug'] = debug
# create the field
field = new "Mines::Field", $P0
# draw the field
field.'draw'()
# runloop
$P0 = new ['SDL'; 'Event']
$P1 = new "Mines::EventHandler"
$P0."process_events"( 0.1, $P1, field )
end
.end
=back
=head1 CREDITS
The graphics were taken from KMines L<http://kmines.sf.net/> screenshots.
=head1 AUTHOR
Jens Rieks E<lt>parrot at jensbeimsurfen dot deE<gt> is the author
and maintainer.
Please send patches and suggestions to the Perl 6 Internals mailing list.
=cut
# Local Variables:
# mode: pir
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4 ft=pir:
|