Merge pull request #128 from Vulpovile/feature/property_grid_toggle
Made MENU toggle property grid
This commit is contained in:
@@ -43,6 +43,14 @@ public:
|
|||||||
virtual bool mouseHovered(float, float, RenderDevice* rd);
|
virtual bool mouseHovered(float, float, RenderDevice* rd);
|
||||||
UDim2 position;
|
UDim2 position;
|
||||||
UDim2 size;
|
UDim2 size;
|
||||||
|
static G3D::Color4 translucentBackdrop()
|
||||||
|
{
|
||||||
|
return G3D::Color4(0.60000002F, 0.60000002F, 0.60000002F, 0.60000002F);
|
||||||
|
}
|
||||||
|
static G3D::Color4 disabledFill()
|
||||||
|
{
|
||||||
|
return G3D::Color4(0.69999999F, 0.69999999F, 0.69999999F, 0.5F);
|
||||||
|
}
|
||||||
protected:
|
protected:
|
||||||
bool mouseInArea(float, float, float, float, float, float);
|
bool mouseInArea(float, float, float, float, float, float);
|
||||||
class ButtonListener* listener;
|
class ButtonListener* listener;
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ static bool mouseMovedBeginMotion = false;
|
|||||||
static POINT oldGlobalMouse;
|
static POINT oldGlobalMouse;
|
||||||
Vector2 oldMouse = Vector2(0,0);
|
Vector2 oldMouse = Vector2(0,0);
|
||||||
float moveRate = 0.5;
|
float moveRate = 0.5;
|
||||||
|
float wasPropShown = 0;
|
||||||
|
|
||||||
void Application::clearInstances()
|
void Application::clearInstances()
|
||||||
{
|
{
|
||||||
@@ -56,7 +57,7 @@ void Application::setFocus(bool focus)
|
|||||||
if(_propWindow != NULL)
|
if(_propWindow != NULL)
|
||||||
if(focus)
|
if(focus)
|
||||||
{
|
{
|
||||||
ShowWindow(_propWindow->_hwndProp, SW_SHOW);
|
//ShowWindow(_propWindow->_hwndProp, SW_SHOW);
|
||||||
SetWindowPos(_propWindow->_hwndProp, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
|
SetWindowPos(_propWindow->_hwndProp, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -221,6 +221,7 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
|
|||||||
button->name = "Group";
|
button->name = "Group";
|
||||||
button->setAllColorsSame();
|
button->setAllColorsSame();
|
||||||
button->textColorDis = Color3(0.8F,0.8F,0.8F);
|
button->textColorDis = Color3(0.8F,0.8F,0.8F);
|
||||||
|
button->boxColorOvr = Color4(0.6F,0.6F,0.6F,0.4F);
|
||||||
button->font = g_fntlighttrek;
|
button->font = g_fntlighttrek;
|
||||||
button->fontLocationRelativeTo = Vector2(10, 0);
|
button->fontLocationRelativeTo = Vector2(10, 0);
|
||||||
button->setParent(this);
|
button->setParent(this);
|
||||||
@@ -237,6 +238,7 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
|
|||||||
button->name = "UnGroup";
|
button->name = "UnGroup";
|
||||||
button->setAllColorsSame();
|
button->setAllColorsSame();
|
||||||
button->textColorDis = Color3(0.8F,0.8F,0.8F);
|
button->textColorDis = Color3(0.8F,0.8F,0.8F);
|
||||||
|
button->boxColorOvr = Color4(0.6F,0.6F,0.6F,0.4F);
|
||||||
button->font = g_fntlighttrek;
|
button->font = g_fntlighttrek;
|
||||||
button->fontLocationRelativeTo = Vector2(10, 0);
|
button->fontLocationRelativeTo = Vector2(10, 0);
|
||||||
button->setParent(this);
|
button->setParent(this);
|
||||||
@@ -252,12 +254,31 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
|
|||||||
button->title = "Duplicate";
|
button->title = "Duplicate";
|
||||||
button->setAllColorsSame();
|
button->setAllColorsSame();
|
||||||
button->textColorDis = Color3(0.8F,0.8F,0.8F);
|
button->textColorDis = Color3(0.8F,0.8F,0.8F);
|
||||||
|
button->boxColorOvr = Color4(0.6F,0.6F,0.6F,0.4F);
|
||||||
button->font = g_fntlighttrek;
|
button->font = g_fntlighttrek;
|
||||||
button->fontLocationRelativeTo = Vector2(10, 0);
|
button->fontLocationRelativeTo = Vector2(10, 0);
|
||||||
button->setParent(this);
|
button->setParent(this);
|
||||||
button->name = "Duplicate";
|
button->name = "Duplicate";
|
||||||
button->setButtonListener(gud);
|
button->setButtonListener(gud);
|
||||||
|
|
||||||
|
//g_fntlighttrek->draw2D(rd,"MENU", Vector2(10,332), 14, Color3::white(), Color4(0.5F,0.5F,0.5F,0.5F));
|
||||||
|
|
||||||
|
button = makeTextButton();
|
||||||
|
button->boxBegin = Vector2(0,332);
|
||||||
|
button->boxEnd = Vector2(80,352);
|
||||||
|
button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F);
|
||||||
|
button->textColor = Color3::white();
|
||||||
|
button->boxColor = Color4::clear();
|
||||||
|
button->textSize = 14;
|
||||||
|
button->title = "MENU";
|
||||||
|
button->setAllColorsSame();
|
||||||
|
button->boxColorOvr = Color4(0.6F,0.6F,0.6F,0.4F);
|
||||||
|
button->font = g_fntlighttrek;
|
||||||
|
button->fontLocationRelativeTo = Vector2(10, 0);
|
||||||
|
button->setParent(this);
|
||||||
|
button->name = "MENU";
|
||||||
|
button->setButtonListener(menuListener);
|
||||||
|
|
||||||
ImageButtonInstance* instance = new ToggleImageButtonInstance(
|
ImageButtonInstance* instance = new ToggleImageButtonInstance(
|
||||||
Texture::fromFile(GetFileInPath("/content/images/Run.png")),
|
Texture::fromFile(GetFileInPath("/content/images/Run.png")),
|
||||||
Texture::fromFile(GetFileInPath("/content/images/Run_ovr.png")),
|
Texture::fromFile(GetFileInPath("/content/images/Run_ovr.png")),
|
||||||
@@ -466,7 +487,7 @@ void GuiRootInstance::renderGUI(G3D::RenderDevice* rd, double fps)
|
|||||||
|
|
||||||
//Tools menu
|
//Tools menu
|
||||||
Draw::box(G3D::Box(Vector3(5, 210,0),Vector3(75, 210,0)),rd,Color4(0.6F,0.6F,0.6F,0.4F), Color4(0.6F,0.6F,0.6F,0.4F));
|
Draw::box(G3D::Box(Vector3(5, 210,0),Vector3(75, 210,0)),rd,Color4(0.6F,0.6F,0.6F,0.4F), Color4(0.6F,0.6F,0.6F,0.4F));
|
||||||
g_fntlighttrek->draw2D(rd,"MENU", Vector2(10,332), 14, Color3::white(), Color4(0.5F,0.5F,0.5F,0.5F));
|
|
||||||
|
|
||||||
|
|
||||||
//drawButtons(rd);
|
//drawButtons(rd);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#include "DataModelV2/TextButtonInstance.h"
|
#include "DataModelV2/TextButtonInstance.h"
|
||||||
|
#include "DataModelV2/BaseGuiInstance.h"
|
||||||
|
|
||||||
TextButtonInstance::TextButtonInstance(void)
|
TextButtonInstance::TextButtonInstance(void)
|
||||||
{
|
{
|
||||||
@@ -11,7 +11,7 @@ TextButtonInstance::TextButtonInstance(void)
|
|||||||
title = "TextBox";
|
title = "TextBox";
|
||||||
textColor = Color4(1, 1, 1, 1);
|
textColor = Color4(1, 1, 1, 1);
|
||||||
textOutlineColor = Color4(0, 0, 0, 0);
|
textOutlineColor = Color4(0, 0, 0, 0);
|
||||||
boxColor = Color4(0.6F,0.6F,0.6F,0.4F);
|
boxColor = BaseGuiInstance::translucentBackdrop();
|
||||||
boxOutlineColor = Color4(0, 0, 0, 0);
|
boxOutlineColor = Color4(0, 0, 0, 0);
|
||||||
setAllColorsSame();
|
setAllColorsSame();
|
||||||
textSize = 12;
|
textSize = 12;
|
||||||
|
|||||||
@@ -2,6 +2,9 @@
|
|||||||
#include "DataModelV2/ToggleImageButtonInstance.h"
|
#include "DataModelV2/ToggleImageButtonInstance.h"
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
|
|
||||||
|
bool menuOpen = false;
|
||||||
|
|
||||||
void MenuButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
void MenuButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
||||||
{
|
{
|
||||||
if(button->name == "go")
|
if(button->name == "go")
|
||||||
@@ -63,4 +66,22 @@ void MenuButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (button->name == "MENU")
|
||||||
|
{
|
||||||
|
menuOpen = !menuOpen;
|
||||||
|
ShowWindow(g_usableApp->_propWindow->_hwndProp, menuOpen);
|
||||||
|
if(TextButtonInstance* textButton = dynamic_cast<TextButtonInstance*>(button))
|
||||||
|
{
|
||||||
|
if(menuOpen)
|
||||||
|
{
|
||||||
|
textButton->textColor = Color3(0,1,1);
|
||||||
|
textButton->textColorOvr = Color3(0,1,1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
textButton->textColor = Color3::white();
|
||||||
|
textButton->textColorOvr = Color3::white();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -244,7 +244,7 @@ bool PropertyWindow::onCreate(int x, int y, int sx, int sy, HMODULE hThisInstanc
|
|||||||
WS_EX_TOOLWINDOW,
|
WS_EX_TOOLWINDOW,
|
||||||
"propHWND",
|
"propHWND",
|
||||||
"PropertyGrid",
|
"PropertyGrid",
|
||||||
WS_VISIBLE | WS_POPUPWINDOW | WS_THICKFRAME | WS_CAPTION,
|
WS_POPUPWINDOW | WS_THICKFRAME | WS_CAPTION,
|
||||||
CW_USEDEFAULT,
|
CW_USEDEFAULT,
|
||||||
CW_USEDEFAULT,
|
CW_USEDEFAULT,
|
||||||
300,
|
300,
|
||||||
|
|||||||
Reference in New Issue
Block a user