mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-17 06:06:00 -06:00
Fixed SDL.upt #889
git-svn-id: svn://ultimatepp.org/upp/trunk@7891 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
fc5d44a452
commit
2b551591c8
2 changed files with 16 additions and 18 deletions
|
|
@ -4,7 +4,6 @@ option "Create header" header;
|
|||
option "Initialize video" video;
|
||||
option "Double buffering" doublebuff;
|
||||
option "Full screen" fullscreen;
|
||||
option "Event loop" loop;
|
||||
option "Use SSE2" sse2 = 1;
|
||||
|
||||
@@<:PACKAGE:>.h
|
||||
|
|
@ -35,12 +34,12 @@ SDL_Surface * OpenScreen(const int width, const int height, const int bpp, const
|
|||
}
|
||||
return screen;
|
||||
}
|
||||
<:.:><:(loop && video ? "
|
||||
|
||||
void Paint(SDL_Surface * surface)
|
||||
{
|
||||
/* Put your painting code here */
|
||||
}
|
||||
" : ""):>
|
||||
<:.:>
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
if(SDL_Init(SDL_INIT_VIDEO) < 0)
|
||||
|
|
@ -50,7 +49,7 @@ CONSOLE_APP_MAIN
|
|||
SDL_Surface * screen = OpenScreen(1024, 768, 32, videoflags);
|
||||
if(!screen)
|
||||
return;
|
||||
<:.:><:?loop:>
|
||||
<:.:>
|
||||
SDL_Event event;
|
||||
bool done = false;
|
||||
|
||||
|
|
@ -63,14 +62,14 @@ CONSOLE_APP_MAIN
|
|||
case SDL_KEYDOWN:
|
||||
if(event.key.keysym.sym == SDLK_LALT || event.key.keysym.sym == SDLK_TAB)
|
||||
break;
|
||||
<:(video ? "if(event.key.keysym.sym == SDLK_RETURN)
|
||||
<:?video:>if(event.key.keysym.sym == SDLK_RETURN)
|
||||
{
|
||||
videoflags ^= SDL_FULLSCREEN;
|
||||
screen = OpenScreen(screen->w, screen->h, screen->format->BitsPerPixel, videoflags);
|
||||
if(!screen)
|
||||
done = true;
|
||||
break;
|
||||
}" : ""):>
|
||||
}<:.:>
|
||||
case SDL_QUIT:
|
||||
done = true;
|
||||
break;
|
||||
|
|
@ -78,12 +77,12 @@ CONSOLE_APP_MAIN
|
|||
break;
|
||||
}
|
||||
}
|
||||
<:(video ? "else
|
||||
<:?video:>else
|
||||
{
|
||||
Paint(screen);
|
||||
SDL_Flip(screen);
|
||||
}" : ""):>
|
||||
}<:.:><:?video:>
|
||||
}<:.:>
|
||||
}<:?video:>
|
||||
SDL_FreeSurface(screen);<:.:>
|
||||
SDL_Quit();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ option "Create header" header;
|
|||
option "Initialize video" video;
|
||||
option "Double buffering" doublebuff;
|
||||
option "Full screen" fullscreen;
|
||||
option "Event loop" loop;
|
||||
option "Use SSE2" sse2 = 1;
|
||||
|
||||
@@<:PACKAGE:>.h
|
||||
|
|
@ -28,12 +27,12 @@ SDL_Surface * OpenScreen(const int width, const int height, const int bpp, const
|
|||
}
|
||||
return screen;
|
||||
}
|
||||
<:.:><:(loop && video ? "
|
||||
|
||||
void Paint(SDL_Surface * surface)
|
||||
{
|
||||
/* Put your painting code here */
|
||||
}
|
||||
" : ""):>
|
||||
<:.:>
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if(SDL_Init(SDL_INIT_VIDEO) < 0)
|
||||
|
|
@ -43,7 +42,7 @@ int main(int argc, char **argv)
|
|||
SDL_Surface * screen = OpenScreen(1024, 768, 32, videoflags);
|
||||
if(!screen)
|
||||
return 1;
|
||||
<:.:><:?loop:>
|
||||
<:.:>
|
||||
SDL_Event event;
|
||||
bool done = false;
|
||||
|
||||
|
|
@ -56,14 +55,14 @@ int main(int argc, char **argv)
|
|||
case SDL_KEYDOWN:
|
||||
if(event.key.keysym.sym == SDLK_LALT || event.key.keysym.sym == SDLK_TAB)
|
||||
break;
|
||||
<:(video ? "if(event.key.keysym.sym == SDLK_RETURN)
|
||||
<:?video:>if(event.key.keysym.sym == SDLK_RETURN)
|
||||
{
|
||||
videoflags ^= SDL_FULLSCREEN;
|
||||
screen = OpenScreen(screen->w, screen->h, screen->format->BitsPerPixel, videoflags);
|
||||
if(!screen)
|
||||
done = true;
|
||||
break;
|
||||
}" : ""):>
|
||||
}<:.:>
|
||||
case SDL_QUIT:
|
||||
done = true;
|
||||
break;
|
||||
|
|
@ -71,12 +70,12 @@ int main(int argc, char **argv)
|
|||
break;
|
||||
}
|
||||
}
|
||||
<:(video ? "else
|
||||
<:video:>else
|
||||
{
|
||||
Paint(screen);
|
||||
SDL_Flip(screen);
|
||||
}" : ""):>
|
||||
}<:.:><:?video:>
|
||||
}<:.:>
|
||||
}<:?video:>
|
||||
SDL_FreeSurface(screen);<:.:>
|
||||
SDL_Quit();
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue