Skip to content

Commit

Permalink
Cleanup|Client: Removed obsolete UI drawing routines and unused fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Feb 6, 2017
1 parent 7534207 commit c70107e
Show file tree
Hide file tree
Showing 18 changed files with 52 additions and 49 deletions.
Binary file removed doomsday/apps/client/data/fonts/normal12.dfn
Binary file not shown.
Binary file removed doomsday/apps/client/data/fonts/normal18.dfn
Binary file not shown.
Binary file removed doomsday/apps/client/data/fonts/normal24.dfn
Binary file not shown.
Binary file removed doomsday/apps/client/data/fonts/normalbold12.dfn
Binary file not shown.
Binary file removed doomsday/apps/client/data/fonts/normalbold18.dfn
Binary file not shown.
Binary file removed doomsday/apps/client/data/fonts/normalbold24.dfn
Binary file not shown.
Binary file removed doomsday/apps/client/data/fonts/normallight12.dfn
Binary file not shown.
Binary file removed doomsday/apps/client/data/fonts/normallight18.dfn
Binary file not shown.
Binary file removed doomsday/apps/client/data/fonts/normallight24.dfn
Binary file not shown.
Binary file removed doomsday/apps/client/data/graphics/boxcorner.png
Binary file not shown.
Binary file removed doomsday/apps/client/data/graphics/boxfill.png
Binary file not shown.
Binary file removed doomsday/apps/client/data/graphics/boxshade.png
Binary file not shown.
32 changes: 17 additions & 15 deletions doomsday/apps/client/include/ui/ui_main.h
Expand Up @@ -28,18 +28,19 @@
# include "MaterialVariantSpec"
#endif

enum fontstyle_t {
/*enum fontstyle_t {
FS_NORMAL,
FS_BOLD,
FS_LIGHT,
FONTSTYLE_COUNT
};
};*/

/// Numeric identifiers of predefined colors.
/// @ingroup infine
enum {
UIC_TEXT,
UIC_TITLE,
/*
UIC_SHADOW,
UIC_BG_LIGHT,
UIC_BG_MEDIUM,
Expand All @@ -48,39 +49,40 @@ enum {
UIC_BRD_MED,
UIC_BRD_LOW,
UIC_HELP,
*/
NUM_UI_COLORS
};

/// Standard dimensions.
#define UI_WIDTH (1000.0f)
#define UI_HEIGHT (1000.0f)
#define UI_BORDER (UI_WIDTH/120) /// All borders are this wide.
//#define UI_BORDER (UI_WIDTH/120) /// All borders are this wide.
#define UI_SHADOW_OFFSET (MIN_OF(3, UI_WIDTH/320))
#define UI_SHADOW_STRENGTH (.6f)
#define UI_BUTTON_BORDER (UI_BORDER)
#define UI_BAR_WDH (UI_BORDER * 3)
#define UI_BAR_BORDER (UI_BORDER / 2)
#define UI_BAR_BUTTON_BORDER (3 * UI_BAR_BORDER / 2)
//#define UI_BUTTON_BORDER (UI_BORDER)
//#define UI_BAR_WDH (UI_BORDER * 3)
//#define UI_BAR_BORDER (UI_BORDER / 2)
//#define UI_BAR_BUTTON_BORDER (3 * UI_BAR_BORDER / 2)
#define UI_MAX_COLUMNS 10 /// Maximum columns for list box.

typedef struct {
float red, green, blue;
} ui_color_t;

DENG_EXTERN_C fontid_t fontFixed, fontVariable[FONTSTYLE_COUNT];
DENG_EXTERN_C fontid_t fontFixed; //, fontVariable[FONTSTYLE_COUNT];

void UI_Register(void);
//void UI_Register(void);

void UI_LoadFonts(void);

char const *UI_ChooseFixedFont(void);
char const *UI_ChooseVariableFont(fontstyle_t style);
//char const *UI_ChooseVariableFont(fontstyle_t style);

/// @param id Id number of the color to return e.g. "UIC_TEXT".
ui_color_t* UI_Color(uint id);

/// @return Height of the current UI font.
int UI_FontHeight(void);
//int UI_FontHeight(void);

/**
* Background with the "The Doomsday Engine" text superimposed.
Expand All @@ -94,14 +96,14 @@ void UI_DrawDDBackground(Point2Raw const &origin, Size2Raw const &size, float al
void UI_MixColors(ui_color_t* a, ui_color_t* b, ui_color_t* dest, float amount);
void UI_SetColorA(ui_color_t* color, float alpha);
void UI_SetColor(ui_color_t* color);
void UI_Gradient(const Point2Raw* origin, const Size2Raw* size, ui_color_t* top, ui_color_t* bottom, float topAlpha, float bottomAlpha);
void UI_GradientEx(const Point2Raw* origin, const Size2Raw* size, int border, ui_color_t* top, ui_color_t* bottom, float topAlpha, float bottomAlpha);
void UI_DrawRectEx(const Point2Raw* origin, const Size2Raw* size, int brd, dd_bool filled, ui_color_t* top, ui_color_t* bottom, float alpha, float bottomAlpha);
//void UI_Gradient(const Point2Raw* origin, const Size2Raw* size, ui_color_t* top, ui_color_t* bottom, float topAlpha, float bottomAlpha);
//void UI_GradientEx(const Point2Raw* origin, const Size2Raw* size, int border, ui_color_t* top, ui_color_t* bottom, float topAlpha, float bottomAlpha);
//void UI_DrawRectEx(const Point2Raw* origin, const Size2Raw* size, int brd, dd_bool filled, ui_color_t* top, ui_color_t* bottom, float alpha, float bottomAlpha);

/// Draw shadowed text.
void UI_TextOutEx(const char* text, const Point2Raw* origin, ui_color_t* color, float alpha);
void UI_TextOutEx2(const char* text, const Point2Raw* origin, ui_color_t* color, float alpha, int alignFlags, short textFlags);

de::MaterialVariantSpec const &UI_MaterialSpec(int texSpecFlags = 0);
//de::MaterialVariantSpec const &UI_MaterialSpec(int texSpecFlags = 0);

#endif
2 changes: 1 addition & 1 deletion doomsday/apps/client/src/dd_main.cpp
Expand Up @@ -2378,7 +2378,7 @@ void DD_ConsoleRegister()
#endif
RenderSystem::consoleRegister();
GL_Register();
UI_Register();
//UI_Register();
Demo_Register();
P_ConsoleRegister();
I_Register();
Expand Down
8 changes: 4 additions & 4 deletions doomsday/apps/client/src/render/blockmapvisual.cpp
Expand Up @@ -252,8 +252,8 @@ static void drawCellInfo(Vector2d const &origin_, char const *info)

Point2Raw origin(origin_.x, origin_.y);
origin.x -= size.width / 2;
UI_GradientEx(&origin, &size, 6, UI_Color(UIC_BG_MEDIUM), UI_Color(UIC_BG_LIGHT), .5f, .5f);
UI_DrawRectEx(&origin, &size, 6, false, UI_Color(UIC_BRD_HI), NULL, .5f, -1);
//UI_GradientEx(&origin, &size, 6, UI_Color(UIC_BG_MEDIUM), UI_Color(UIC_BG_LIGHT), .5f, .5f);
//UI_DrawRectEx(&origin, &size, 6, false, UI_Color(UIC_BRD_HI), NULL, .5f, -1);

origin.x += 8;
origin.y += size.height / 2;
Expand Down Expand Up @@ -281,8 +281,8 @@ static void drawBlockmapInfo(Vector2d const &origin_, Blockmap const &blockmap)

origin.x -= size.width;
origin.y -= size.height;
UI_GradientEx(&origin, &size, 6, UI_Color(UIC_BG_MEDIUM), UI_Color(UIC_BG_LIGHT), .5f, .5f);
UI_DrawRectEx(&origin, &size, 6, false, UI_Color(UIC_BRD_HI), NULL, .5f, -1);
//UI_GradientEx(&origin, &size, 6, UI_Color(UIC_BG_MEDIUM), UI_Color(UIC_BG_LIGHT), .5f, .5f);
//UI_DrawRectEx(&origin, &size, 6, false, UI_Color(UIC_BRD_HI), NULL, .5f, -1);

origin.x += 8;
origin.y += 8 + th/2;
Expand Down
6 changes: 3 additions & 3 deletions doomsday/apps/client/src/resource/clientresources.cpp
Expand Up @@ -1253,9 +1253,9 @@ void ClientResources::initSystemTextures()
} const texDefs[] = {
{ "bbox", "bbox" },
{ "gray", "gray" },
{ "boxcorner", "ui/boxcorner" },
{ "boxfill", "ui/boxfill" },
{ "boxshade", "ui/boxshade" }
//{ "boxcorner", "ui/boxcorner" },
//{ "boxfill", "ui/boxfill" },
//{ "boxshade", "ui/boxshade" }
};

LOG_RES_VERBOSE("Initializing System textures...");
Expand Down
47 changes: 27 additions & 20 deletions doomsday/apps/client/src/ui/ui_main.cpp
Expand Up @@ -38,15 +38,16 @@

using namespace de;

D_CMD(UIColor);
//D_CMD(UIColor);

fontid_t fontFixed, fontVariable[FONTSTYLE_COUNT];
static int uiFontHgt; /// Height of the UI font.
fontid_t fontFixed; //, fontVariable[FONTSTYLE_COUNT];
//static int uiFontHgt; /// Height of the UI font.

/// Modify these colors to change the look of the UI.
static ui_color_t ui_colors[NUM_UI_COLORS] = {
/* UIC_TEXT */ { .85f, .87f, 1 },
/* UIC_TITLE */ { 1, 1, 1 },
#if 0
/* UIC_SHADOW */ { 0, 0, 0 },
/* UIC_BG_LIGHT */ { .18f, .18f, .22f },
/* UIC_BG_MEDIUM */ { .4f, .4f, .52f },
Expand All @@ -55,17 +56,15 @@ static ui_color_t ui_colors[NUM_UI_COLORS] = {
/* UIC_BRD_MED */ { 0, 0, 0 },
/* UIC_BRD_LOW */ { .25f, .25f, .55f },
/* UIC_HELP */ { .4f, .4f, .52f }
#endif
};

static inline ClientResources &resSys()
{
return ClientApp::resources();
}

#if 0
void UI_Register(void)
{
C_CMD_FLAGS("uicolor", "sfff", UIColor, CMDF_NO_DEDICATED);
//C_CMD_FLAGS("uicolor", "sfff", UIColor, CMDF_NO_DEDICATED);
}
#endif

char const *UI_ChooseFixedFont()
{
Expand All @@ -74,6 +73,7 @@ char const *UI_ChooseFixedFont()
return "console14";
}

#if 0
char const *UI_ChooseVariableFont(fontstyle_t style)
{
int const resY = DENG_GAMEVIEW_HEIGHT;
Expand All @@ -98,6 +98,7 @@ char const *UI_ChooseVariableFont(fontstyle_t style)
"normalbold24");
}
}
#endif

static AbstractFont *loadSystemFont(char const *name)
{
Expand All @@ -116,7 +117,7 @@ static AbstractFont *loadSystemFont(char const *name)
#endif
F_ExpandBasePath(&resourcePath, &resourcePath);

AbstractFont *font = resSys().newFontFromFile(uri, Str_Text(&resourcePath));
AbstractFont *font = ClientResources::get().newFontFromFile(uri, Str_Text(&resourcePath));
if (!font)
{
App_Error("loadSystemFont: Failed loading font \"%s\".", name);
Expand All @@ -134,7 +135,7 @@ static void loadFontIfNeeded(char const *uri, fontid_t *fid)
{
try
{
FontManifest &manifest = resSys().fontManifest(de::Uri(uri, RC_NULL));
FontManifest &manifest = ClientResources::get().fontManifest(de::Uri(uri, RC_NULL));
if (manifest.hasResource())
{
*fid = fontid_t(manifest.uniqueId());
Expand All @@ -155,22 +156,22 @@ void UI_LoadFonts()
if (isDedicated) return;

loadFontIfNeeded(UI_ChooseFixedFont(), &fontFixed);
loadFontIfNeeded(UI_ChooseVariableFont(FS_NORMAL), &fontVariable[FS_NORMAL]);
loadFontIfNeeded(UI_ChooseVariableFont(FS_BOLD), &fontVariable[FS_BOLD]);
loadFontIfNeeded(UI_ChooseVariableFont(FS_LIGHT), &fontVariable[FS_LIGHT]);
// loadFontIfNeeded(UI_ChooseVariableFont(FS_NORMAL), &fontVariable[FS_NORMAL]);
// loadFontIfNeeded(UI_ChooseVariableFont(FS_BOLD), &fontVariable[FS_BOLD]);
// loadFontIfNeeded(UI_ChooseVariableFont(FS_LIGHT), &fontVariable[FS_LIGHT]);
}

de::MaterialVariantSpec const &UI_MaterialSpec(int texSpecFlags)
/*de::MaterialVariantSpec const &UI_MaterialSpec(int texSpecFlags)
{
return resSys().materialSpec(UiContext, texSpecFlags | TSF_NO_COMPRESSION,
return ClientResources::get().materialSpec(UiContext, texSpecFlags | TSF_NO_COMPRESSION,
0, 0, 0, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE,
1, 1, 0, false, false, false, false);
}
}*/

int UI_FontHeight(void)
/*int UI_FontHeight(void)
{
return uiFontHgt;
}
}*/

ui_color_t* UI_Color(uint id)
{
Expand All @@ -196,6 +197,7 @@ void UI_SetColor(ui_color_t* color)
LIBGUI_GL.glColor3f(color->red, color->green, color->blue);
}

#if 0
void UI_Gradient(const Point2Raw* origin, const Size2Raw* size, ui_color_t* topColor,
ui_color_t* bottomColor, float topAlpha, float bottomAlpha)
{
Expand All @@ -207,6 +209,7 @@ void UI_GradientEx(const Point2Raw* origin, const Size2Raw* size, int border, ui
{
UI_DrawRectEx(origin, size, border, true, topColor, bottomColor, topAlpha, bottomAlpha);
}
#endif

void UI_TextOutEx2(const char* text, const Point2Raw* origin, ui_color_t* color, float alpha,
int alignFlags, short textFlags)
Expand All @@ -223,6 +226,7 @@ void UI_TextOutEx(const char* text, const Point2Raw* origin, ui_color_t* color,
UI_TextOutEx2(text, origin, color, alpha, DEFAULT_ALIGNFLAGS, DEFAULT_DRAWFLAGS);
}

#if 0
void UI_DrawRectEx(const Point2Raw* origin, const Size2Raw* size, int border, dd_bool filled,
ui_color_t* topColor, ui_color_t* bottomColor, float alpha, float bottomAlpha)
{
Expand Down Expand Up @@ -349,6 +353,7 @@ void UI_DrawRectEx(const Point2Raw* origin, const Size2Raw* size, int border, dd
}
LIBGUI_GL.glEnd();
}
#endif

void UI_DrawDDBackground(Point2Raw const &origin, Size2Raw const &dimensions, float alpha)
{
Expand All @@ -359,7 +364,7 @@ void UI_DrawDDBackground(Point2Raw const &origin, Size2Raw const &dimensions, fl
// Background gradient picture.
MaterialSnapshot const &ms =
resSys().material(de::Uri("System", Path("ui/background")))
ClientResources::get().material(de::Uri("System", Path("ui/background")))
.prepare(UI_MaterialSpec(TSF_MONOCHROME));
GL_BindTexture(&ms.texture(MTU_PRIMARY));
*/
Expand Down Expand Up @@ -399,6 +404,7 @@ void UI_DrawDDBackground(Point2Raw const &origin, Size2Raw const &dimensions, fl
LIBGUI_GL.glDisable(GL_TEXTURE_2D);
}

#if 0
/**
* CCmd: Change the UI colors.
*/
Expand Down Expand Up @@ -437,3 +443,4 @@ D_CMD(UIColor)
LOG_SCR_ERROR("Unknown UI color '%s'") << argv[1];
return false;
}
#endif
6 changes: 0 additions & 6 deletions doomsday/doc/engine/command/uicolor.ame

This file was deleted.

0 comments on commit c70107e

Please sign in to comment.