2003-02-20 02:29:44 +00:00
|
|
|
#include "global.h"
|
2002-11-18 21:37:58 +00:00
|
|
|
|
2003-02-20 02:29:44 +00:00
|
|
|
#include "SDL_utils.h"
|
2003-02-14 18:50:44 +00:00
|
|
|
#include "SDL_image.h"
|
2003-05-25 20:19:01 +00:00
|
|
|
#include "SDL_rotozoom.h"
|
2002-11-18 21:37:58 +00:00
|
|
|
#include "LoadingWindow_SDL.h"
|
|
|
|
|
#include "loading.xpm"
|
2003-05-25 20:19:01 +00:00
|
|
|
#include "StepMania.xpm" /* icon */
|
2002-11-18 21:37:58 +00:00
|
|
|
|
|
|
|
|
LoadingWindow_SDL::LoadingWindow_SDL()
|
|
|
|
|
{
|
|
|
|
|
/* Initialize the SDL library */
|
|
|
|
|
if( SDL_InitSubSystem(SDL_INIT_VIDEO) < 0 )
|
2003-01-18 03:05:51 +00:00
|
|
|
RageException::Throw( "Couldn't initialize SDL: %s\n", SDL_GetError() );
|
2002-11-18 21:37:58 +00:00
|
|
|
|
2003-05-25 20:19:01 +00:00
|
|
|
/* Set window title and icon */
|
|
|
|
|
SDL_WM_SetCaption("StepMania", "StepMania");
|
|
|
|
|
|
|
|
|
|
SDL_Surface *srf = IMG_ReadXPMFromArray(icon);
|
|
|
|
|
SDL_SetColorKey( srf, SDL_SRCCOLORKEY, SDL_MapRGB(srf->format, 0xFF, 0, 0xFF));
|
|
|
|
|
|
|
|
|
|
/* Windows icons are 32x32 and SDL can't resize them for us, which
|
|
|
|
|
* causes mask corruption. (Actually, the above icon *is* 32x32;
|
|
|
|
|
* this is here just in case it changes.) */
|
|
|
|
|
ConvertSDLSurface(srf, srf->w, srf->h,
|
|
|
|
|
32, 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF);
|
|
|
|
|
zoomSurface(srf, 32, 32);
|
|
|
|
|
|
|
|
|
|
SDL_SetAlpha( srf, SDL_SRCALPHA, SDL_ALPHA_OPAQUE );
|
|
|
|
|
SDL_WM_SetIcon(srf, NULL /* derive from alpha */);
|
|
|
|
|
SDL_FreeSurface(srf);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Load the BMP - we need it's dimensions */
|
2002-11-18 21:37:58 +00:00
|
|
|
SDL_Surface *image = IMG_ReadXPMFromArray(loading);
|
|
|
|
|
if( image == NULL )
|
2003-01-18 03:05:51 +00:00
|
|
|
RageException::Throw("Couldn't load loading.bmp: %s\n",SDL_GetError());
|
2002-11-18 21:37:58 +00:00
|
|
|
|
2003-05-25 20:19:01 +00:00
|
|
|
/* Initialize the window */
|
2002-11-18 21:37:58 +00:00
|
|
|
loading_screen = SDL_SetVideoMode(image->w, image->h, 16, SDL_SWSURFACE|SDL_ANYFORMAT|SDL_NOFRAME);
|
|
|
|
|
if( loading_screen == NULL )
|
2003-01-18 03:05:51 +00:00
|
|
|
RageException::Throw( "Couldn't initialize loading window: %s\n", SDL_GetError() );
|
2002-11-18 21:37:58 +00:00
|
|
|
|
|
|
|
|
SDL_BlitSurface(image, NULL, loading_screen, NULL);
|
|
|
|
|
|
|
|
|
|
SDL_FreeSurface(image);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LoadingWindow_SDL::~LoadingWindow_SDL()
|
|
|
|
|
{
|
|
|
|
|
SDL_QuitSubSystem( SDL_INIT_VIDEO );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LoadingWindow_SDL::Paint()
|
|
|
|
|
{
|
|
|
|
|
SDL_UpdateRect(loading_screen, 0,0,0,0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Chris Danford
|
|
|
|
|
* Glenn Maynard
|
|
|
|
|
*/
|