Graphics cleanups: locking, colors.h for shadowboxes

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2498 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
mcmartin
2006-11-12 07:07:51 +00:00
parent 73d6165280
commit 53012324a8
4 changed files with 21 additions and 17 deletions
+10 -1
View File
@@ -140,7 +140,16 @@
// The text "MORE" when reviewing the conversation history.
#define COMM_MORE_TEXT_COLOR \
BUILD_COLOR (MAKE_RGB15 (0x00, 0x17, 0x00), 0x00)
// Default colors for System Dialog Boxes (DrawShadowedBox)
#define SHADOWBOX_BACKGROUND_COLOR \
MENU_BACKGROUND_COLOR
#define SHADOWBOX_MEDIUM_COLOR \
BUILD_COLOR (MAKE_RGB15 (0x10, 0x10, 0x10), 0x19)
#define SHADOWBOX_DARK_COLOR \
BUILD_COLOR (MAKE_RGB15 (0x08, 0x08, 0x08), 0x1F)
#endif /* _COLORS_H */
+2 -5
View File
@@ -38,21 +38,18 @@ static void
DrawConfirmationWindow (BOOLEAN answer)
{
COLOR oldfg = SetContextForeGroundColor (MENU_TEXT_COLOR);
COLOR dark, medium;
FONT oldfont = SetContextFont (StarConFont);
FRAME oldFontEffect = SetContextFontEffect (NULL);
RECT r;
TEXT t;
dark = BUILD_COLOR (MAKE_RGB15 (0x08, 0x08, 0x08), 0x1F);
medium = BUILD_COLOR (MAKE_RGB15 (0x10, 0x10, 0x10), 0x19);
BatchGraphics ();
r.corner.x = (SCREEN_WIDTH - CONFIRM_WIN_WIDTH) >> 1;
r.corner.y = (SCREEN_HEIGHT - CONFIRM_WIN_HEIGHT) >> 1;
r.extent.width = CONFIRM_WIN_WIDTH;
r.extent.height = CONFIRM_WIN_HEIGHT;
DrawShadowedBox (&r, MENU_BACKGROUND_COLOR, dark, medium);
DrawShadowedBox (&r, SHADOWBOX_BACKGROUND_COLOR,
SHADOWBOX_DARK_COLOR, SHADOWBOX_MEDIUM_COLOR);
t.baseline.x = r.corner.x + (r.extent.width >> 1);
t.baseline.y = r.corner.y + 8;
+3 -5
View File
@@ -1,5 +1,6 @@
#include "graphics/gfx_common.h"
#include "graphics/widgets.h"
#include "colors.h"
#include "strlib.h"
#include "setup.h"
#include "units.h"
@@ -63,16 +64,12 @@ void
DrawLabelAsWindow(WIDGET_LABEL *label)
{
COLOR oldfg = SetContextForeGroundColor (WIDGET_DIALOG_TEXT_COLOR);
COLOR dark, medium;
FONT oldfont = SetContextFont (StarConFont);
FRAME oldFontEffect = SetContextFontEffect (NULL);
RECT r;
TEXT t;
int i, win_w, win_h;
dark = BUILD_COLOR (MAKE_RGB15 (0x08, 0x08, 0x08), 0x1F);
medium = BUILD_COLOR (MAKE_RGB15 (0x10, 0x10, 0x10), 0x19);
/* Compute the dimensions of the label */
win_h = label->height ((WIDGET *)label) + 16;
win_w = 0;
@@ -91,7 +88,8 @@ DrawLabelAsWindow(WIDGET_LABEL *label)
r.corner.y = (SCREEN_HEIGHT - win_h) >> 1;
r.extent.width = win_w;
r.extent.height = win_h;
DrawShadowedBox (&r, WIDGET_DIALOG_COLOR, dark, medium);
DrawShadowedBox (&r, SHADOWBOX_BACKGROUND_COLOR,
SHADOWBOX_DARK_COLOR, SHADOWBOX_MEDIUM_COLOR);
t.baseline.x = r.corner.x + (r.extent.width >> 1);
t.baseline.y = r.corner.y + 16;
+6 -6
View File
@@ -2208,9 +2208,8 @@ DoConnectingDialog (PMELEE_STATE pMS)
if (!pMS->Initialized)
{
RECT r;
FONT oldfont = SetContextFont (StarConFont);
COLOR oldcolor = SetContextForeGroundColor (BLACK_COLOR);
COLOR dark, medium;
FONT oldfont;
COLOR oldcolor;
TEXT t;
if (pMS->flash_task)
@@ -2229,14 +2228,15 @@ DoConnectingDialog (PMELEE_STATE pMS)
/* Draw the dialog box here */
LockMutex (GraphicsLock);
oldfont = SetContextFont (StarConFont);
oldcolor = SetContextForeGroundColor (BLACK_COLOR);
BatchGraphics ();
r.extent.width = 200;
r.extent.height = 30;
r.corner.x = (SCREEN_WIDTH - r.extent.width) >> 1;
r.corner.y = (SCREEN_HEIGHT - r.extent.height) >> 1;
dark = BUILD_COLOR (MAKE_RGB15 (0x08, 0x08, 0x08), 0x1F);
medium = BUILD_COLOR (MAKE_RGB15 (0x10, 0x10, 0x10), 0x19);
DrawShadowedBox (&r, MENU_BACKGROUND_COLOR, dark, medium);
DrawShadowedBox (&r, SHADOWBOX_BACKGROUND_COLOR,
SHADOWBOX_DARK_COLOR, SHADOWBOX_MEDIUM_COLOR);
if (NetConnection_getPeerOptions (conn)->isServer)
{