Abstracted the quit-confirm window
Beginning of the creation of somewhat general-purpose widgets for the setup menu and related functionality. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1369 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
Changes towards version 0.4:
|
Changes towards version 0.4:
|
||||||
|
- Abstracted window-drawing code from confirm.c -Michael
|
||||||
- Fixed blue comms screen problem (bug #363), from Joel Holveck & Nic
|
- Fixed blue comms screen problem (bug #363), from Joel Holveck & Nic
|
||||||
- Automatically adding an icon for Darwin builds, from Nic
|
- Automatically adding an icon for Darwin builds, from Nic
|
||||||
- Fixed Roster-F10-Quit bug (#591), - Michael
|
- Fixed Roster-F10-Quit bug (#591), - Michael
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include "starcon.h"
|
#include "starcon.h"
|
||||||
#include "commglue.h"
|
#include "commglue.h"
|
||||||
#include "comm.h"
|
#include "comm.h"
|
||||||
|
#include "libs/graphics/widgets.h"
|
||||||
#include "libs/sound/trackplayer.h"
|
#include "libs/sound/trackplayer.h"
|
||||||
|
|
||||||
#define CONFIRM_WIN_WIDTH 80
|
#define CONFIRM_WIN_WIDTH 80
|
||||||
@@ -28,45 +29,23 @@
|
|||||||
static void
|
static void
|
||||||
DrawConfirmationWindow (BOOLEAN answer)
|
DrawConfirmationWindow (BOOLEAN answer)
|
||||||
{
|
{
|
||||||
COLOR oldfg = SetContextForeGroundColor (MENU_BACKGROUND_COLOR);
|
COLOR oldfg = SetContextForeGroundColor (MENU_TEXT_COLOR);
|
||||||
|
COLOR dark, medium;
|
||||||
FONT oldfont = SetContextFont (StarConFont);
|
FONT oldfont = SetContextFont (StarConFont);
|
||||||
FONTEFFECT oldFontEffect = SetContextFontEffect (0, 0, 0);
|
FONTEFFECT oldFontEffect = SetContextFontEffect (0, 0, 0);
|
||||||
RECT r;
|
RECT r;
|
||||||
TEXT t;
|
TEXT t;
|
||||||
|
|
||||||
|
dark = BUILD_COLOR (MAKE_RGB15 (0x8, 0x8, 0x8), 0x1F);
|
||||||
|
medium = BUILD_COLOR (MAKE_RGB15 (0x10, 0x10, 0x10), 0x19);
|
||||||
|
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
|
|
||||||
r.corner.x = ((SCREEN_WIDTH - CONFIRM_WIN_WIDTH) >> 1) - 2;
|
|
||||||
r.corner.y = ((SCREEN_HEIGHT - CONFIRM_WIN_HEIGHT) >> 1) - 2;
|
|
||||||
r.extent.width = CONFIRM_WIN_WIDTH + 4;
|
|
||||||
r.extent.height = CONFIRM_WIN_HEIGHT + 4;
|
|
||||||
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x8, 0x8, 0x8), 0x1F));
|
|
||||||
DrawFilledRectangle (&r);
|
|
||||||
|
|
||||||
r.corner.x = ((SCREEN_WIDTH - CONFIRM_WIN_WIDTH) >> 1);
|
|
||||||
r.corner.y = ((SCREEN_HEIGHT - CONFIRM_WIN_HEIGHT) >> 1);
|
|
||||||
r.extent.width = CONFIRM_WIN_WIDTH + 2;
|
|
||||||
r.extent.height = CONFIRM_WIN_HEIGHT + 2;
|
|
||||||
SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x10, 0x10, 0x10), 0x19));
|
|
||||||
DrawFilledRectangle (&r);
|
|
||||||
|
|
||||||
r.corner.x = ((SCREEN_WIDTH - CONFIRM_WIN_WIDTH) >> 1) - 1;
|
|
||||||
r.corner.y = ((SCREEN_HEIGHT + CONFIRM_WIN_HEIGHT) >> 1) + 1;
|
|
||||||
r.extent.height = 1;
|
|
||||||
DrawFilledRectangle (&r);
|
|
||||||
|
|
||||||
r.corner.x = ((SCREEN_WIDTH + CONFIRM_WIN_WIDTH) >> 1) + 1;
|
|
||||||
r.corner.y = ((SCREEN_HEIGHT - CONFIRM_WIN_HEIGHT) >> 1) - 1;
|
|
||||||
r.extent.width = 1;
|
|
||||||
DrawFilledRectangle (&r);
|
|
||||||
|
|
||||||
r.corner.x = (SCREEN_WIDTH - CONFIRM_WIN_WIDTH) >> 1;
|
r.corner.x = (SCREEN_WIDTH - CONFIRM_WIN_WIDTH) >> 1;
|
||||||
r.corner.y = (SCREEN_HEIGHT - CONFIRM_WIN_HEIGHT) >> 1;
|
r.corner.y = (SCREEN_HEIGHT - CONFIRM_WIN_HEIGHT) >> 1;
|
||||||
r.extent.width = CONFIRM_WIN_WIDTH;
|
r.extent.width = CONFIRM_WIN_WIDTH;
|
||||||
r.extent.height = CONFIRM_WIN_HEIGHT;
|
r.extent.height = CONFIRM_WIN_HEIGHT;
|
||||||
SetContextForeGroundColor (MENU_BACKGROUND_COLOR);
|
DrawShadowedBox (&r, MENU_BACKGROUND_COLOR, dark, medium);
|
||||||
DrawFilledRectangle (&r);
|
|
||||||
|
|
||||||
SetContextForeGroundColor (MENU_TEXT_COLOR);
|
|
||||||
t.baseline.x = r.corner.x + (r.extent.width >> 1);
|
t.baseline.x = r.corner.x + (r.extent.width >> 1);
|
||||||
t.baseline.y = r.corner.y + 8;
|
t.baseline.y = r.corner.y + 8;
|
||||||
t.pStr = "Really Quit?";
|
t.pStr = "Really Quit?";
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
uqm_SUBDIRS="sdl"
|
uqm_SUBDIRS="sdl"
|
||||||
uqm_CFILES="boxint.c clipline.c cmap.c context.c drawable.c filegfx.c
|
uqm_CFILES="boxint.c clipline.c cmap.c context.c drawable.c filegfx.c
|
||||||
font.c frame.c gfx_common.c intersec.c loaddisp.c
|
font.c frame.c gfx_common.c intersec.c loaddisp.c
|
||||||
pixmap.c resgfx.c tfb_draw.c tfb_prim.c"
|
pixmap.c resgfx.c tfb_draw.c tfb_prim.c widgets.c"
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
#include "starcon.h"
|
||||||
|
#include "graphics/widgets.h"
|
||||||
|
|
||||||
|
void
|
||||||
|
DrawShadowedBox(PRECT r, COLOR bg, COLOR dark, COLOR medium)
|
||||||
|
{
|
||||||
|
RECT t;
|
||||||
|
COLOR oldcolor;
|
||||||
|
|
||||||
|
BatchGraphics ();
|
||||||
|
|
||||||
|
t.corner.x = r->corner.x - 2;
|
||||||
|
t.corner.y = r->corner.y - 2;
|
||||||
|
t.extent.width = r->extent.width + 4;
|
||||||
|
t.extent.height = r->extent.height + 4;
|
||||||
|
oldcolor = SetContextForeGroundColor (dark);
|
||||||
|
DrawFilledRectangle (&t);
|
||||||
|
|
||||||
|
t.corner.x += 2;
|
||||||
|
t.corner.y += 2;
|
||||||
|
t.extent.width -= 2;
|
||||||
|
t.extent.height -= 2;
|
||||||
|
SetContextForeGroundColor (medium);
|
||||||
|
DrawFilledRectangle (&t);
|
||||||
|
|
||||||
|
t.corner.x -= 1;
|
||||||
|
t.corner.y += r->extent.height + 1;
|
||||||
|
t.extent.height = 1;
|
||||||
|
DrawFilledRectangle (&t);
|
||||||
|
|
||||||
|
t.corner.x += r->extent.width + 2;
|
||||||
|
t.corner.y -= r->extent.height + 2;
|
||||||
|
t.extent.width = 1;
|
||||||
|
DrawFilledRectangle (&t);
|
||||||
|
|
||||||
|
SetContextForeGroundColor (bg);
|
||||||
|
DrawFilledRectangle (r);
|
||||||
|
|
||||||
|
SetContextForeGroundColor (oldcolor);
|
||||||
|
UnbatchGraphics ();
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
// Copyright Michael Martin, 2004.
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _WIDGETS_H
|
||||||
|
#define _WIDGETS_H
|
||||||
|
|
||||||
|
void DrawShadowedBox(PRECT r, COLOR bg, COLOR dark, COLOR medium);
|
||||||
|
|
||||||
|
#endif /* _WIDGETS_H */
|
||||||
Reference in New Issue
Block a user