Added ability for setting some labels to a different color, to improve on the unreadable text on dark background issue. Colors may need to be tweaked.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5879 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2010-09-03 19:42:36 +00:00
parent 7adcf430bd
commit bc490ef54e
13 changed files with 44 additions and 13 deletions

View File

@ -7,10 +7,10 @@
text="Choose a Kart"
align="center" text_align="center" />
<label width="100%" height="25"
I18N="In the kart selection (player setup) screen"
text="(more players can join by pressing 'fire' now)"
align="center" text_align="center" />
<bright width="100%" height="25"
I18N="In the kart selection (player setup) screen"
text="(more players can join by pressing 'fire' now)"
align="center" text_align="center" />
<placeholder id="playerskarts" width="100%" proportion="4">
<!-- Contents is added programatically -->

View File

@ -7,7 +7,7 @@
<spacer proportion="1" width="25"/>
<div layout="horizontal-row" width="100%" height="50" align="center">
<label proportion="1" height="100%"
<bright proportion="1" height="100%"
I18N="In race setup menu" text="Number of AI karts" text_align="right" />
<spacer width="50" height="25"/>
<!--
@ -28,7 +28,7 @@
<spacer proportion="2" width="25"/>
<label width="100%" height="25" text="Select a game mode" align="center" text_align="left" />
<bright width="100%" height="25" text="Select a game mode" align="center" text_align="left" />
<scrollable_toolbar id="gamemode" height="135" width="85%" label_location="bottom" align="center"
child_width="135" child_height="135" />

View File

@ -174,6 +174,7 @@ when the border that intersect at this corner are enabled.
<!-- Colors -->
<color type="text" state="neutral" r="0" g="0" b="0" />
<color type="brighttext" state="neutral" r="255" g="145" b="0" />
<!-- For highlighted items, e.g. in list -->
<color type="text" state="focused" r="255" g="255" b="255" />

View File

@ -175,6 +175,7 @@ when the border that intersect at this corner are enabled.
<!-- Colors -->
<color type="text" state="neutral" r="0" g="0" b="0" />
<color type="brighttext" state="neutral" r="28" g="176" b="255" />
<!-- For highlighted items, e.g. in list -->
<color type="text" state="focused" r="255" g="255" b="255" />

View File

@ -175,6 +175,7 @@ when the border that intersect at this corner are enabled.
<!-- Colors -->
<color type="text" state="neutral" r="0" g="0" b="0" />
<color type="brighttext" state="neutral" r="243" g="173" b="6" />
<!-- For highlighted items, e.g. in list -->
<color type="text" state="focused" r="255" g="255" b="255" />

View File

@ -165,12 +165,13 @@
\n
\subsection widget6 WTYPE_LABEL
<em> Names in XML files: </em> \c "label", \c "header"
<em> Names in XML files: </em> \c "label", \c "header" , \c "bright"
A plain label.
Supports properties PROP_WORD_WRAP and PROP_TEXT_ALIGN.
\note The "Header" variant uses a bigger and more colourful font.
\note The "header" variant uses a bigger and more colourful font.
\note The "bright" variant uses a more colourful font but is not bigger.
\n
\subsection widget7 WTYPE_SPACER

View File

@ -117,6 +117,10 @@ void Screen::parseScreenFileDiv(irr::io::IrrXMLReader* xml, ptr_vector<Widget>&
{
append_to.push_back(new LabelWidget());
}
else if (!strcmp("bright", xml->getNodeName()))
{
append_to.push_back(new LabelWidget(false, true));
}
else if (!strcmp("header", xml->getNodeName()))
{
append_to.push_back(new LabelWidget(true));

View File

@ -49,7 +49,6 @@ namespace SkinConfig
static std::map<std::string, BoxRenderParams> m_render_params;
static std::map<std::string, SColor> m_colors;
static void parseElement(const XMLNode* node)
{
std::string type;
@ -685,6 +684,12 @@ void Skin::drawProgress(Widget* w, const core::rect< s32 > &rect, const bool pre
}
}
SColor Skin::getColor(const std::string name)
{
return SkinConfig::m_colors[name];
}
void Skin::drawRibbon(const core::rect< s32 > &rect, Widget* widget, const bool pressed, bool focused)
{
}

View File

@ -315,6 +315,8 @@ namespace GUIEngine
virtual void setSize (irr::gui::EGUI_DEFAULT_SIZE which, irr::s32 size);
virtual void setSpriteBank (irr::gui::IGUISpriteBank *bank);
static irr::video::SColor getColor(const std::string name);
};
}
#endif

View File

@ -19,6 +19,7 @@
#include "guiengine/engine.hpp"
#include "guiengine/scalable_font.hpp"
#include "guiengine/skin.hpp"
using namespace GUIEngine;
using namespace irr::core;
@ -28,10 +29,17 @@ using namespace irr::gui;
/** Constructs the label widget. Parameter:
* \param title True if the special title font should be used.
*/
LabelWidget::LabelWidget(bool title) : Widget(WTYPE_LABEL)
LabelWidget::LabelWidget(bool title, bool bright) : Widget(WTYPE_LABEL)
{
m_title_font = title;
m_has_color = false;
if (bright)
{
m_has_color = true;
m_color = Skin::getColor("brighttext::neutral");
}
} // LabelWidget
// ----------------------------------------------------------------------------

View File

@ -36,7 +36,7 @@ namespace GUIEngine
irr::video::SColor m_color;
public:
LabelWidget(bool title=false);
LabelWidget(bool title=false, bool bright=false);
virtual ~LabelWidget() {}
void add();

View File

@ -239,7 +239,7 @@ public:
deviceName += "gamepad";
}
m_player_ID_label = new LabelWidget();
m_player_ID_label = new LabelWidget(false, true);
m_player_ID_label->setText(
//I18N: In kart selection screen (Will read like 'Player 1 (foobartech gamepad)')

View File

@ -509,7 +509,15 @@ void RaceGUI::drawGlobalPlayerIcons(const KartIconDisplayInfo* info)
kart->getController()->isPlayerController() ? ICON_PLAYER_WIDTH
: ICON_WIDTH;
const core::rect<s32> pos(x, y, x+w, y+w);
//to bring to light the player's icon: add a background
if (kart->getController()->isPlayerController())
{
video::SColor color=kart->getKartProperties()->getColor();
color.setAlpha(100+30*cos(World::getWorld()->getTime()*2));
irr_driver->getVideoDriver()->draw2DRectangle(color,pos);
}
// Fixes crash bug, why are certain icons not showing up?
if ((icon != NULL) && (!kart->playingEmergencyAnimation()))
{