Graphics lib cleanup: don't include stuff from uqm/, so things moved around
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3220 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -220,7 +220,7 @@ extern FRAME SetRelFrameIndex (FRAME Frame, SIZE FrameOffs);
|
||||
extern FRAME SetEquFrameIndex (FRAME DstFrame, FRAME SrcFrame);
|
||||
extern FRAME IncFrameIndex (FRAME Frame);
|
||||
extern FRAME DecFrameIndex (FRAME Frame);
|
||||
extern DRAWABLE RotateFrame (FRAME Frame, COUNT angle);
|
||||
extern DRAWABLE RotateFrame (FRAME Frame, int angle_deg);
|
||||
extern void SetFrameTransparentColor (FRAME Frame, COLOR c32k);
|
||||
|
||||
extern FRAME CaptureDrawable (DRAWABLE Drawable);
|
||||
|
||||
@@ -19,10 +19,12 @@
|
||||
#include "gfxintrn.h"
|
||||
#include "libs/misc.h"
|
||||
#include "tfb_draw.h"
|
||||
#include "libs/mathlib.h"
|
||||
#include "gfxother.h"
|
||||
// XXX: we should not include anything from uqm/ inside libs/
|
||||
#include "uqm/units.h"
|
||||
#include <math.h>
|
||||
|
||||
#ifndef M_PI
|
||||
# define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
FRAME _CurFramePtr;
|
||||
|
||||
@@ -197,13 +199,13 @@ GetFrameHot (FRAME FramePtr)
|
||||
}
|
||||
|
||||
DRAWABLE
|
||||
RotateFrame (FRAME Frame, COUNT angle)
|
||||
RotateFrame (FRAME Frame, int angle_deg)
|
||||
{
|
||||
DRAWABLE Drawable;
|
||||
FRAME RotFramePtr;
|
||||
SIZE dx, dy;
|
||||
SIZE d;
|
||||
COUNT organg;
|
||||
double dx, dy;
|
||||
double d;
|
||||
double angle = angle_deg * M_PI / 180;
|
||||
|
||||
Drawable = _request_drawable (1, RAM_DRAWABLE, WANT_PIXMAP, 0, 0);
|
||||
if (!Drawable)
|
||||
@@ -216,22 +218,22 @@ RotateFrame (FRAME Frame, COUNT angle)
|
||||
}
|
||||
|
||||
RotFramePtr->image = TFB_DrawImage_New_Rotated (
|
||||
Frame->image, -ANGLE_TO_DEGREES (angle));
|
||||
Frame->image, angle_deg);
|
||||
SetFrameBounds (RotFramePtr, RotFramePtr->image->extent.width,
|
||||
RotFramePtr->image->extent.height);
|
||||
|
||||
/* now we need to rotate the hot-spot, eww */
|
||||
dx = Frame->HotSpot.x - (GetFrameWidth (Frame) / 2);
|
||||
dy = Frame->HotSpot.y - (GetFrameHeight (Frame) / 2);
|
||||
d = square_root ((long)dx*dx + (long)dy*dy);
|
||||
if (d != 0)
|
||||
d = sqrt ((double)dx*dx + (double)dy*dy);
|
||||
if ((int)d != 0)
|
||||
{
|
||||
organg = ARCTAN (dx, dy);
|
||||
dx = COSINE (organg + angle, d);
|
||||
dy = SINE (organg + angle, d);
|
||||
double organg = atan2 (-dy, dx);
|
||||
dx = cos (organg + angle) * d;
|
||||
dy = -sin (organg + angle) * d;
|
||||
}
|
||||
RotFramePtr->HotSpot.x = (GetFrameWidth (RotFramePtr) / 2) + dx;
|
||||
RotFramePtr->HotSpot.y = (GetFrameHeight (RotFramePtr) / 2) + dy;
|
||||
RotFramePtr->HotSpot.x = (GetFrameWidth (RotFramePtr) / 2) + (int)dx;
|
||||
RotFramePtr->HotSpot.y = (GetFrameHeight (RotFramePtr) / 2) + (int)dy;
|
||||
|
||||
ReleaseDrawable (RotFramePtr);
|
||||
|
||||
|
||||
@@ -24,9 +24,6 @@
|
||||
extern void FixContextFontEffect (void);
|
||||
static inline TFB_Char *getCharFrame (FONT_DESC *fontPtr, wchar_t ch);
|
||||
|
||||
static BYTE char_delta_array[MAX_DELTAS];
|
||||
// XXX: This does not seem to be used.
|
||||
|
||||
|
||||
FONT
|
||||
SetContextFont (FONT Font)
|
||||
@@ -115,6 +112,7 @@ GetContextFontLeadingWidth (SIZE *pwidth)
|
||||
BOOLEAN
|
||||
TextRect (TEXT *lpText, RECT *pRect, BYTE *pdelta)
|
||||
{
|
||||
BYTE char_delta_array[MAX_DELTAS];
|
||||
FONT FontPtr;
|
||||
|
||||
FontPtr = _CurFontPtr;
|
||||
|
||||
@@ -16,8 +16,7 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "libs/graphics/gfxintrn.h"
|
||||
#include "libs/input/inpintrn.h"
|
||||
#include "gfxintrn.h"
|
||||
#include "libs/graphics/gfx_common.h"
|
||||
#include "libs/graphics/drawcmd.h"
|
||||
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
#include "primitives.h"
|
||||
#include "libs/graphics/drawcmd.h"
|
||||
#include "libs/graphics/tfb_draw.h"
|
||||
// XXX: we should not include anything from uqm/ inside libs/
|
||||
#include "uqm/units.h"
|
||||
|
||||
|
||||
int batch_depth = 0;
|
||||
@@ -109,15 +107,15 @@ ExpandRect (RECT *rect, int expansion)
|
||||
rect->corner.y = 0;
|
||||
}
|
||||
|
||||
if (rect->corner.x + rect->extent.width + expansion <= SCREEN_WIDTH)
|
||||
if (rect->corner.x + rect->extent.width + expansion <= ScreenWidth)
|
||||
rect->extent.width += expansion;
|
||||
else
|
||||
rect->extent.width = SCREEN_WIDTH - rect->corner.x;
|
||||
rect->extent.width = ScreenWidth - rect->corner.x;
|
||||
|
||||
if (rect->corner.y + rect->extent.height + expansion <= SCREEN_HEIGHT)
|
||||
if (rect->corner.y + rect->extent.height + expansion <= ScreenHeight)
|
||||
rect->extent.height += expansion;
|
||||
else
|
||||
rect->extent.height = SCREEN_HEIGHT - rect->corner.y;
|
||||
rect->extent.height = ScreenHeight - rect->corner.y;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -26,15 +26,13 @@
|
||||
#include "options.h"
|
||||
#include "uqmversion.h"
|
||||
#include "libs/graphics/drawcmd.h"
|
||||
#include "libs/input/sdl/vcontrol.h"
|
||||
#include "libs/input/sdl/input.h"
|
||||
// for ProcessInputEvent()
|
||||
#include "bbox.h"
|
||||
#include "port.h"
|
||||
#include "libs/uio.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/vidlib.h"
|
||||
// XXX: we should not include anything from uqm/ inside libs/
|
||||
#include "uqm/controls.h"
|
||||
#include "uqm/uqmdebug.h"
|
||||
#include SDL_INCLUDE(SDL_thread.h)
|
||||
|
||||
SDL_Surface *SDL_Video;
|
||||
@@ -216,29 +214,6 @@ TFB_ProcessEvents ()
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ImmediateInputState.menu[KEY_ABORT])
|
||||
{
|
||||
log_showBox (false, false);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if (ImmediateInputState.menu[KEY_FULLSCREEN])
|
||||
{
|
||||
int flags = GfxFlags ^ TFB_GFXFLAGS_FULLSCREEN;
|
||||
FlushInput ();
|
||||
TFB_ReInitGraphics (GraphicsDriver, flags, ScreenWidthActual,
|
||||
ScreenHeightActual);
|
||||
TFB_SwapBuffers (TFB_REDRAW_YES);
|
||||
}
|
||||
|
||||
#if defined(DEBUG) || defined(USE_DEBUG_KEY)
|
||||
if (ImmediateInputState.menu[KEY_DEBUG])
|
||||
{
|
||||
FlushInput ();
|
||||
debugKeyPressed ();
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
|
||||
static BOOLEAN system_box_active = 0;
|
||||
@@ -900,6 +875,7 @@ TFB_FlushGraphics (void) // Only call from main thread!!
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
TFB_SwapBuffers (TFB_REDRAW_YES);
|
||||
break;
|
||||
}
|
||||
case TFB_DRAWCOMMANDTYPE_CALLBACK:
|
||||
|
||||
@@ -24,12 +24,9 @@
|
||||
#include SDL_INCLUDE(SDL_byteorder.h)
|
||||
#include SDL_IMAGE_INCLUDE(SDL_image.h)
|
||||
|
||||
#include "libs/graphics/gfxintrn.h"
|
||||
#include "../gfxintrn.h"
|
||||
#include "libs/graphics/tfb_draw.h"
|
||||
#include "libs/input/inpintrn.h"
|
||||
#include "libs/graphics/gfx_common.h"
|
||||
#include "libs/input/sdl/input.h"
|
||||
#include "libs/threadlib.h"
|
||||
|
||||
// The Graphics Backend vtable
|
||||
typedef struct _tfb_graphics_backend {
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
#include "tfb_draw.h"
|
||||
#include "drawcmd.h"
|
||||
#include "libs/log.h"
|
||||
// XXX: we should not include anything from uqm/ inside libs/
|
||||
#include "uqm/units.h"
|
||||
|
||||
static const HOT_SPOT NullHs = {0, 0};
|
||||
|
||||
@@ -51,8 +49,8 @@ TFB_DrawScreen_Rect (RECT *rect, int r, int g, int b, SCREEN dest)
|
||||
if (!rect)
|
||||
{
|
||||
locRect.corner.x = locRect.corner.y = 0;
|
||||
locRect.extent.width = SCREEN_WIDTH;
|
||||
locRect.extent.height = SCREEN_HEIGHT;
|
||||
locRect.extent.width = ScreenWidth;
|
||||
locRect.extent.height = ScreenHeight;
|
||||
rect = &locRect;
|
||||
}
|
||||
|
||||
@@ -143,8 +141,8 @@ TFB_DrawScreen_Copy (RECT *r, SCREEN src, SCREEN dest)
|
||||
if (!r)
|
||||
{
|
||||
locRect.corner.x = locRect.corner.y = 0;
|
||||
locRect.extent.width = SCREEN_WIDTH;
|
||||
locRect.extent.height = SCREEN_HEIGHT;
|
||||
locRect.extent.width = ScreenWidth;
|
||||
locRect.extent.height = ScreenHeight;
|
||||
r = &locRect;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,10 +17,6 @@
|
||||
#include "gfx_common.h"
|
||||
#include "widgets.h"
|
||||
#include "libs/strlib.h"
|
||||
// XXX: we should not include anything from uqm/ inside libs/
|
||||
#include "uqm/colors.h"
|
||||
#include "uqm/setup.h"
|
||||
#include "uqm/units.h"
|
||||
|
||||
WIDGET *widget_focus = NULL;
|
||||
|
||||
@@ -38,6 +34,12 @@ WIDGET *widget_focus = NULL;
|
||||
#define WIDGET_DIALOG_TEXT_COLOR \
|
||||
BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x00), 0x00)
|
||||
|
||||
static COLOR win_bg_clr = BUILD_COLOR (MAKE_RGB15 (0x18, 0x18, 0x1F), 0x00);
|
||||
static COLOR win_medium_clr = BUILD_COLOR (MAKE_RGB15 (0x10, 0x10, 0x18), 0x00);
|
||||
static COLOR win_dark_clr = BUILD_COLOR (MAKE_RGB15 (0x08, 0x08, 0x10), 0x00);
|
||||
|
||||
static FONT cur_font;
|
||||
|
||||
void
|
||||
DrawShadowedBox (RECT *r, COLOR bg, COLOR dark, COLOR medium)
|
||||
{
|
||||
@@ -78,15 +80,18 @@ DrawShadowedBox (RECT *r, COLOR bg, COLOR dark, COLOR medium)
|
||||
}
|
||||
|
||||
void
|
||||
DrawLabelAsWindow(WIDGET_LABEL *label)
|
||||
DrawLabelAsWindow (WIDGET_LABEL *label)
|
||||
{
|
||||
COLOR oldfg = SetContextForeGroundColor (WIDGET_DIALOG_TEXT_COLOR);
|
||||
FONT oldfont = SetContextFont (StarConFont);
|
||||
FONT oldfont = 0;
|
||||
FRAME oldFontEffect = SetContextFontEffect (NULL);
|
||||
RECT r;
|
||||
TEXT t;
|
||||
int i, win_w, win_h;
|
||||
|
||||
if (cur_font)
|
||||
oldfont = SetContextFont (cur_font);
|
||||
|
||||
/* Compute the dimensions of the label */
|
||||
win_h = label->height ((WIDGET *)label) + 16;
|
||||
win_w = 0;
|
||||
@@ -101,12 +106,11 @@ DrawLabelAsWindow(WIDGET_LABEL *label)
|
||||
win_w = (win_w * 6) + 16;
|
||||
|
||||
BatchGraphics ();
|
||||
r.corner.x = (SCREEN_WIDTH - win_w) >> 1;
|
||||
r.corner.y = (SCREEN_HEIGHT - win_h) >> 1;
|
||||
r.corner.x = (ScreenWidth - win_w) >> 1;
|
||||
r.corner.y = (ScreenHeight - win_h) >> 1;
|
||||
r.extent.width = win_w;
|
||||
r.extent.height = win_h;
|
||||
DrawShadowedBox (&r, SHADOWBOX_BACKGROUND_COLOR,
|
||||
SHADOWBOX_DARK_COLOR, SHADOWBOX_MEDIUM_COLOR);
|
||||
DrawShadowedBox (&r, win_bg_clr, win_dark_clr, win_medium_clr);
|
||||
|
||||
t.baseline.x = r.corner.x + (r.extent.width >> 1);
|
||||
t.baseline.y = r.corner.y + 16;
|
||||
@@ -122,24 +126,44 @@ DrawLabelAsWindow(WIDGET_LABEL *label)
|
||||
UnbatchGraphics ();
|
||||
|
||||
SetContextFontEffect (oldFontEffect);
|
||||
SetContextFont (oldfont);
|
||||
if (oldfont)
|
||||
SetContextFont (oldfont);
|
||||
SetContextForeGroundColor (oldfg);
|
||||
}
|
||||
|
||||
void
|
||||
Widget_SetWindowColors (COLOR bg, COLOR dark, COLOR medium)
|
||||
{
|
||||
win_bg_clr = bg;
|
||||
win_dark_clr = dark;
|
||||
win_medium_clr = medium;
|
||||
}
|
||||
|
||||
FONT
|
||||
Widget_SetFont (FONT newFont)
|
||||
{
|
||||
FONT oldFont = cur_font;
|
||||
cur_font = newFont;
|
||||
return oldFont;
|
||||
}
|
||||
|
||||
static void
|
||||
Widget_DrawToolTips (int numlines, const char **tips)
|
||||
{
|
||||
RECT r;
|
||||
FONT oldfont = SetContextFont (StarConFont);
|
||||
FONT oldfont = 0;
|
||||
FRAME oldFontEffect = SetContextFontEffect (NULL);
|
||||
COLOR oldtext = SetContextForeGroundColor (WIDGET_INACTIVE_SELECTED_COLOR);
|
||||
TEXT t;
|
||||
int i;
|
||||
|
||||
if (cur_font)
|
||||
oldfont = SetContextFont (cur_font);
|
||||
|
||||
r.corner.x = 2;
|
||||
r.corner.y = 2;
|
||||
r.extent.width = SCREEN_WIDTH - 4;
|
||||
r.extent.height = SCREEN_HEIGHT - 4;
|
||||
r.extent.width = ScreenWidth - 4;
|
||||
r.extent.height = ScreenHeight - 4;
|
||||
|
||||
t.align = ALIGN_CENTER;
|
||||
t.CharCount = ~0;
|
||||
@@ -154,7 +178,8 @@ Widget_DrawToolTips (int numlines, const char **tips)
|
||||
}
|
||||
|
||||
SetContextFontEffect (oldFontEffect);
|
||||
SetContextFont (oldfont);
|
||||
if (oldfont)
|
||||
SetContextFont (oldfont);
|
||||
SetContextForeGroundColor (oldtext);
|
||||
}
|
||||
|
||||
@@ -164,17 +189,20 @@ Widget_DrawMenuScreen (WIDGET *_self, int x, int y)
|
||||
RECT r;
|
||||
COLOR title, oldtext;
|
||||
COLOR inactive, default_color, selected;
|
||||
FONT oldfont = SetContextFont (StarConFont);
|
||||
FONT oldfont = 0;
|
||||
FRAME oldFontEffect = SetContextFontEffect (NULL);
|
||||
TEXT t;
|
||||
int widget_index, height, widget_y;
|
||||
|
||||
WIDGET_MENU_SCREEN *self = (WIDGET_MENU_SCREEN *)_self;
|
||||
|
||||
if (cur_font)
|
||||
oldfont = SetContextFont (cur_font);
|
||||
|
||||
r.corner.x = 2;
|
||||
r.corner.y = 2;
|
||||
r.extent.width = SCREEN_WIDTH - 4;
|
||||
r.extent.height = SCREEN_HEIGHT - 4;
|
||||
r.extent.width = ScreenWidth - 4;
|
||||
r.extent.height = ScreenHeight - 4;
|
||||
|
||||
title = WIDGET_INACTIVE_SELECTED_COLOR;
|
||||
selected = WIDGET_ACTIVE_COLOR;
|
||||
@@ -204,7 +232,7 @@ Widget_DrawMenuScreen (WIDGET *_self, int x, int y)
|
||||
|
||||
height -= 8;
|
||||
|
||||
widget_y = (SCREEN_HEIGHT - height) >> 1;
|
||||
widget_y = (ScreenHeight - height) >> 1;
|
||||
for (widget_index = 0; widget_index < self->num_children; widget_index++)
|
||||
{
|
||||
WIDGET *c = self->child[widget_index];
|
||||
@@ -213,7 +241,8 @@ Widget_DrawMenuScreen (WIDGET *_self, int x, int y)
|
||||
}
|
||||
|
||||
SetContextFontEffect (oldFontEffect);
|
||||
SetContextFont (oldfont);
|
||||
if (oldfont)
|
||||
SetContextFont (oldfont);
|
||||
SetContextForeGroundColor (oldtext);
|
||||
|
||||
(void) x;
|
||||
@@ -226,10 +255,13 @@ Widget_DrawChoice (WIDGET *_self, int x, int y)
|
||||
WIDGET_CHOICE *self = (WIDGET_CHOICE *)_self;
|
||||
COLOR oldtext;
|
||||
COLOR inactive, default_color, selected;
|
||||
FONT oldfont = SetContextFont (StarConFont);
|
||||
FONT oldfont = 0;
|
||||
FRAME oldFontEffect = SetContextFontEffect (NULL);
|
||||
TEXT t;
|
||||
int i, home_x, home_y;
|
||||
|
||||
if (cur_font)
|
||||
oldfont = SetContextFont (cur_font);
|
||||
|
||||
default_color = WIDGET_INACTIVE_SELECTED_COLOR;
|
||||
selected = WIDGET_ACTIVE_COLOR;
|
||||
@@ -250,12 +282,12 @@ Widget_DrawChoice (WIDGET *_self, int x, int y)
|
||||
}
|
||||
font_DrawText (&t);
|
||||
|
||||
home_x = t.baseline.x + 3 * (SCREEN_WIDTH / ((self->maxcolumns + 1) * 2));
|
||||
home_x = t.baseline.x + 3 * (ScreenWidth / ((self->maxcolumns + 1) * 2));
|
||||
home_y = t.baseline.y;
|
||||
t.align = ALIGN_CENTER;
|
||||
for (i = 0; i < self->numopts; i++)
|
||||
{
|
||||
t.baseline.x = home_x + ((i % 3) * (SCREEN_WIDTH / (self->maxcolumns + 1)));
|
||||
t.baseline.x = home_x + ((i % 3) * (ScreenWidth / (self->maxcolumns + 1)));
|
||||
t.baseline.y = home_y + (8 * (i / 3));
|
||||
t.pStr = self->options[i].optname;
|
||||
if ((widget_focus == _self) &&
|
||||
@@ -275,7 +307,8 @@ Widget_DrawChoice (WIDGET *_self, int x, int y)
|
||||
font_DrawText (&t);
|
||||
}
|
||||
SetContextFontEffect (oldFontEffect);
|
||||
SetContextFont (oldfont);
|
||||
if (oldfont)
|
||||
SetContextFont (oldfont);
|
||||
SetContextForeGroundColor (oldtext);
|
||||
}
|
||||
|
||||
@@ -285,9 +318,12 @@ Widget_DrawButton (WIDGET *_self, int x, int y)
|
||||
WIDGET_BUTTON *self = (WIDGET_BUTTON *)_self;
|
||||
COLOR oldtext;
|
||||
COLOR inactive, selected;
|
||||
FONT oldfont = SetContextFont (StarConFont);
|
||||
FONT oldfont = 0;
|
||||
FRAME oldFontEffect = SetContextFontEffect (NULL);
|
||||
TEXT t;
|
||||
|
||||
if (cur_font)
|
||||
oldfont = SetContextFont (cur_font);
|
||||
|
||||
selected = WIDGET_ACTIVE_COLOR;
|
||||
inactive = WIDGET_INACTIVE_COLOR;
|
||||
@@ -308,7 +344,8 @@ Widget_DrawButton (WIDGET *_self, int x, int y)
|
||||
}
|
||||
font_DrawText (&t);
|
||||
SetContextFontEffect (oldFontEffect);
|
||||
SetContextFont (oldfont);
|
||||
if (oldfont)
|
||||
SetContextFont (oldfont);
|
||||
SetContextForeGroundColor (oldtext);
|
||||
(void) x;
|
||||
}
|
||||
@@ -318,10 +355,13 @@ Widget_DrawLabel (WIDGET *_self, int x, int y)
|
||||
{
|
||||
WIDGET_LABEL *self = (WIDGET_LABEL *)_self;
|
||||
COLOR oldtext = SetContextForeGroundColor (WIDGET_INACTIVE_SELECTED_COLOR);
|
||||
FONT oldfont = SetContextFont (StarConFont);
|
||||
FONT oldfont = 0;
|
||||
FRAME oldFontEffect = SetContextFontEffect (NULL);
|
||||
TEXT t;
|
||||
int i;
|
||||
|
||||
if (cur_font)
|
||||
oldfont = SetContextFont (cur_font);
|
||||
|
||||
t.baseline.x = 160;
|
||||
t.baseline.y = y;
|
||||
@@ -335,7 +375,8 @@ Widget_DrawLabel (WIDGET *_self, int x, int y)
|
||||
t.baseline.y += 8;
|
||||
}
|
||||
SetContextFontEffect (oldFontEffect);
|
||||
SetContextFont (oldfont);
|
||||
if (oldfont)
|
||||
SetContextFont (oldfont);
|
||||
SetContextForeGroundColor (oldtext);
|
||||
(void) x;
|
||||
}
|
||||
@@ -346,11 +387,14 @@ Widget_DrawSlider(WIDGET *_self, int x, int y)
|
||||
WIDGET_SLIDER *self = (WIDGET_SLIDER *)_self;
|
||||
COLOR oldtext;
|
||||
COLOR inactive, default_color, selected;
|
||||
FONT oldfont = SetContextFont (StarConFont);
|
||||
FONT oldfont = 0;
|
||||
FRAME oldFontEffect = SetContextFontEffect (NULL);
|
||||
TEXT t;
|
||||
RECT r;
|
||||
int tick = (SCREEN_WIDTH - x) / 8;
|
||||
int tick = (ScreenWidth - x) / 8;
|
||||
|
||||
if (cur_font)
|
||||
oldfont = SetContextFont (cur_font);
|
||||
|
||||
default_color = WIDGET_INACTIVE_SELECTED_COLOR;
|
||||
selected = WIDGET_ACTIVE_COLOR;
|
||||
@@ -388,7 +432,8 @@ Widget_DrawSlider(WIDGET *_self, int x, int y)
|
||||
(*self->draw_value)(self, t.baseline.x + 7 * tick, t.baseline.y);
|
||||
|
||||
SetContextFontEffect (oldFontEffect);
|
||||
SetContextFont (oldfont);
|
||||
if (oldfont)
|
||||
SetContextFont (oldfont);
|
||||
SetContextForeGroundColor (oldtext);
|
||||
}
|
||||
|
||||
@@ -415,9 +460,12 @@ Widget_DrawTextEntry (WIDGET *_self, int x, int y)
|
||||
WIDGET_TEXTENTRY *self = (WIDGET_TEXTENTRY *)_self;
|
||||
COLOR oldtext;
|
||||
COLOR inactive, default_color, selected;
|
||||
FONT oldfont = SetContextFont (StarConFont);
|
||||
FONT oldfont = 0;
|
||||
FRAME oldFontEffect = SetContextFontEffect (NULL);
|
||||
TEXT t;
|
||||
|
||||
if (cur_font)
|
||||
oldfont = SetContextFont (cur_font);
|
||||
|
||||
default_color = WIDGET_INACTIVE_SELECTED_COLOR;
|
||||
selected = WIDGET_ACTIVE_COLOR;
|
||||
@@ -538,7 +586,8 @@ Widget_DrawTextEntry (WIDGET *_self, int x, int y)
|
||||
|
||||
UnbatchGraphics ();
|
||||
SetContextFontEffect (oldFontEffect);
|
||||
SetContextFont (oldfont);
|
||||
if (oldfont)
|
||||
SetContextFont (oldfont);
|
||||
SetContextForeGroundColor (oldtext);
|
||||
}
|
||||
|
||||
@@ -548,10 +597,13 @@ Widget_DrawControlEntry (WIDGET *_self, int x, int y)
|
||||
WIDGET_CONTROLENTRY *self = (WIDGET_CONTROLENTRY *)_self;
|
||||
COLOR oldtext;
|
||||
COLOR inactive, default_color, selected;
|
||||
FONT oldfont = SetContextFont (StarConFont);
|
||||
FONT oldfont = 0;
|
||||
FRAME oldFontEffect = SetContextFontEffect (NULL);
|
||||
TEXT t;
|
||||
int i, home_x, home_y;
|
||||
|
||||
if (cur_font)
|
||||
oldfont = SetContextFont (cur_font);
|
||||
|
||||
default_color = WIDGET_INACTIVE_SELECTED_COLOR;
|
||||
selected = WIDGET_ACTIVE_COLOR;
|
||||
@@ -572,13 +624,13 @@ Widget_DrawControlEntry (WIDGET *_self, int x, int y)
|
||||
}
|
||||
font_DrawText (&t);
|
||||
|
||||
// 3 * SCREEN_WIDTH / ((self->maxcolumns + 1) * 2)) as per CHOICE, but only two options.
|
||||
home_x = t.baseline.x + (SCREEN_WIDTH / 2);
|
||||
// 3 * ScreenWidth / ((self->maxcolumns + 1) * 2)) as per CHOICE, but only two options.
|
||||
home_x = t.baseline.x + (ScreenWidth / 2);
|
||||
home_y = t.baseline.y;
|
||||
t.align = ALIGN_CENTER;
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
t.baseline.x = home_x + ((i % 3) * (SCREEN_WIDTH / 3)); // self->maxcolumns + 1 as per CHOICE.
|
||||
t.baseline.x = home_x + ((i % 3) * (ScreenWidth / 3)); // self->maxcolumns + 1 as per CHOICE.
|
||||
t.baseline.y = home_y + (8 * (i / 3));
|
||||
t.pStr = self->controlname[i];
|
||||
if (!t.pStr[0])
|
||||
@@ -597,7 +649,8 @@ Widget_DrawControlEntry (WIDGET *_self, int x, int y)
|
||||
font_DrawText (&t);
|
||||
}
|
||||
SetContextFontEffect (oldFontEffect);
|
||||
SetContextFont (oldfont);
|
||||
if (oldfont)
|
||||
SetContextFont (oldfont);
|
||||
SetContextForeGroundColor (oldtext);
|
||||
}
|
||||
|
||||
@@ -611,7 +664,7 @@ int
|
||||
Widget_HeightFullScreen (WIDGET *_self)
|
||||
{
|
||||
(void)_self;
|
||||
return SCREEN_HEIGHT;
|
||||
return ScreenHeight;
|
||||
}
|
||||
|
||||
int
|
||||
@@ -632,7 +685,7 @@ int
|
||||
Widget_WidthFullScreen (WIDGET *_self)
|
||||
{
|
||||
(void)_self;
|
||||
return SCREEN_WIDTH;
|
||||
return ScreenWidth;
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
@@ -176,7 +176,10 @@ typedef struct _widget_controlentry {
|
||||
} WIDGET_CONTROLENTRY;
|
||||
|
||||
void DrawShadowedBox (RECT *r, COLOR bg, COLOR dark, COLOR medium);
|
||||
void DrawLabelAsWindow(WIDGET_LABEL *label);
|
||||
void DrawLabelAsWindow (WIDGET_LABEL *label);
|
||||
void Widget_SetWindowColors (COLOR bg, COLOR dark, COLOR medium);
|
||||
FONT Widget_SetFont (FONT newFont);
|
||||
|
||||
|
||||
int Widget_Event (int event);
|
||||
|
||||
|
||||
@@ -495,6 +495,7 @@ main (int argc, char *argv[])
|
||||
}
|
||||
|
||||
TFB_ProcessEvents ();
|
||||
ProcessUtilityKeys ();
|
||||
ProcessThreadLifecycles ();
|
||||
TFB_FlushGraphics ();
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ DoPopup (struct popup_state *self)
|
||||
}
|
||||
|
||||
void
|
||||
DoPopupWindow(const char *msg)
|
||||
DoPopupWindow (const char *msg)
|
||||
{
|
||||
stringbank *bank = StringBank_Create ();
|
||||
const char *lines[30];
|
||||
@@ -253,6 +253,9 @@ DoPopupWindow(const char *msg)
|
||||
s.origin = r.corner;
|
||||
s.frame = F;
|
||||
|
||||
Widget_SetFont (StarConFont);
|
||||
Widget_SetWindowColors (SHADOWBOX_BACKGROUND_COLOR, SHADOWBOX_DARK_COLOR,
|
||||
SHADOWBOX_MEDIUM_COLOR);
|
||||
DrawLabelAsWindow (&label);
|
||||
|
||||
GetMenuSounds (&s0, &s1);
|
||||
|
||||
+1
-1
@@ -634,7 +634,7 @@ DoPresentation (void *pIS)
|
||||
{
|
||||
DestroyDrawable (ReleaseDrawable (pPIS->RotatedFrame));
|
||||
pPIS->RotatedFrame = CaptureDrawable (
|
||||
RotateFrame (s.frame, DEGREES_TO_ANGLE (angle)));
|
||||
RotateFrame (s.frame, -angle));
|
||||
pPIS->LastAngle = angle;
|
||||
pPIS->LastDrawKind = draw_what;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "options.h"
|
||||
#include "setup.h"
|
||||
#include "sounds.h"
|
||||
#include "colors.h"
|
||||
#include "libs/gfxlib.h"
|
||||
#include "libs/graphics/gfx_common.h"
|
||||
#include "libs/graphics/widgets.h"
|
||||
@@ -434,6 +435,9 @@ DoSetupMenu (SETUP_MENU_STATE *pInputState)
|
||||
SetDefaultMenuRepeatDelay ();
|
||||
pInputState->NextTime = GetTimeCounter ();
|
||||
SetDefaults ();
|
||||
Widget_SetFont (StarConFont);
|
||||
Widget_SetWindowColors (SHADOWBOX_BACKGROUND_COLOR,
|
||||
SHADOWBOX_DARK_COLOR, SHADOWBOX_MEDIUM_COLOR);
|
||||
|
||||
current = NULL;
|
||||
next = (WIDGET *)(&menus[0]);
|
||||
|
||||
@@ -35,6 +35,9 @@
|
||||
#include "uqmdebug.h"
|
||||
#include "libs/tasklib.h"
|
||||
#include "libs/log.h"
|
||||
#include "libs/gfxlib.h"
|
||||
#include "libs/graphics/gfx_common.h"
|
||||
#include "libs/inplib.h"
|
||||
|
||||
#include "uqmversion.h"
|
||||
#include "options.h"
|
||||
@@ -105,6 +108,34 @@ SignalStopMainThread (void)
|
||||
GLOBAL (CurrentActivity) |= CHECK_ABORT;
|
||||
}
|
||||
|
||||
void
|
||||
ProcessUtilityKeys (void)
|
||||
{
|
||||
if (ImmediateInputState.menu[KEY_ABORT])
|
||||
{
|
||||
log_showBox (false, false);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if (ImmediateInputState.menu[KEY_FULLSCREEN])
|
||||
{
|
||||
int flags = GfxFlags ^ TFB_GFXFLAGS_FULLSCREEN;
|
||||
// clear ImmediateInputState so we don't repeat this next frame
|
||||
FlushInput ();
|
||||
TFB_DrawScreen_ReinitVideo (GraphicsDriver, flags, ScreenWidthActual,
|
||||
ScreenHeightActual);
|
||||
}
|
||||
|
||||
#if defined(DEBUG) || defined(USE_DEBUG_KEY)
|
||||
if (ImmediateInputState.menu[KEY_DEBUG])
|
||||
{
|
||||
// clear ImmediateInputState so we don't repeat this next frame
|
||||
FlushInput ();
|
||||
debugKeyPressed ();
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
|
||||
/* TODO: Remove these declarations once threading is gone. */
|
||||
extern int snddriver, soundflags;
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
extern volatile int MainExited;
|
||||
extern void SignalStopMainThread (void);
|
||||
extern void ProcessUtilityKeys (void);
|
||||
|
||||
extern int Starcon2Main (void *threadArg);
|
||||
extern void FreeGameData (void);
|
||||
|
||||
Reference in New Issue
Block a user