mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-09-04 17:15:23 -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 "Initialize video" video;
|
||||||
option "Double buffering" doublebuff;
|
option "Double buffering" doublebuff;
|
||||||
option "Full screen" fullscreen;
|
option "Full screen" fullscreen;
|
||||||
option "Event loop" loop;
|
|
||||||
option "Use SSE2" sse2 = 1;
|
option "Use SSE2" sse2 = 1;
|
||||||
|
|
||||||
@@<:PACKAGE:>.h
|
@@<:PACKAGE:>.h
|
||||||
|
|
@ -35,12 +34,12 @@ SDL_Surface * OpenScreen(const int width, const int height, const int bpp, const
|
||||||
}
|
}
|
||||||
return screen;
|
return screen;
|
||||||
}
|
}
|
||||||
<:.:><:(loop && video ? "
|
|
||||||
void Paint(SDL_Surface * surface)
|
void Paint(SDL_Surface * surface)
|
||||||
{
|
{
|
||||||
/* Put your painting code here */
|
/* Put your painting code here */
|
||||||
}
|
}
|
||||||
" : ""):>
|
<:.:>
|
||||||
CONSOLE_APP_MAIN
|
CONSOLE_APP_MAIN
|
||||||
{
|
{
|
||||||
if(SDL_Init(SDL_INIT_VIDEO) < 0)
|
if(SDL_Init(SDL_INIT_VIDEO) < 0)
|
||||||
|
|
@ -50,7 +49,7 @@ CONSOLE_APP_MAIN
|
||||||
SDL_Surface * screen = OpenScreen(1024, 768, 32, videoflags);
|
SDL_Surface * screen = OpenScreen(1024, 768, 32, videoflags);
|
||||||
if(!screen)
|
if(!screen)
|
||||||
return;
|
return;
|
||||||
<:.:><:?loop:>
|
<:.:>
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
bool done = false;
|
bool done = false;
|
||||||
|
|
||||||
|
|
@ -63,14 +62,14 @@ CONSOLE_APP_MAIN
|
||||||
case SDL_KEYDOWN:
|
case SDL_KEYDOWN:
|
||||||
if(event.key.keysym.sym == SDLK_LALT || event.key.keysym.sym == SDLK_TAB)
|
if(event.key.keysym.sym == SDLK_LALT || event.key.keysym.sym == SDLK_TAB)
|
||||||
break;
|
break;
|
||||||
<:(video ? "if(event.key.keysym.sym == SDLK_RETURN)
|
<:?video:>if(event.key.keysym.sym == SDLK_RETURN)
|
||||||
{
|
{
|
||||||
videoflags ^= SDL_FULLSCREEN;
|
videoflags ^= SDL_FULLSCREEN;
|
||||||
screen = OpenScreen(screen->w, screen->h, screen->format->BitsPerPixel, videoflags);
|
screen = OpenScreen(screen->w, screen->h, screen->format->BitsPerPixel, videoflags);
|
||||||
if(!screen)
|
if(!screen)
|
||||||
done = true;
|
done = true;
|
||||||
break;
|
break;
|
||||||
}" : ""):>
|
}<:.:>
|
||||||
case SDL_QUIT:
|
case SDL_QUIT:
|
||||||
done = true;
|
done = true;
|
||||||
break;
|
break;
|
||||||
|
|
@ -78,12 +77,12 @@ CONSOLE_APP_MAIN
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
<:(video ? "else
|
<:?video:>else
|
||||||
{
|
{
|
||||||
Paint(screen);
|
Paint(screen);
|
||||||
SDL_Flip(screen);
|
SDL_Flip(screen);
|
||||||
}" : ""):>
|
}<:.:>
|
||||||
}<:.:><:?video:>
|
}<:?video:>
|
||||||
SDL_FreeSurface(screen);<:.:>
|
SDL_FreeSurface(screen);<:.:>
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ option "Create header" header;
|
||||||
option "Initialize video" video;
|
option "Initialize video" video;
|
||||||
option "Double buffering" doublebuff;
|
option "Double buffering" doublebuff;
|
||||||
option "Full screen" fullscreen;
|
option "Full screen" fullscreen;
|
||||||
option "Event loop" loop;
|
|
||||||
option "Use SSE2" sse2 = 1;
|
option "Use SSE2" sse2 = 1;
|
||||||
|
|
||||||
@@<:PACKAGE:>.h
|
@@<:PACKAGE:>.h
|
||||||
|
|
@ -28,12 +27,12 @@ SDL_Surface * OpenScreen(const int width, const int height, const int bpp, const
|
||||||
}
|
}
|
||||||
return screen;
|
return screen;
|
||||||
}
|
}
|
||||||
<:.:><:(loop && video ? "
|
|
||||||
void Paint(SDL_Surface * surface)
|
void Paint(SDL_Surface * surface)
|
||||||
{
|
{
|
||||||
/* Put your painting code here */
|
/* Put your painting code here */
|
||||||
}
|
}
|
||||||
" : ""):>
|
<:.:>
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
if(SDL_Init(SDL_INIT_VIDEO) < 0)
|
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);
|
SDL_Surface * screen = OpenScreen(1024, 768, 32, videoflags);
|
||||||
if(!screen)
|
if(!screen)
|
||||||
return 1;
|
return 1;
|
||||||
<:.:><:?loop:>
|
<:.:>
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
bool done = false;
|
bool done = false;
|
||||||
|
|
||||||
|
|
@ -56,14 +55,14 @@ int main(int argc, char **argv)
|
||||||
case SDL_KEYDOWN:
|
case SDL_KEYDOWN:
|
||||||
if(event.key.keysym.sym == SDLK_LALT || event.key.keysym.sym == SDLK_TAB)
|
if(event.key.keysym.sym == SDLK_LALT || event.key.keysym.sym == SDLK_TAB)
|
||||||
break;
|
break;
|
||||||
<:(video ? "if(event.key.keysym.sym == SDLK_RETURN)
|
<:?video:>if(event.key.keysym.sym == SDLK_RETURN)
|
||||||
{
|
{
|
||||||
videoflags ^= SDL_FULLSCREEN;
|
videoflags ^= SDL_FULLSCREEN;
|
||||||
screen = OpenScreen(screen->w, screen->h, screen->format->BitsPerPixel, videoflags);
|
screen = OpenScreen(screen->w, screen->h, screen->format->BitsPerPixel, videoflags);
|
||||||
if(!screen)
|
if(!screen)
|
||||||
done = true;
|
done = true;
|
||||||
break;
|
break;
|
||||||
}" : ""):>
|
}<:.:>
|
||||||
case SDL_QUIT:
|
case SDL_QUIT:
|
||||||
done = true;
|
done = true;
|
||||||
break;
|
break;
|
||||||
|
|
@ -71,12 +70,12 @@ int main(int argc, char **argv)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
<:(video ? "else
|
<:video:>else
|
||||||
{
|
{
|
||||||
Paint(screen);
|
Paint(screen);
|
||||||
SDL_Flip(screen);
|
SDL_Flip(screen);
|
||||||
}" : ""):>
|
}<:.:>
|
||||||
}<:.:><:?video:>
|
}<:?video:>
|
||||||
SDL_FreeSurface(screen);<:.:>
|
SDL_FreeSurface(screen);<:.:>
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue