in reply to SDL and Cairo segfault
The segmentation fault was happening because the video mode wasn't being set right, and you were missing SDL::Rect. Here's a script that works for me:
If that works, then you can add whatever you need to add. If you run into problems, post another question. Good luck.#!/usr/bin/perl use strict; no warnings; use SDL; use SDL::Video; use SDL::Surface; use SDL::Rect; use constant WIDTH => 400; use constant HEIGHT => 300; SDL::init( SDL_INIT_VIDEO ); my $screen = SDL::Video::set_video_mode( WIDTH, HEIGHT, 32, SDL_SWSURFACE ); my $mcolor = SDL::Video::map_RGB($screen->format(), 255, 0, 0); SDL::Video::fill_rect($screen, SDL::Rect->new( WIDTH / 4, HEIGHT / 4, WIDTH / 2, HEIGHT / 2), $mcolor); SDL::Video::update_rect( $screen, 0, 0, WIDTH, HEIGHT ); sleep 10; SDL::quit();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: SDL and Cairo segfault
by Atacama (Sexton) on Jan 09, 2011 at 20:46 UTC | |
by Khen1950fx (Canon) on Jan 10, 2011 at 11:23 UTC |