Setup menu uses a background graphic now

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1532 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
mcmartin
2005-02-11 08:52:52 +00:00
parent 09e5811bf2
commit 1bc33d31af
5 changed files with 62 additions and 89 deletions
+1
View File
@@ -1,4 +1,5 @@
Changes towards version 0.4:
- Setup menu now uses a background contributed by Joffrey Smith
- If keys.cfg refers to a nonexistent joystick, the game will stil run
(bug #660) -McMartin
- Fixed support for languages other than English; loading font chars
Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

+1
View File
@@ -0,0 +1 @@
setupmenu.0.png -1 -1 0 0
+25 -53
View File
@@ -22,10 +22,12 @@
#include "options.h"
#include "setup.h"
#include "sounds.h"
#include "libs/gfxlib.h"
#include "libs/graphics/gfx_common.h"
#include "libs/graphics/widgets.h"
#include "libs/graphics/tfb_draw.h"
#define MENU_BKG "lbm/setupmenu.ani"
typedef struct setup_menu_state {
BOOLEAN (*InputFunc) (struct setup_menu_state *pInputState);
@@ -52,6 +54,7 @@ typedef struct {
} MENU_CATEGORY;
static BOOLEAN DoSetupMenu (PSETUP_MENU_STATE pInputState);
static STAMP bkgStamp = { {0, 0}, NULL };
static OPTION scaler_opts[] = {
{ "None",
@@ -200,11 +203,6 @@ static OPTION resdriver_opts[] = {
};
static OPTION bpp_opts[] = {
{ "8",
{ "8-bit paletted display.",
"",
""
} },
{ "16",
{ "16-bit color depth.",
"",
@@ -237,7 +235,7 @@ static const char **tooltip;
static MENU_CATEGORY cmdline_opts[] = {
{ "Resolution", RES_OPTS, resdriver_opts, 0 },
{ "Color depth", 4, bpp_opts, 0 },
{ "Color depth", 3, bpp_opts, 0 },
{ "Scaler", 5, scaler_opts, 0 },
{ "Scanlines", 2, scanlines_opts, 0 },
{ "Menu Style", 2, menu_opts, 0 },
@@ -290,7 +288,7 @@ static void
DrawMenu (PSETUP_MENU_STATE pInputState)
{
RECT r;
COLOR bg, dark, medium, title, oldtext;
COLOR title, oldtext;
COLOR inactive, default_color, selected;
FONT oldfont = SetContextFont (StarConFont);
FONTEFFECT oldFontEffect = SetContextFontEffect (0, 0, 0);
@@ -303,16 +301,19 @@ DrawMenu (PSETUP_MENU_STATE pInputState)
r.extent.width = SCREEN_WIDTH - 4;
r.extent.height = SCREEN_HEIGHT - 4;
dark = BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x08), 0x01);
medium = BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x10), 0x01);
bg = BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x1A), 0x09);
title = BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x1F), 0x0F);
selected = BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x00), 0x0E);
inactive = BUILD_COLOR (MAKE_RGB15 (0x18, 0x18, 0x18), 0x07);
inactive = BUILD_COLOR (MAKE_RGB15 (0x18, 0x18, 0x1F), 0x07);
default_color = title;
DrawShadowedBox(&r, bg, dark, medium);
if (!bkgStamp.frame)
{
bkgStamp.origin.x = 0;
bkgStamp.origin.y = 0;
bkgStamp.frame = CaptureDrawable (LoadCelFile (MENU_BKG));
}
DrawStamp (&bkgStamp);
oldtext = SetContextForeGroundColor (title);
t.baseline.x = r.corner.x + (r.extent.width >> 1);
@@ -344,7 +345,7 @@ DrawMenu (PSETUP_MENU_STATE pInputState)
}
else
{
SetContextForeGroundColor (inactive);
SetContextForeGroundColor (title);
}
font_DrawText (&t);
@@ -395,48 +396,21 @@ DrawMenu (PSETUP_MENU_STATE pInputState)
static BOOLEAN
DoSetupMenu (PSETUP_MENU_STATE pInputState)
{
int opt, cat;
MENU_CATEGORY *menu = cmdline_opts;
if (!pInputState->initialized)
{
SetDefaultMenuRepeatDelay ();
pInputState->anim_frame_count = NUM_STEPS;
pInputState->initialized = TRUE;
SetTransitionSource (NULL);
pInputState->NextTime = GetTimeCounter ();
pInputState->category = 0;
pInputState->option = 0;
SetDefaults ();
pInputState->option = menu[0].selected;
}
BatchGraphics ();
if (pInputState->anim_frame_count)
{
RECT r;
COLOR bg, dark, medium;
int frame;
pInputState->anim_frame_count -= 3;
if (pInputState->anim_frame_count < 0)
{
pInputState->anim_frame_count = 0;
}
frame = pInputState->anim_frame_count;
r.corner.x = ((frame * X_STEP) >> 1) + 2;
r.corner.y = ((frame * Y_STEP) >> 1) + 2;
r.extent.width = X_STEP * (NUM_STEPS - frame) - 4;
r.extent.height = Y_STEP * (NUM_STEPS - frame) - 4;
dark = BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x08), 0x01);
medium = BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x10), 0x01);
bg = BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x1A), 0x09);
DrawShadowedBox (&r, bg, dark, medium);
}
else
{
int opt, cat;
MENU_CATEGORY *menu = cmdline_opts;
DrawMenu (pInputState);
cat = pInputState->category;
opt = pInputState->option;
@@ -481,8 +455,12 @@ DoSetupMenu (PSETUP_MENU_STATE pInputState)
{
cmdline_opts[cat].selected = opt;
}
}
if (!pInputState->initialized)
{
pInputState->initialized = TRUE;
ScreenTransition (3, NULL);
}
UnbatchGraphics ();
SleepThreadUntil (pInputState->NextTime + MENU_FRAME_RATE);
pInputState->NextTime = GetTimeCounter ();
@@ -537,9 +515,6 @@ GetGlobalOptions (GLOBALOPTS *opts)
switch (ScreenColorDepth)
{
case 8:
opts->depth = OPTVAL_8;
break;
case 16:
opts->depth = OPTVAL_16;
break;
@@ -638,9 +613,6 @@ SetGlobalOptions (GLOBALOPTS *opts)
}
switch (opts->depth) {
case OPTVAL_8:
NewDepth = 8;
break;
case OPTVAL_16:
NewDepth = 16;
break;
-1
View File
@@ -47,7 +47,6 @@ typedef enum {
} OPT_RESDRIVERTYPE;
typedef enum {
OPTVAL_8,
OPTVAL_16,
OPTVAL_24,
OPTVAL_32