Commit e6584c0e authored by gerstrong@gmail.com's avatar gerstrong@gmail.com

Gui improvements

parent 902c65d0
......@@ -7,9 +7,13 @@ Project(CommanderGenius)
set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake")
option(USE_VIRTUALPAD "Enable Onscreen Virtual Gamepad support " yes)
option(USE_VIRTUALPAD "Enable Onscreen Virtual Gamepad support " ON)
option(DISABLE_HOVER "Disables the hover over effect in the menus, useful for touch based devices" OFF)
if(DISABLE_HOVER)
ADD_DEFINITIONS(-DDISABLE_HOVER)
endif()
if(USE_VIRTUALPAD)
ADD_DEFINITIONS(-DVIRTUALPAD)
......
......@@ -57,7 +57,7 @@ public:
mpMenuDialog->sendEvent(command);
}
void setProperty( const Property newProperty )
virtual void setProperty( const Property newProperty )
{
mpReturnButton->setText( newProperty == CLOSEABLE ? "x" : "\025" );
}
......
......@@ -40,7 +40,7 @@ void GsControl::processBlendEffects()
#ifndef DISABLE_HOVER
if(mHovered || mSelected)
#else
if(mSelected)
if(mSelected || mPressed)
#endif
{
int maxBlend = 224;
......@@ -59,7 +59,7 @@ void GsControl::processBlendEffects()
else
mLightRatio = maxBlend;
}
else // Button is not hovered
else // Button is not hovered/pressed
{
if(mLightRatio-BLEND_SPEED > 0)
mLightRatio -= BLEND_SPEED;
......
......@@ -59,10 +59,14 @@ public:
void select( const bool value )
{ mSelected = value; }
{
mSelected = value;
}
bool isSelected()
{ return mSelected; }
{
return mSelected;
}
bool Up()
......
......@@ -249,7 +249,9 @@ void CGUINumberControl::processRender(const GsRect<float> &RectDispCoordFloat)
else
lComp = 0xFF - (mLightRatio*(0xFF-0xDF)/255);
const Uint32 fillColor = blitsfc.mapRGBA( lComp, lComp, lComp, 0xFF);
const Uint32 fillColor = blitsfc.mapRGBA( Uint8(lComp),
Uint8(lComp),
Uint8(lComp), 0xFF);
GsRect<Uint16> rect(lRect);
......
......@@ -19,14 +19,15 @@ public:
GsRect<float> localRect(0.3f, 0.282f, 0.6f, 0.5f);
mpMenuDialog->setRect(localRect);
mpReturnButton = new GameButton( "x",
mpReturnButton = new GameButton( "close",
new CloseMenuEvent(),
style);
mpMenuDialog->addControl( mpReturnButton,
GsRect<float>(-0.1f, 0.1f,
0.03f/localRect.w,
0.03f/localRect.h) );
GsRect<float>(0.01f, 0.01f,
0.15f/localRect.w,
0.08f/localRect.h) );
}
else if(style == GsControl::VORTICON)
......@@ -35,13 +36,13 @@ public:
mpMenuDialog->setRect(localRect);
mpReturnButton = new GsButton( "x",
mpReturnButton = new GsButton( "close",
new CloseMenuEvent(),
GsControl::Style::NONE);
mpMenuDialog->addControl( mpReturnButton,
GsRect<float>(-0.05f, -0.05f,
0.08f/localRect.w,
0.15f/localRect.w,
0.08f/localRect.h) );
}
else
......@@ -84,6 +85,12 @@ public:
void initBackgroundNoStyle();
void setProperty( const Property newProperty ) override
{
mpReturnButton->setText( newProperty == CLOSEABLE ? "close" : "back" );
}
// Processes the stuff that the menus have in common
virtual void ponder(const float deltaT) override;
......
......@@ -6,38 +6,5 @@
#include <widgets/GsMenuController.h>
#include <base/video/CVideoDriver.h>
/*
class VorticonMenu : public CBaseMenu
{
public:
VorticonMenu( const GsRect<float>& rect ):
CBaseMenu( rect, new GsButton( "x", new CloseMenuEvent(),
GsControl::Style::NONE,
1.0f,
0.75f,
0.75f) )
{
mpMenuDialog->addControl( mpReturnButton, GsRect<float>(0.0f,
0.0f,
0.06f/rect.w,
0.06f/rect.h) );
mpReturnButton->setDown(true);
refresh();
}
virtual void refresh()
{
CBaseMenu::refresh();
initVorticonBackground();
}
void initVorticonBackground();
void render();
private:
GsSurface mBackground;
};
*/
#endif /* __VORTICONMENU_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment