I’m currently toying with the idea of porting my game to the Macintosh. My
school labs have OS9.2, so I’m here now trying to get a very simple SDL
test app to compile and run using Codewarrior 4.1.
I got it to compile and link fine. I dragged the SDL include folder into my
project, as well as SDLmain.PPC.LIB and SDL.STUB.
But when I run it I get an error on SDL_SetVideoMode, for any windowed
setting it’s “modeNewGWorld() failed” and for fullscreen it’s “Couldn’t
create shadow surface”.
I am trying all types of color depths, fullscreen/windowed, double
buffering, as well as trying SDL_ANYFORMAT.
I’ve also tried the test programs that come with SDL. Any ones dealing
with video have the same problem, with the same error.
My best guess is the SDL extension is not loaded. I dropped it into the
extensions folder and rebooted, according to the Apple System Profiler it
is loaded and enabled. The extension manager is not available. But being
a lab computer, I have a hard time accepting I can just install an extension
like that.
If the SDL extension was not available, would it be able to get past
SDL_Init?
Below is the program, very short and simple. Thanks for any ideas.
Matt--------------------
#include “SDL.h”
#include
#include
using namespace std;
SDL_Surface *screen;
void init_SDL()
{
if ( SDL_Init(SDL_INIT_VIDEO) < 0 )
{
cerr << "Couldn’t initialize SDL: " << SDL_GetError() << endl;
exit(1);
}
atexit(SDL_Quit);
screen = SDL_SetVideoMode(640, 480, 8, 0);
if ( screen == NULL )
{
cerr << "video mode" << SDL_GetError() << endl;
exit(1);
}
}
int main(int argc, char *argv[])
{
init_SDL();
SDL_Rect r;
r.x = 30;
r.y = 30;
r.w = 200;
r.h = 200;
Uint32 red = SDL_MapRGB(screen->format, 200, 21, 35);
SDL_FillRect(screen, &r, red);
SDL_UpdateRect(screen, 0, 0, 0, 0);
// tried just about every combo
// I can think of of video mode and
// SDL_Flip/SDL_UpdateRect
SDL_Delay(5000);
return 0;
}