ui prettying up

This commit is contained in:
darkrose 2017-07-22 04:27:46 +10:00
parent a5d71176e6
commit 501c631395
14 changed files with 89 additions and 85 deletions

View File

@ -435,23 +435,21 @@ void GUICharDefMenu::drawMenu()
video::IVideoDriver* driver = Environment->getVideoDriver(); video::IVideoDriver* driver = Environment->getVideoDriver();
core::rect<s32> left( core::rect<s32> left(
AbsoluteRect.UpperLeftCorner.X, 0,
AbsoluteRect.UpperLeftCorner.Y, 0,
AbsoluteRect.UpperLeftCorner.X+250, 250,
AbsoluteRect.LowerRightCorner.Y m_screensize.Y
); );
core::rect<s32> right( core::rect<s32> right(
AbsoluteRect.LowerRightCorner.X-230, m_screensize.X-230,
AbsoluteRect.UpperLeftCorner.Y, 0,
AbsoluteRect.LowerRightCorner.X, m_screensize.X,
AbsoluteRect.LowerRightCorner.Y m_screensize.Y
); );
driver->draw2DRectangle(left, GUI_BG_TOP, GUI_BG_TOP, GUI_BG_BTM, GUI_BG_BTM, &AbsoluteClippingRect); driver->draw2DRectangle(left, GUI_BG_TOP, GUI_BG_TOP, GUI_BG_BTM, GUI_BG_BTM, &AbsoluteClippingRect);
driver->draw2DRectangleOutline(left, GUI_BORDER);
driver->draw2DRectangle(right, GUI_BG_TOP, GUI_BG_TOP, GUI_BG_BTM, GUI_BG_BTM, &AbsoluteClippingRect); driver->draw2DRectangle(right, GUI_BG_TOP, GUI_BG_TOP, GUI_BG_BTM, GUI_BG_BTM, &AbsoluteClippingRect);
driver->draw2DRectangleOutline(right, GUI_BORDER);
if (path_get((char*)"texture",(char*)"menulogo.png",1,buff,1024)) { if (path_get((char*)"texture",(char*)"menulogo.png",1,buff,1024)) {
video::ITexture *texture = driver->getTexture(buff); video::ITexture *texture = driver->getTexture(buff);

View File

@ -60,7 +60,8 @@ GUIFormSpecMenu::GUIFormSpecMenu(gui::IGUIEnvironment* env,
m_selected_item(NULL), m_selected_item(NULL),
m_selected_amount(0), m_selected_amount(0),
m_selected_dragging(false), m_selected_dragging(false),
m_tooltip_element(NULL) m_tooltip_element(NULL),
m_screensize(1024,600)
{ {
} }
@ -104,6 +105,8 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize)
// Remove children // Remove children
removeChildren(); removeChildren();
m_screensize = screensize;
v2s32 size(100,100); v2s32 size(100,100);
s32 helptext_h = 15; s32 helptext_h = 15;
core::rect<s32> rect; core::rect<s32> rect;
@ -598,8 +601,13 @@ void GUIFormSpecMenu::drawMenu()
return; return;
video::IVideoDriver* driver = Environment->getVideoDriver(); video::IVideoDriver* driver = Environment->getVideoDriver();
driver->draw2DRectangle(AbsoluteRect,GUI_BG_TOP, GUI_BG_TOP, GUI_BG_BTM, GUI_BG_BTM, &AbsoluteClippingRect); core::rect<s32> rect(
driver->draw2DRectangleOutline(AbsoluteRect, GUI_BORDER); 0,
0,
m_screensize.X,
m_screensize.Y
);
driver->draw2DRectangle(rect, GUI_BG_TOP, GUI_BG_BTM, GUI_BG_TOP, GUI_BG_BTM, NULL);
m_tooltip_element->setVisible(false); m_tooltip_element->setVisible(false);

View File

@ -225,6 +225,7 @@ protected:
v2s32 m_pointer; v2s32 m_pointer;
gui::IGUIStaticText *m_tooltip_element; gui::IGUIStaticText *m_tooltip_element;
v2u32 m_screensize;
}; };
#endif #endif

View File

@ -245,20 +245,13 @@ void GUIMainMenu::drawMenu()
{ {
char buff[1024]; char buff[1024];
core::rect<s32> left( core::rect<s32> rect(
AbsoluteRect.UpperLeftCorner.X, 0,
AbsoluteRect.UpperLeftCorner.Y, 0,
AbsoluteRect.LowerRightCorner.X-550, m_screensize.X,
AbsoluteRect.LowerRightCorner.Y m_screensize.Y
); );
core::rect<s32> right( driver->draw2DRectangle(rect, GUI_BG_TOP, GUI_BG_BTM, GUI_BG_TOP, GUI_BG_BTM, NULL);
AbsoluteRect.UpperLeftCorner.X+250,
AbsoluteRect.UpperLeftCorner.Y,
AbsoluteRect.LowerRightCorner.X,
AbsoluteRect.LowerRightCorner.Y
);
driver->draw2DRectangle(left, GUI_BG_BTM, GUI_BG_BTM, GUI_BG_BTM, GUI_BG_BTM, &AbsoluteClippingRect);
driver->draw2DRectangle(right, GUI_BG_TOP, GUI_BG_BTM, GUI_BG_TOP, GUI_BG_BTM, &AbsoluteClippingRect);
if (path_get((char*)"texture",(char*)"menulogo.png",1,buff,1024)) { if (path_get((char*)"texture",(char*)"menulogo.png",1,buff,1024)) {
video::ITexture *texture = driver->getTexture(buff); video::ITexture *texture = driver->getTexture(buff);
if (texture != 0) { if (texture != 0) {

View File

@ -43,7 +43,8 @@ GUIMessageMenu::GUIMessageMenu(gui::IGUIEnvironment* env,
): ):
GUIModalMenu(env, parent, id, menumgr), GUIModalMenu(env, parent, id, menumgr),
m_message_text(message_text), m_message_text(message_text),
m_status(false) m_status(false),
m_screensize(1024,600)
{ {
} }
@ -71,6 +72,7 @@ void GUIMessageMenu::regenerateGui(v2u32 screensize)
/* /*
Remove stuff Remove stuff
*/ */
m_screensize = screensize;
removeChildren(); removeChildren();
/* /*
@ -120,9 +122,13 @@ void GUIMessageMenu::drawMenu()
if (!skin) if (!skin)
return; return;
video::IVideoDriver* driver = Environment->getVideoDriver(); video::IVideoDriver* driver = Environment->getVideoDriver();
core::rect<s32> rect(
driver->draw2DRectangle(AbsoluteRect, GUI_BG_TOP, GUI_BG_TOP, GUI_BG_BTM, GUI_BG_BTM, &AbsoluteClippingRect); 0,
driver->draw2DRectangleOutline(AbsoluteRect, GUI_BORDER); 0,
m_screensize.X,
m_screensize.Y
);
driver->draw2DRectangle(rect, GUI_BG_TOP, GUI_BG_BTM, GUI_BG_TOP, GUI_BG_BTM, NULL);
gui::IGUIElement::draw(); gui::IGUIElement::draw();
} }

View File

@ -61,6 +61,7 @@ public:
private: private:
std::wstring m_message_text; std::wstring m_message_text;
bool m_status; bool m_status;
v2u32 m_screensize;
}; };
#endif #endif

View File

@ -330,20 +330,13 @@ void GUIMultiplayerMenu::drawMenu()
{ {
char buff[1024]; char buff[1024];
core::rect<s32> left( core::rect<s32> rect(
AbsoluteRect.UpperLeftCorner.X, 0,
AbsoluteRect.UpperLeftCorner.Y, 0,
AbsoluteRect.LowerRightCorner.X-550, m_screensize.X,
AbsoluteRect.LowerRightCorner.Y m_screensize.Y
); );
core::rect<s32> right( driver->draw2DRectangle(rect, GUI_BG_TOP, GUI_BG_BTM, GUI_BG_TOP, GUI_BG_BTM, NULL);
AbsoluteRect.UpperLeftCorner.X+250,
AbsoluteRect.UpperLeftCorner.Y,
AbsoluteRect.LowerRightCorner.X,
AbsoluteRect.LowerRightCorner.Y
);
driver->draw2DRectangle(left, GUI_BG_BTM, GUI_BG_BTM, GUI_BG_BTM, GUI_BG_BTM, &AbsoluteClippingRect);
driver->draw2DRectangle(right, GUI_BG_TOP, GUI_BG_BTM, GUI_BG_TOP, GUI_BG_BTM, &AbsoluteClippingRect);
if (path_get((char*)"texture",(char*)"menulogo.png",1,buff,1024)) { if (path_get((char*)"texture",(char*)"menulogo.png",1,buff,1024)) {
video::ITexture *texture = driver->getTexture(buff); video::ITexture *texture = driver->getTexture(buff);

View File

@ -51,7 +51,8 @@ GUIPasswordChange::GUIPasswordChange(gui::IGUIEnvironment* env,
Client* client Client* client
): ):
GUIModalMenu(env, parent, id, menumgr), GUIModalMenu(env, parent, id, menumgr),
m_client(client) m_client(client),
m_screensize(1024,600)
{ {
} }
@ -78,6 +79,7 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
Remove stuff Remove stuff
*/ */
removeChildren(); removeChildren();
m_screensize = screensize;
/* /*
Calculate new sizes and positions Calculate new sizes and positions
@ -175,9 +177,13 @@ void GUIPasswordChange::drawMenu()
if (!skin) if (!skin)
return; return;
video::IVideoDriver* driver = Environment->getVideoDriver(); video::IVideoDriver* driver = Environment->getVideoDriver();
core::rect<s32> rect(
driver->draw2DRectangle(AbsoluteRect, GUI_BG_TOP, GUI_BG_TOP, GUI_BG_BTM, GUI_BG_BTM, &AbsoluteClippingRect); 0,
driver->draw2DRectangleOutline(AbsoluteRect, GUI_BORDER); 0,
m_screensize.X,
m_screensize.Y
);
driver->draw2DRectangle(rect, GUI_BG_TOP, GUI_BG_BTM, GUI_BG_TOP, GUI_BG_BTM, NULL);
gui::IGUIElement::draw(); gui::IGUIElement::draw();
} }

View File

@ -56,6 +56,7 @@ public:
private: private:
Client* m_client; Client* m_client;
v2u32 m_screensize;
}; };

View File

@ -48,6 +48,7 @@ GUIPauseMenu::GUIPauseMenu(gui::IGUIEnvironment* env,
m_gamecallback = gamecallback; m_gamecallback = gamecallback;
this->env = env; this->env = env;
this->parent = parent; this->parent = parent;
this->m_screensize = v2u32(1024,600);
this->id = id; this->id = id;
this->menumgr = menumgr; this->menumgr = menumgr;
} }
@ -76,6 +77,8 @@ void GUIPauseMenu::regenerateGui(v2u32 screensize)
*/ */
removeChildren(); removeChildren();
m_screensize = screensize;
/* /*
Calculate new sizes and positions Calculate new sizes and positions
*/ */
@ -168,9 +171,13 @@ void GUIPauseMenu::drawMenu()
if (!skin) if (!skin)
return; return;
video::IVideoDriver* driver = Environment->getVideoDriver(); video::IVideoDriver* driver = Environment->getVideoDriver();
core::rect<s32> rect(
driver->draw2DRectangle(AbsoluteRect, GUI_BG_TOP, GUI_BG_TOP, GUI_BG_BTM, GUI_BG_BTM, &AbsoluteClippingRect); 0,
driver->draw2DRectangleOutline(AbsoluteRect, GUI_BORDER); 0,
m_screensize.X,
m_screensize.Y
);
driver->draw2DRectangle(rect, GUI_BG_TOP, GUI_BG_BTM, GUI_BG_TOP, GUI_BG_BTM, NULL);
gui::IGUIElement::draw(); gui::IGUIElement::draw();
} }

View File

@ -62,6 +62,7 @@ private:
gui::IGUIEnvironment* env; gui::IGUIEnvironment* env;
gui::IGUIElement* parent; gui::IGUIElement* parent;
v2u32 m_screensize;
s32 id; s32 id;
IMenuManager *menumgr; IMenuManager *menumgr;
}; };

View File

@ -366,7 +366,7 @@ void GUISettingsMenu::regenerateGui(v2u32 screensize)
if (m_data.selected_tab == TAB_SETTINGS_CONTROLS) { if (m_data.selected_tab == TAB_SETTINGS_CONTROLS) {
{ {
core::rect<s32> rect(0, 0, 550, 20); core::rect<s32> rect(0, 0, 550, 20);
rect += topleft_content + v2s32(0, 20); rect += topleft_content + v2s32(0, 0);
gui::IGUIStaticText *t = Environment->addStaticText(narrow_to_wide(gettext("Controls")).c_str(), rect, false, true, this, -1); gui::IGUIStaticText *t = Environment->addStaticText(narrow_to_wide(gettext("Controls")).c_str(), rect, false, true, this, -1);
t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
} }
@ -397,7 +397,7 @@ void GUISettingsMenu::regenerateGui(v2u32 screensize)
}else if (m_data.selected_tab == TAB_SETTINGS_GRAPHICS) { }else if (m_data.selected_tab == TAB_SETTINGS_GRAPHICS) {
{ {
core::rect<s32> rect(0, 0, 550, 20); core::rect<s32> rect(0, 0, 550, 20);
rect += topleft_content + v2s32(0, 20); rect += topleft_content + v2s32(0, 0);
gui::IGUIStaticText *t = Environment->addStaticText(narrow_to_wide(gettext("Graphics")).c_str(), rect, false, true, this, -1); gui::IGUIStaticText *t = Environment->addStaticText(narrow_to_wide(gettext("Graphics")).c_str(), rect, false, true, this, -1);
t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
} }
@ -496,7 +496,7 @@ void GUISettingsMenu::regenerateGui(v2u32 screensize)
}else if (m_data.selected_tab == TAB_SETTINGS_VIDEO) { }else if (m_data.selected_tab == TAB_SETTINGS_VIDEO) {
{ {
core::rect<s32> rect(0, 0, 550, 20); core::rect<s32> rect(0, 0, 550, 20);
rect += topleft_content + v2s32(0, 20); rect += topleft_content + v2s32(0, 0);
gui::IGUIStaticText *t = Environment->addStaticText(narrow_to_wide(gettext("Video")).c_str(), rect, false, true, this, -1); gui::IGUIStaticText *t = Environment->addStaticText(narrow_to_wide(gettext("Video")).c_str(), rect, false, true, this, -1);
t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
} }
@ -544,7 +544,7 @@ void GUISettingsMenu::regenerateGui(v2u32 screensize)
}else if (m_data.selected_tab == TAB_SETTINGS_SOUND) { }else if (m_data.selected_tab == TAB_SETTINGS_SOUND) {
{ {
core::rect<s32> rect(0, 0, 550, 20); core::rect<s32> rect(0, 0, 550, 20);
rect += topleft_content + v2s32(0, 20); rect += topleft_content + v2s32(0, 0);
gui::IGUIStaticText *t = Environment->addStaticText(narrow_to_wide(gettext("Sound")).c_str(), rect, false, true, this, -1); gui::IGUIStaticText *t = Environment->addStaticText(narrow_to_wide(gettext("Sound")).c_str(), rect, false, true, this, -1);
t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
} }
@ -596,20 +596,13 @@ void GUISettingsMenu::drawMenu()
{ {
char buff[1024]; char buff[1024];
core::rect<s32> left( core::rect<s32> rect(
AbsoluteRect.UpperLeftCorner.X, 0,
AbsoluteRect.UpperLeftCorner.Y, 0,
AbsoluteRect.LowerRightCorner.X-550, m_screensize.X,
AbsoluteRect.LowerRightCorner.Y m_screensize.Y
); );
core::rect<s32> right( driver->draw2DRectangle(rect, GUI_BG_TOP, GUI_BG_BTM, GUI_BG_TOP, GUI_BG_BTM, NULL);
AbsoluteRect.UpperLeftCorner.X+250,
AbsoluteRect.UpperLeftCorner.Y,
AbsoluteRect.LowerRightCorner.X,
AbsoluteRect.LowerRightCorner.Y
);
driver->draw2DRectangle(left, GUI_BG_BTM, GUI_BG_BTM, GUI_BG_BTM, GUI_BG_BTM, &AbsoluteClippingRect);
driver->draw2DRectangle(right, GUI_BG_TOP, GUI_BG_BTM, GUI_BG_TOP, GUI_BG_BTM, &AbsoluteClippingRect);
if (path_get((char*)"texture",(char*)"menulogo.png",1,buff,1024)) { if (path_get((char*)"texture",(char*)"menulogo.png",1,buff,1024)) {
video::ITexture *texture = driver->getTexture(buff); video::ITexture *texture = driver->getTexture(buff);

View File

@ -3,35 +3,35 @@
#include "common_irrlicht.h" #include "common_irrlicht.h"
#define GUI_BG_TOP video::SColor(240,50,50,70) #define GUI_BG_TOP video::SColor(128,0,0,0)
#define GUI_BG_BTM video::SColor(240,30,30,50) #define GUI_BG_BTM video::SColor(128,0,0,0)
#define GUI_BORDER video::SColor(245,60,60,80) #define GUI_BORDER video::SColor(0,0,0,0)
#define GUI_BG_DEATH video::SColor(180,50,0,0) #define GUI_BG_DEATH video::SColor(180,50,0,0)
#define GUI_BG_TT video::SColor(200,30,30,50) #define GUI_BG_TT video::SColor(200,70,130,30)
#define GUI_TT_TEXT video::SColor(255,255,255,255) #define GUI_TT_TEXT video::SColor(255,255,255,255)
#define GUI_INV_BORDER video::SColor(245,60,60,80) #define GUI_INV_BORDER video::SColor(128,60,60,60)
#define GUI_INV_HIGHLIGHT video::SColor(240,255,0,0) #define GUI_INV_HIGHLIGHT video::SColor(240,170,30,30)
#define GUI_INV_BG video::SColor(240,30,30,50) #define GUI_INV_BG video::SColor(128,60,60,60)
#define GUI_3D_HIGH_LIGHT video::SColor(255,0,0,0) #define GUI_3D_HIGH_LIGHT video::SColor(128,70,130,30)
#define GUI_HIGH_LIGHT video::SColor(255,70,100,50) #define GUI_HIGH_LIGHT video::SColor(255,70,100,50)
#define GUI_HIGH_LIGHT_TEXT video::SColor(255,255,255,255) #define GUI_HIGH_LIGHT_TEXT video::SColor(255,255,255,255)
#define GUI_BUTTON_TEXT video::SColor(255,255,255,255) #define GUI_BUTTON_TEXT video::SColor(255,255,255,255)
#if (IRRLICHT_VERSION_MAJOR >= 1 && IRRLICHT_VERSION_MINOR >= 8) || IRRLICHT_VERSION_MAJOR >= 2 #if (IRRLICHT_VERSION_MAJOR >= 1 && IRRLICHT_VERSION_MINOR >= 8) || IRRLICHT_VERSION_MAJOR >= 2
// Irrlicht 1.8 input colours // Irrlicht 1.8 input colours
#define GUI_3D_FACE video::SColor(255,60,60,80) #define GUI_3D_FACE video::SColor(255,70,130,30)
#define GUI_3D_SHADOW video::SColor(255,60,60,80) #define GUI_3D_SHADOW video::SColor(255,70,130,30)
#define GUI_3D_DARK_SHADOW video::SColor(255,30,30,50) #define GUI_3D_DARK_SHADOW video::SColor(255,70,130,30)
#define GUI_EDITABLE video::SColor(255,60,60,80) #define GUI_EDITABLE video::SColor(128,70,130,30)
#define GUI_FOCUSED_EDITABLE video::SColor(255,60,60,80) #define GUI_FOCUSED_EDITABLE video::SColor(192,70,130,30)
#else #else
#define GUI_3D_SHADOW video::SColor(255,0,0,0) #define GUI_3D_SHADOW video::SColor(255,70,130,30)
#endif #endif

View File

@ -3241,10 +3241,6 @@ void ClientMap::renderPostFx()
post_effect_color = video::SColor(255, 0, 0, 0); post_effect_color = video::SColor(255, 0, 0, 0);
} }
} }
if (m_client->getFormState()) {
if (post_effect_color.getAlpha() < 128)
post_effect_color = video::SColor(128,0,0,0);
}
if (post_effect_color.getAlpha() != 0) { if (post_effect_color.getAlpha() != 0) {
// Draw a full-screen rectangle // Draw a full-screen rectangle
video::IVideoDriver* driver = SceneManager->getVideoDriver(); video::IVideoDriver* driver = SceneManager->getVideoDriver();