Added -g cmdline option for gamma correction, from chmmravatar
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@855 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
Changes towards version 0.3:
|
Changes towards version 0.3:
|
||||||
|
- Added -g option to control gamma correction, from chmmravatar
|
||||||
- Restored the CondBank to actually use condition variables properly
|
- Restored the CondBank to actually use condition variables properly
|
||||||
(resolves a race condition under OpenBSD)
|
(resolves a race condition under OpenBSD)
|
||||||
- Removed aspects of the legacy graphics code that are never used or that
|
- Removed aspects of the legacy graphics code that are never used or that
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ extern int FrameRateTickBase;
|
|||||||
|
|
||||||
void TFB_FlushGraphics (void); // Only call from main thread!!
|
void TFB_FlushGraphics (void); // Only call from main thread!!
|
||||||
|
|
||||||
|
void TFB_SetGamma (float gamma);
|
||||||
// Unknown Stuff
|
// Unknown Stuff
|
||||||
|
|
||||||
extern int ScreenWidth;
|
extern int ScreenWidth;
|
||||||
|
|||||||
@@ -641,4 +641,17 @@ TFB_FlushGraphics () // Only call from main thread!!
|
|||||||
BroadcastCondVar (RenderingCond);
|
BroadcastCondVar (RenderingCond);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TFB_SetGamma (float gamma)
|
||||||
|
{
|
||||||
|
if (SDL_SetGamma (gamma, gamma, gamma) == -1)
|
||||||
|
{
|
||||||
|
fprintf (stderr, "Unable to set gamma correction.\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fprintf (stderr, "Gamma correction set to %1.4f.\n", gamma);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+8
-1
@@ -88,6 +88,7 @@ main (int argc, char *argv[])
|
|||||||
int vol;
|
int vol;
|
||||||
int val;
|
int val;
|
||||||
char contentdir[1000];
|
char contentdir[1000];
|
||||||
|
float gamma = 1.0;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@@ -116,6 +117,7 @@ main (int argc, char *argv[])
|
|||||||
{"audioquality", 1, NULL, 'q'},
|
{"audioquality", 1, NULL, 'q'},
|
||||||
{"nosubtitles", 0, NULL, 'u'},
|
{"nosubtitles", 0, NULL, 'u'},
|
||||||
{"music", 1, NULL, 'm'},
|
{"music", 1, NULL, 'm'},
|
||||||
|
{"gamma", 1, NULL, 'g'},
|
||||||
// options with no short equivalent
|
// options with no short equivalent
|
||||||
{"cscan", 1, NULL, CSCAN_OPT},
|
{"cscan", 1, NULL, CSCAN_OPT},
|
||||||
{"menu", 1, NULL, MENU_OPT},
|
{"menu", 1, NULL, MENU_OPT},
|
||||||
@@ -137,7 +139,7 @@ main (int argc, char *argv[])
|
|||||||
strcpy (contentdir, "content");
|
strcpy (contentdir, "content");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while ((c = getopt_long(argc, argv, "r:d:foc:spn:?hM:S:T:m:q:u", long_options, &option_index)) != -1)
|
while ((c = getopt_long(argc, argv, "r:d:foc:spn:?hM:S:T:m:q:ug:", long_options, &option_index)) != -1)
|
||||||
{
|
{
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'r':
|
case 'r':
|
||||||
@@ -225,6 +227,9 @@ main (int argc, char *argv[])
|
|||||||
long_options[option_index].name)) != -1)
|
long_options[option_index].name)) != -1)
|
||||||
optWhichMusic = val;
|
optWhichMusic = val;
|
||||||
break;
|
break;
|
||||||
|
case 'g':
|
||||||
|
sscanf(optarg, "%f", &gamma);
|
||||||
|
break;
|
||||||
case CSCAN_OPT:
|
case CSCAN_OPT:
|
||||||
if ((val = Check_PC_3DO_opt (optarg,
|
if ((val = Check_PC_3DO_opt (optarg,
|
||||||
OPT_PC | OPT_3DO,
|
OPT_PC | OPT_3DO,
|
||||||
@@ -275,6 +280,7 @@ main (int argc, char *argv[])
|
|||||||
printf(" -c, --scale=mode (bilinear, biadapt or biadv, default is none)\n");
|
printf(" -c, --scale=mode (bilinear, biadapt or biadv, default is none)\n");
|
||||||
printf(" -s, --scanlines (default off)\n");
|
printf(" -s, --scanlines (default off)\n");
|
||||||
printf(" -p, --fps (default off)\n");
|
printf(" -p, --fps (default off)\n");
|
||||||
|
printf(" -g, --gamma=CORRECTIONVALUE (default 1.0, which causes no change)\n");
|
||||||
printf(" -n, --contentdir=CONTENTDIR\n");
|
printf(" -n, --contentdir=CONTENTDIR\n");
|
||||||
printf(" -M, --musicvol=VOLUME (0-100, default 100)\n");
|
printf(" -M, --musicvol=VOLUME (0-100, default 100)\n");
|
||||||
printf(" -S, --sfxvol=VOLUME (0-100, default 100)\n");
|
printf(" -S, --sfxvol=VOLUME (0-100, default 100)\n");
|
||||||
@@ -314,6 +320,7 @@ main (int argc, char *argv[])
|
|||||||
init_xform_control ();
|
init_xform_control ();
|
||||||
|
|
||||||
TFB_InitGraphics (gfxdriver, gfxflags, width, height, bpp);
|
TFB_InitGraphics (gfxdriver, gfxflags, width, height, bpp);
|
||||||
|
TFB_SetGamma (gamma);
|
||||||
TFB_InitSound (snddriver, soundflags);
|
TFB_InitSound (snddriver, soundflags);
|
||||||
TFB_InitInput (TFB_INPUTDRIVER_SDL, 0);
|
TFB_InitInput (TFB_INPUTDRIVER_SDL, 0);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user