16/32 Bit Per Pixel Resolution

origin
stpohle 23 years ago
parent cf6369d702
commit dd79ad9655

@ -48,6 +48,7 @@ game_init ()
debug = 0;
gfx.res.x = 640;
gfx.res.y = 480;
gfx.bpp = 16;
bman.fieldsize.x = 25;
bman.fieldsize.y = 17;
sprintf (bman.datapath, "data/bomberclone.gfx");
@ -144,6 +145,9 @@ ReadConfig ()
if (!strcmp (keyword, "fullscreen")) {
gfx.fullscreen = atoi (value);
}
if (!strcmp (keyword, "bitsperpixel")) {
gfx.bpp = atoi (value);
}
if (!strcmp (keyword, "ai_family")) {
bman.net_ai_family = atoi (value);
}
@ -198,6 +202,8 @@ WriteConfig ()
fprintf (config, "debug=%d\n", debug);
fprintf (config, "selectplayer=%d\n", bman.selectplayer);
fprintf (config, "playername=%s\n", bman.playername);
fprintf (config, "bitsperpixel=%d\n", gfx.bpp);
fclose (config);
return 0;
}
@ -214,7 +220,8 @@ change_res ()
{2, "800x600"},
{3, "1024x768"},
{4, "1280x1024"},
{5, "Return To Configuration Menu"},
{5, "BPP"},
{6, "Return To Configuration Menu"},
{-1, ""}
};
while (1) {
@ -223,7 +230,11 @@ change_res ()
else
sprintf (menu[0].text, "Enable Full Screen");
if (gfx.bpp == 16)
sprintf (menu[5].text, "16 Bit Per Pixel");
else
sprintf (menu[5].text, "32 Bit Per Pixel");
menuselect = menu_loop ("Video Options", menu, menuselect);
switch (menuselect) {
@ -250,7 +261,13 @@ change_res ()
gfx.res.x = 1280;
gfx.res.y = 1024;
break;
case (5): // Return
case (5):
if (gfx.bpp == 16)
gfx.bpp = 32;
else
gfx.bpp = 16;
break;
case (6): // Return
menuselect = -1;
break;
}

@ -495,10 +495,10 @@ void gfx_game_shutdown () {
/* init the whole GFX Part */
void gfx_init () {
if (gfx.fullscreen)
gfx.screen = SDL_SetVideoMode (gfx.res.x, gfx.res.y, 16,
gfx.screen = SDL_SetVideoMode (gfx.res.x, gfx.res.y, gfx.bpp,
SDL_SWSURFACE | SDL_DOUBLEBUF | SDL_HWACCEL | SDL_FULLSCREEN);
else
gfx.screen = SDL_SetVideoMode (gfx.res.x, gfx.res.y, 16,
gfx.screen = SDL_SetVideoMode (gfx.res.x, gfx.res.y, gfx.bpp,
SDL_SWSURFACE | SDL_DOUBLEBUF | SDL_HWACCEL);
if (gfx.screen == NULL) {

@ -33,6 +33,7 @@ struct __gfx {
SDL_Surface *screen;
_point res; // resolution
_point block; // block size
short int bpp; // bits per pixel
unsigned char fullscreen;

Loading…
Cancel
Save