/* This should probably go somewhere else -- like GAL_surface.c */ static void GAL_ClearSurface(GAL_Surface *surface) { Uint32 black; black = GAL_MapRGB(surface->format, 0, 0, 0); GAL_FillRect(surface, NULL, black); }
int InitGAL (void) { int i; int w, h, depth; char engine [LEN_ENGINE_NAME + 1]; char mode [LEN_MODE + 1]; if (GetMgEtcValue ("system", "gal_engine", engine, LEN_ENGINE_NAME) < 0 ) return ERR_CONFIG_FILE; if (GAL_VideoInit (engine, 0)) { GAL_VideoQuit (); fprintf (stderr, "NEWGAL: Does not find matched engine: %s.\n", engine); return ERR_NO_MATCH; } if (GetMgEtcValue (engine, "defaultmode", mode, LEN_MODE) < 0) return ERR_CONFIG_FILE; w = atoi (mode); h = atoi (strchr (mode, 'x') + 1); depth = atoi (strrchr (mode, '-') + 1); if (!(__gal_screen = GAL_SetVideoMode (w, h, depth, GAL_HWPALETTE))) { GAL_VideoQuit (); fprintf (stderr, "NEWGAL: Set video mode failure.\n"); return ERR_GFX_ENGINE; } #ifdef _LITE_VERSION if (w != __gal_screen->w || h != __gal_screen->h) { fprintf (stderr, "The resolution specified in MiniGUI.cfg is not the same as " "the actual resolution: %dx%d.\n" "This may confuse the clients. Please change it.\n", __gal_screen->w, __gal_screen->h); GAL_VideoQuit (); return ERR_GFX_ENGINE; } #endif for (i = 0; i < 17; i++) { SysPixelIndex [i] = GAL_MapRGB (__gal_screen->format, SysPixelColor [i].r, SysPixelColor [i].g, SysPixelColor [i].b); } return 0; }