Fixed togglefullscreen() in opengl
This commit is contained in:
parent
db9e2779f6
commit
85370a2dba
37
rc.c
37
rc.c
|
@ -11013,6 +11013,7 @@ void togglepause(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void togglefullscreen(void) {
|
void togglefullscreen(void) {
|
||||||
|
int vidargs;
|
||||||
// close window
|
// close window
|
||||||
//SDL_Quit();
|
//SDL_Quit();
|
||||||
|
|
||||||
|
@ -11023,10 +11024,17 @@ void togglefullscreen(void) {
|
||||||
fullscreen = B_TRUE;
|
fullscreen = B_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vidargs = SDL_SWSURFACE|(fullscreen?SDL_FULLSCREEN:0);
|
||||||
#ifdef OPENGL
|
#ifdef OPENGL
|
||||||
realscreen=SDL_SetVideoMode(realscreen->w,realscreen->h,realscreen->format->BitsPerPixel,SDL_SWSURFACE|SDL_OPENGL|(fullscreen?SDL_FULLSCREEN:0));
|
vidargs |= SDL_OPENGL;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef OPENGL
|
||||||
|
preinitgl();
|
||||||
|
realscreen=SDL_SetVideoMode(realscreen->w,realscreen->h,realscreen->format->BitsPerPixel,vidargs);
|
||||||
|
initgl();
|
||||||
#else
|
#else
|
||||||
screen=SDL_SetVideoMode(screen->w,screen->h,screen->format->BitsPerPixel,SDL_SWSURFACE|(screen->flags&SDL_FULLSCREEN?0:SDL_FULLSCREEN));
|
screen=SDL_SetVideoMode(screen->w,screen->h,screen->format->BitsPerPixel,vidargs);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// set title bar if required
|
// set title bar if required
|
||||||
|
@ -11041,11 +11049,24 @@ void togglefullscreen(void) {
|
||||||
SDL_setFramerate(&manager, WANTFPS);
|
SDL_setFramerate(&manager, WANTFPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
flip(B_CLEAR);
|
||||||
|
/*
|
||||||
gengl(screen);
|
gengl(screen);
|
||||||
|
|
||||||
blittoscreen();
|
blittoscreen();
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef OPENGL
|
#ifdef OPENGL
|
||||||
|
void preinitgl(void) {
|
||||||
|
SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );
|
||||||
|
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 );
|
||||||
|
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 );
|
||||||
|
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
|
||||||
|
SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1);
|
||||||
|
}
|
||||||
|
|
||||||
void initgl(void) {
|
void initgl(void) {
|
||||||
glClearColor( 0, 0, 0, 0 );
|
glClearColor( 0, 0, 0, 0 );
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
@ -11076,27 +11097,19 @@ void initsdl(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef OPENGL
|
#ifdef OPENGL
|
||||||
SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );
|
preinitgl();
|
||||||
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 );
|
|
||||||
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 );
|
|
||||||
|
|
||||||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
|
|
||||||
//SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
|
|
||||||
SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1);
|
|
||||||
//screen = SDL_SetVideoMode(SCREENW,SCREENH,16,SDL_SWSURFACE|SDL_OPENGLBLIT|vidargs);
|
|
||||||
realscreen = SDL_SetVideoMode(SCREENW,SCREENH,wantbpp,SDL_SWSURFACE|SDL_OPENGL|vidargs);
|
realscreen = SDL_SetVideoMode(SCREENW,SCREENH,wantbpp,SDL_SWSURFACE|SDL_OPENGL|vidargs);
|
||||||
|
|
||||||
screen = SDL_CreateRGBSurface(SDL_SWSURFACE, realscreen->w, realscreen->h, wantbpp, rm, gm, bm ,am);
|
screen = SDL_CreateRGBSurface(SDL_SWSURFACE, realscreen->w, realscreen->h, wantbpp, rm, gm, bm ,am);
|
||||||
|
|
||||||
SDL_SetAlpha(screen, SDL_SRCALPHA, 0);
|
SDL_SetAlpha(screen, SDL_SRCALPHA, 0);
|
||||||
#else
|
#else
|
||||||
//screen = SDL_SetVideoMode(SCREENW,SCREENH,16,SDL_SWSURFACE|SDL_DOUBLEBUF|vidargs);
|
//screen = SDL_SetVideoMode(SCREENW,SCREENH,16,SDL_SWSURFACE|SDL_DOUBLEBUF|vidargs);
|
||||||
|
|
||||||
// Try for 16 bit mode, but SDL_ANYFORMAT means that 32 bit is acceptable.
|
// Try for 16 bit mode, but SDL_ANYFORMAT means that 32 bit is acceptable.
|
||||||
screen = SDL_SetVideoMode(SCREENW,SCREENH,wantbpp,SDL_SWSURFACE|SDL_ANYFORMAT|vidargs);
|
screen = SDL_SetVideoMode(SCREENW,SCREENH,wantbpp,SDL_SWSURFACE|SDL_ANYFORMAT|vidargs);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// set drawpixel function based on what depth we ended up with
|
// set drawpixel function based on what depth we ended up with
|
||||||
if (realscreen->format->BitsPerPixel == 32) {
|
if (realscreen->format->BitsPerPixel == 32) {
|
||||||
drawpixel = drawpixel32;
|
drawpixel = drawpixel32;
|
||||||
|
|
1
rc.h
1
rc.h
|
@ -76,6 +76,7 @@ int getmonjumpspeed(sprite_t *s);
|
||||||
int getjumpdelay(int mid);
|
int getjumpdelay(int mid);
|
||||||
void togglepause(void);
|
void togglepause(void);
|
||||||
void togglefullscreen(void);
|
void togglefullscreen(void);
|
||||||
|
void preinitgl(void);
|
||||||
void initgl(void);
|
void initgl(void);
|
||||||
void initsdl(void);
|
void initsdl(void);
|
||||||
void getfruit(sprite_t *giveto, sprite_t *fruit, int multiplier);
|
void getfruit(sprite_t *giveto, sprite_t *fruit, int multiplier);
|
||||||
|
|
7
todo
7
todo
|
@ -1,9 +1,4 @@
|
||||||
- On spike school, allow 40 more seconds before hurryup.
|
- fullscreen mode not working with open
|
||||||
|
|
||||||
- Convert to openGL so it will run properly in non-fullsecreen mode.
|
|
||||||
*initial conversion
|
|
||||||
|
|
||||||
cloud isn't being cleared properly during level transition
|
|
||||||
|
|
||||||
|
|
||||||
- get it working not super slow while in non-fullscreen mode.
|
- get it working not super slow while in non-fullscreen mode.
|
||||||
|
|
Loading…
Reference in New Issue