Original Post
To check that i had SDL properly installed and everything, i made the little silly program below(it display a background picture and draws a smaller picture where the mouse is clicked, if a key is pressed it takes a screenshot and restores the background). It works fine windowed, but when i added the SDL_FULLSCREEN flag i ran into trouble, weird things happened when i clicked the mouse. Depending on the other flags, the background disappeared, or the small pictures moved(!) when i clicked the mouse, or just became transparent in the center...
Can anyone help me fix this, i would like to know if its because im using it wrong(likely) or because of something else beyond my control.
Here is the very simple code
EDIT: Just wanted to add that im working in Windows XP with a Geforce 2 64MB card, could that be the cause?
Edited by - ziphnor on December 10, 2001 4:55:26 PM
Edited by - ziphnor on December 11, 2001 6:31:46 AM
#include "SDL.h"
int main( int argc, char* argv[] )
{
//initialize systems
SDL_Init ( SDL_INIT_VIDEO ) ;
atexit ( SDL_Quit ) ;
//create a window
SDL_Surface* pSurface = SDL_SetVideoMode ( 640 , 480 , 0, SDL_HWSURFACE | SDL_FULLSCREEN | SDL_DOUBLEBUF ) ;
SDL_Surface* imageTile = SDL_LoadBMP("boom.bmp");
SDL_Surface* background = SDL_LoadBMP("background.bmp");
SDL_SetColorKey(imageTile, SDL_SRCCOLORKEY, SDL_MapRGB(imageTile->format, 255, 0, 128));
SDL_WM_SetCaption("Stupid SDL test program", NULL);
SDL_Event event;//declare event variable
SDL_BlitSurface(background, NULL, pSurface, NULL);
SDL_Flip(pSurface);
for ( ; ; ) //message pump
{
if ( SDL_PollEvent ( &event ) ) //look for an event
{
//an event was found
if ( event.type == SDL_QUIT ) break ;
if ( event.type == SDL_KEYDOWN ) {
SDL_SaveBMP(pSurface, "screenshot.bmp");
SDL_BlitSurface(background, NULL, pSurface, NULL); // propper baggrunden ind
SDL_Flip(pSurface);
}
if ( event.type == SDL_MOUSEBUTTONDOWN) {
SDL_Rect target;
target.x = event.button.x - 10;
target.y = event.button.y - 10;
SDL_BlitSurface(imageTile, NULL, pSurface, ⌖);
SDL_Flip(pSurface);
}
}
}
return ( 0 ) ;
}
|