| 1 | use SDL::Video; | ||
| 2 | use SDL::Surface; | ||
| 3 | use SDL::Rect; | ||
| 4 | |||
| 5 | ### The SDL startup routine class to have a screen video surface : | ||
| 6 | ### (also from sdl.perl.org) | ||
| 7 | |||
| 8 | sub new { | ||
| 9 | |||
| 10 | ($class, $screen_width, $screen_height) = @_; | ||
| 11 | |||
| 12 | if (not defined($screen_width) and not defined($screen_height)) { | ||
| 13 | print "SDLMain : please provide a screen width and height\n"; | ||
| 14 | exit(0); | ||
| 15 | } | ||
| 16 | |||
| 17 | SDL::init(SDL_INIT_VIDEO); | ||
| 18 | |||
| 19 | # setting video mode | ||
| 20 | my $screen_surface = SDL::Video::set_video_mode($screen_width, | ||
| 21 | $screen_height, | ||
| 22 | 32, | ||
| 23 | SDL_ANYFORMAT); | ||
| 24 | $self = { screen_surface => $screen_surface, }; | ||
| 25 | |||
| 26 | bless $self, $class; | ||
| 27 | } | ||
| 28 | |||
| 29 | 1; |