Ported all instances, now the hard part
This commit is contained in:
@@ -429,6 +429,28 @@
|
||||
<File
|
||||
RelativePath=".\src\include\DataModelV3\XplicitNgine\XplicitNgine.h">
|
||||
</File>
|
||||
<Filter
|
||||
Name="Gui"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\src\include\DataModelV3\Gui\BaseButtonInstance.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\include\DataModelV3\Gui\BaseGuiInstance.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\include\DataModelV3\Gui\GuiRootInstance.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\include\DataModelV3\Gui\ImageButtonInstance.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\include\DataModelV3\Gui\TextButtonInstance.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\include\DataModelV3\Gui\ToggleImageButtonInstance.h">
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
@@ -788,6 +810,100 @@
|
||||
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<Filter
|
||||
Name="Gui"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\src\source\DataModelV3\Gui\BaseButtonInstance.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\source\DataModelV3\Gui\BaseGuiInstance.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\source\DataModelV3\Gui\GuiRootInstance.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\source\DataModelV3\Gui\ImageButtonInstance.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\source\DataModelV3\Gui\TextButtonInstance.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\source\DataModelV3\Gui\ToggleImageButtonInstance.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
|
||||
@@ -8,7 +8,7 @@ using namespace B3D;
|
||||
#include "LevelInstance.h"
|
||||
#include "PartInstance.h"
|
||||
#include "SelectionService.h"
|
||||
//#include "GuiRootInstance.h"
|
||||
#include "Gui/GuiRootInstance.h"
|
||||
//#include "ThumbnailGeneratorInstance.h"
|
||||
#include "XplicitNgine/XplicitNgine.h"
|
||||
#include "SoundService.h"
|
||||
@@ -39,7 +39,7 @@ namespace B3D {
|
||||
bool showMessage;
|
||||
//Should probably not be here???
|
||||
G3D::GFontRef font;
|
||||
// GuiRootInstance* getGuiRoot();
|
||||
GuiRootInstance* getGuiRoot();
|
||||
SelectionService* getSelectionService();
|
||||
void clearLevel();
|
||||
void toggleRun();
|
||||
@@ -51,7 +51,7 @@ namespace B3D {
|
||||
// Instances
|
||||
WorkspaceInstance* workspace;
|
||||
LevelInstance* level;
|
||||
// GuiRootInstance* guiRoot;
|
||||
GuiRootInstance* guiRoot;
|
||||
SelectionService* selectionService;
|
||||
// ThumbnailGeneratorInstance* thumbnailGenerator;
|
||||
XplicitNgine* xplicitNgine;
|
||||
|
||||
25
src/include/DataModelV3/Gui/BaseButtonInstance.h
Normal file
25
src/include/DataModelV3/Gui/BaseButtonInstance.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
#include <G3DAll.h>
|
||||
#include "../Instance.h"
|
||||
|
||||
namespace B3D{
|
||||
class BaseButtonInstance : public Instance
|
||||
{
|
||||
public:
|
||||
BaseButtonInstance(void);
|
||||
virtual ~BaseButtonInstance(void);
|
||||
virtual void render(RenderDevice* rd);
|
||||
virtual void drawObj(RenderDevice* rd, Vector2 mousePos, bool mouseDown);
|
||||
virtual bool mouseInButton(float, float, RenderDevice* rd);
|
||||
virtual void onMouseClick();
|
||||
void setActionCode(int actionCode);
|
||||
bool floatBottom;
|
||||
bool floatRight;
|
||||
bool floatCenter;
|
||||
volatile bool disabled;
|
||||
bool selected;
|
||||
protected:
|
||||
int actionCode;
|
||||
bool mouseInArea(float, float, float, float, float, float);
|
||||
};
|
||||
}
|
||||
56
src/include/DataModelV3/Gui/BaseGuiInstance.h
Normal file
56
src/include/DataModelV3/Gui/BaseGuiInstance.h
Normal file
@@ -0,0 +1,56 @@
|
||||
#pragma once
|
||||
#include <G3DAll.h>
|
||||
#include "../Instance.h"
|
||||
namespace B3D{
|
||||
struct UDim
|
||||
{
|
||||
float scale;
|
||||
float offset;
|
||||
UDim()
|
||||
{
|
||||
scale = offset = 0;
|
||||
}
|
||||
UDim(float scale_, float offset_)
|
||||
{
|
||||
scale = scale_;
|
||||
offset = offset_;
|
||||
}
|
||||
};
|
||||
|
||||
struct UDim2
|
||||
{
|
||||
UDim x;
|
||||
UDim y;
|
||||
UDim2(UDim x_, UDim y_)
|
||||
{
|
||||
x = x_;
|
||||
y = y_;
|
||||
}
|
||||
UDim2(float scale_x, float offset_x, float scale_y, float offset_y)
|
||||
{
|
||||
x = UDim(scale_x, offset_x);
|
||||
y = UDim(scale_y, offset_y);
|
||||
}
|
||||
};
|
||||
|
||||
class BaseGuiInstance : public Instance
|
||||
{
|
||||
public:
|
||||
BaseGuiInstance(void);
|
||||
virtual ~BaseGuiInstance(void);
|
||||
virtual void render(RenderDevice* rd);
|
||||
virtual bool mouseHovered(float, float, RenderDevice* rd);
|
||||
UDim2 position;
|
||||
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:
|
||||
bool mouseInArea(float, float, float, float, float, float);
|
||||
};
|
||||
}
|
||||
34
src/include/DataModelV3/Gui/GuiRootInstance.h
Normal file
34
src/include/DataModelV3/Gui/GuiRootInstance.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
#include "../Instance.h"
|
||||
|
||||
namespace B3D{
|
||||
//TODO deprecated
|
||||
class ImageButtonInstance;
|
||||
//TODO deprecated
|
||||
class TextButtonInstance;
|
||||
class GuiRootInstance : public Instance
|
||||
{
|
||||
public:
|
||||
GuiRootInstance();
|
||||
GuiRootInstance::~GuiRootInstance();
|
||||
|
||||
//TODO deprecated
|
||||
TextButtonInstance* makeTextButton();
|
||||
void drawButtons(RenderDevice* rd);
|
||||
|
||||
//TODO deprecated
|
||||
ImageButtonInstance* makeImageButton(G3D::TextureRef newImage, G3D::TextureRef overImage, G3D::TextureRef downImage, G3D::TextureRef disableImage);
|
||||
void renderGUI(G3D::RenderDevice* rd, double fps);
|
||||
void setDebugMessage(std::string msg, G3D::RealTime msgTime);
|
||||
void update();
|
||||
bool mouseInGUI(G3D::RenderDevice* renderDevice,int x,int y);
|
||||
void onMouseLeftUp(G3D::RenderDevice* renderDevice, int x,int y);
|
||||
void hideGui(bool doHide);
|
||||
private:
|
||||
G3D::GFontRef fntdominant;
|
||||
G3D::GFontRef fntlighttrek;
|
||||
std::string _message;
|
||||
G3D::RealTime _messageTime;
|
||||
bool _hideGui;
|
||||
};
|
||||
}
|
||||
28
src/include/DataModelV3/Gui/ImageButtonInstance.h
Normal file
28
src/include/DataModelV3/Gui/ImageButtonInstance.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
#include "BaseButtonInstance.h"
|
||||
|
||||
namespace B3D{
|
||||
class BaseButtonInstance;
|
||||
class ImageButtonInstance : public BaseButtonInstance
|
||||
{
|
||||
public:
|
||||
//ImageButtonInstance(G3D::TextureRef);
|
||||
//ImageButtonInstance(G3D::TextureRef,G3D::TextureRef);
|
||||
//ImageButtonInstance(G3D::TextureRef,G3D::TextureRef,G3D::TextureRef);
|
||||
ImageButtonInstance(G3D::TextureRef,G3D::TextureRef,G3D::TextureRef,G3D::TextureRef);
|
||||
~ImageButtonInstance(void);
|
||||
void drawObj(RenderDevice*, Vector2, bool);
|
||||
Vector2 size;
|
||||
Vector2 position;
|
||||
|
||||
G3D::TextureRef image;
|
||||
int openGLID;
|
||||
G3D::TextureRef image_ovr;
|
||||
int openGLID_ovr;
|
||||
G3D::TextureRef image_dn;
|
||||
int openGLID_dn;
|
||||
G3D::TextureRef image_ds;
|
||||
int openGLID_ds;
|
||||
bool mouseInButton(float, float, RenderDevice*);
|
||||
};
|
||||
}
|
||||
37
src/include/DataModelV3/Gui/TextButtonInstance.h
Normal file
37
src/include/DataModelV3/Gui/TextButtonInstance.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
#include "BaseButtonInstance.h"
|
||||
namespace B3D{
|
||||
class TextButtonInstance : public BaseButtonInstance
|
||||
{
|
||||
public:
|
||||
TextButtonInstance(void);
|
||||
~TextButtonInstance(void);
|
||||
void setAllColorsSame();
|
||||
Vector2 boxBegin;
|
||||
Vector2 boxEnd;
|
||||
Vector2 fontLocationRelativeTo;
|
||||
Color4 textColor;
|
||||
Color4 textOutlineColor;
|
||||
Color4 boxColor;
|
||||
Color4 boxOutlineColor;
|
||||
Color4 textColorOvr;
|
||||
Color4 textOutlineColorOvr;
|
||||
Color4 boxColorOvr;
|
||||
Color4 boxOutlineColorOvr;
|
||||
Color4 textColorDn;
|
||||
Color4 textOutlineColorDn;
|
||||
Color4 boxColorDn;
|
||||
Color4 boxOutlineColorDn;
|
||||
Color4 textColorDis;
|
||||
Color4 textOutlineColorDis;
|
||||
Color4 boxColorDis;
|
||||
Color4 boxOutlineColorDis;
|
||||
bool centeredWithinBox;
|
||||
std::string title;
|
||||
G3D::GFontRef font;
|
||||
bool visible;
|
||||
int textSize;
|
||||
void drawObj(RenderDevice*, Vector2, bool);
|
||||
bool mouseInButton(float, float, RenderDevice*);
|
||||
};
|
||||
}
|
||||
31
src/include/DataModelV3/Gui/ToggleImageButtonInstance.h
Normal file
31
src/include/DataModelV3/Gui/ToggleImageButtonInstance.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
#include "ImageButtonInstance.h"
|
||||
|
||||
namespace B3D{
|
||||
class ToggleImageButtonInstance : public ImageButtonInstance
|
||||
{
|
||||
public:
|
||||
//ImageButtonInstance(G3D::TextureRef);
|
||||
//ImageButtonInstance(G3D::TextureRef,G3D::TextureRef);
|
||||
//ImageButtonInstance(G3D::TextureRef,G3D::TextureRef,G3D::TextureRef);
|
||||
//Oh dear god
|
||||
ToggleImageButtonInstance(G3D::TextureRef newImage,G3D::TextureRef overImage = NULL,
|
||||
G3D::TextureRef downImage = NULL,
|
||||
G3D::TextureRef disableImage = NULL,
|
||||
G3D::TextureRef newImage2 = NULL,
|
||||
G3D::TextureRef overImage2 = NULL,
|
||||
G3D::TextureRef downImage2 = NULL,
|
||||
G3D::TextureRef disableImage2 = NULL);
|
||||
~ToggleImageButtonInstance(void);
|
||||
void drawObj(RenderDevice*, Vector2, bool);
|
||||
bool checked;
|
||||
G3D::TextureRef image2;
|
||||
int openGLID2;
|
||||
G3D::TextureRef image_ovr2;
|
||||
int openGLID2_ovr;
|
||||
G3D::TextureRef image_dn2;
|
||||
int openGLID2_dn;
|
||||
G3D::TextureRef image_ds2;
|
||||
int openGLID2_ds;
|
||||
};
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
#pragma once
|
||||
#define WINVER 0x0400
|
||||
#include "Reflection/Reflection.h"
|
||||
#include "Reflection/ReflectionDataTable.h"
|
||||
#include "Reflection/ReflectionProperty.h"
|
||||
|
||||
@@ -9,7 +9,7 @@ DataModelInstance::DataModelInstance(void)
|
||||
|
||||
parentDataModel = this;
|
||||
workspace = new WorkspaceInstance();
|
||||
//guiRoot = new GuiRootInstance();
|
||||
guiRoot = new GuiRootInstance();
|
||||
level = new LevelInstance();
|
||||
//thumbnailGenerator = new ThumbnailGeneratorInstance();
|
||||
soundService = new SoundService();
|
||||
@@ -27,6 +27,7 @@ DataModelInstance::DataModelInstance(void)
|
||||
level->setParent(this);
|
||||
soundService->setParent(this);
|
||||
lightingInstance->setParent(this);
|
||||
guiRoot->setParent(this);
|
||||
|
||||
running = false;
|
||||
xplicitNgine = NULL;
|
||||
@@ -305,10 +306,10 @@ WorkspaceInstance* DataModelInstance::getWorkspace()
|
||||
}
|
||||
|
||||
//TODO implement
|
||||
/*GuiRootInstance* DataModelInstance::getGuiRoot()
|
||||
GuiRootInstance* DataModelInstance::getGuiRoot()
|
||||
{
|
||||
return guiRoot;
|
||||
}*/
|
||||
}
|
||||
|
||||
SelectionService* DataModelInstance::getSelectionService()
|
||||
{
|
||||
|
||||
52
src/source/DataModelV3/Gui/BaseButtonInstance.cpp
Normal file
52
src/source/DataModelV3/Gui/BaseButtonInstance.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
#include "DataModelV3/Gui/BaseButtonInstance.h"
|
||||
using namespace B3D;
|
||||
|
||||
BaseButtonInstance::BaseButtonInstance(void)
|
||||
{
|
||||
Instance::Instance();
|
||||
actionCode = 0;
|
||||
}
|
||||
|
||||
void BaseButtonInstance::render(RenderDevice* rd)
|
||||
{
|
||||
//TODO make mouse a member of datamodel
|
||||
//Vector2 pos = Vector2(g_usableApp->mouse.x,g_usableApp->mouse.y);
|
||||
//drawObj(rd, pos, g_usableApp->mouse.isMouseDown());
|
||||
Instance::render(rd);
|
||||
}
|
||||
|
||||
BaseButtonInstance::~BaseButtonInstance(void)
|
||||
{
|
||||
}
|
||||
|
||||
void BaseButtonInstance::setActionCode(int actionCode)
|
||||
{
|
||||
this->actionCode = actionCode;
|
||||
}
|
||||
|
||||
void BaseButtonInstance::drawObj(RenderDevice* rd, Vector2 mousePos, bool mouseDown){}
|
||||
|
||||
bool BaseButtonInstance::mouseInButton(float mousex, float mousey, RenderDevice* rd){return false;}
|
||||
|
||||
void BaseButtonInstance::onMouseClick()
|
||||
{
|
||||
// if(listener != NULL)
|
||||
// {
|
||||
// listener->onButton1MouseClick(this);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
bool BaseButtonInstance::mouseInArea(float point1x, float point1y, float point2x, float point2y, float mousex, float mousey)
|
||||
{
|
||||
|
||||
|
||||
if(mousex >= point1x && mousey >= point1y)
|
||||
{
|
||||
if(mousex < point2x && mousey < point2y)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
2
src/source/DataModelV3/Gui/BaseGuiInstance.cpp
Normal file
2
src/source/DataModelV3/Gui/BaseGuiInstance.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
#include "DataModelV3/Gui/BaseGuiInstance.h"
|
||||
//TODO what??
|
||||
613
src/source/DataModelV3/Gui/GuiRootInstance.cpp
Normal file
613
src/source/DataModelV3/Gui/GuiRootInstance.cpp
Normal file
@@ -0,0 +1,613 @@
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include "G3DAll.h"
|
||||
#include "DataModelV3/Gui/BaseButtonInstance.h"
|
||||
#include "DataModelV3/Gui/TextButtonInstance.h"
|
||||
#include "DataModelV3/Gui/ImageButtonInstance.h"
|
||||
#include "DataModelV3/Gui/ToggleImageButtonInstance.h"
|
||||
#include "DataModelV3/Gui/GuiRootInstance.h"
|
||||
#include "DataModelV3/Gui/ImageButtonInstance.h"
|
||||
#include "DataModelV3/DataModelInstance.h"
|
||||
#include "StringFunctions.h"
|
||||
|
||||
using namespace B3D;
|
||||
|
||||
#ifndef _DEBUG
|
||||
#if _MSC_VER== 1310
|
||||
#define VS03_WORKAROUND &
|
||||
#else
|
||||
#define VS03_WORKAROUND
|
||||
#endif
|
||||
#else
|
||||
#define VS03_WORKAROUND
|
||||
#endif
|
||||
|
||||
ImageButtonInstance* GuiRootInstance::makeImageButton(G3D::TextureRef newImage = NULL, G3D::TextureRef overImage = NULL, G3D::TextureRef downImage = NULL, G3D::TextureRef disableImage = NULL)
|
||||
{
|
||||
//Oh come on
|
||||
ImageButtonInstance* part = new ImageButtonInstance(newImage,overImage, downImage, disableImage);
|
||||
// instances.push_back(part);
|
||||
// instances_2D.push_back(part);
|
||||
return part;
|
||||
}
|
||||
|
||||
TextButtonInstance* GuiRootInstance::makeTextButton()
|
||||
{
|
||||
TextButtonInstance* part = new TextButtonInstance();
|
||||
return part;
|
||||
}
|
||||
GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
|
||||
{
|
||||
//AAAAAAA
|
||||
fntdominant = GFont::fromFile(GetFileInPath("/content/font/dominant.fnt"));
|
||||
fntlighttrek = GFont::fromFile(GetFileInPath("/content/font/lighttrek.fnt"));
|
||||
_hideGui = false;
|
||||
|
||||
//Bottom Left
|
||||
TextButtonInstance* button = makeTextButton();
|
||||
button->boxBegin = Vector2(0, -24);
|
||||
button->boxEnd = Vector2(80, 0);
|
||||
button->floatBottom = true;
|
||||
button->setParent(this);
|
||||
button->font = fntlighttrek;
|
||||
button->textColor = Color3(0,255,255);
|
||||
button->textOutlineColor = Color4::clear();
|
||||
button->title = "Hopper";
|
||||
button->fontLocationRelativeTo = Vector2(10, 3);
|
||||
button->setAllColorsSame();
|
||||
button->boxOutlineColorOvr = Color3(0,255,255);
|
||||
button->boxColorDn = Color4(button->boxColor.r,button->boxColor.g,button->boxColor.b, 0.2F);
|
||||
//TODO Define Action
|
||||
//button->setButtonListener(toolbar);
|
||||
//toolbar.addButtonRef(button);
|
||||
|
||||
|
||||
button = makeTextButton();
|
||||
button->boxBegin = Vector2(0, -48);
|
||||
button->boxEnd = Vector2(80, -24);
|
||||
button->floatBottom = true;
|
||||
button->setParent(this);
|
||||
button->font = fntlighttrek;
|
||||
button->textColor = Color3(0,255,255);
|
||||
button->textOutlineColor = Color4::clear();
|
||||
button->title = "Controller";
|
||||
button->fontLocationRelativeTo = Vector2(10, 3);
|
||||
button->setAllColorsSame();
|
||||
button->boxOutlineColorOvr = Color3(0,255,255);
|
||||
button->boxColorDn = Color4(button->boxColor.r,button->boxColor.g,button->boxColor.b, 0.2F);
|
||||
//TODO Define Action
|
||||
//button->setButtonListener(toolbar);
|
||||
//toolbar.addButtonRef(button);
|
||||
|
||||
button = makeTextButton();
|
||||
button->boxBegin = Vector2(0, -72);
|
||||
button->boxEnd = Vector2(80, -48);
|
||||
button->floatBottom = true;
|
||||
button->setParent(this);
|
||||
button->font = fntlighttrek;
|
||||
button->textColor = Color3(0,255,255);
|
||||
button->textOutlineColor = Color4::clear();
|
||||
button->title = "Color";
|
||||
button->fontLocationRelativeTo = Vector2(10, 3);
|
||||
button->setAllColorsSame();
|
||||
button->boxOutlineColorOvr = Color3(0,255,255);
|
||||
button->boxColorDn = Color4(button->boxColor.r,button->boxColor.g,button->boxColor.b, 0.2F);
|
||||
//TODO Define Action
|
||||
//button->setButtonListener(toolbar);
|
||||
//toolbar.addButtonRef(button);
|
||||
|
||||
button = makeTextButton();
|
||||
button->boxBegin = Vector2(0, -96);
|
||||
button->boxEnd = Vector2(80, -72);
|
||||
button->floatBottom = true;
|
||||
button->setParent(this);
|
||||
button->font = fntlighttrek;
|
||||
button->textColor = Color3(0,255,255);
|
||||
button->textOutlineColor = Color4::clear();
|
||||
button->title = "Surface";
|
||||
button->fontLocationRelativeTo = Vector2(10, 3);
|
||||
button->setAllColorsSame();
|
||||
button->boxOutlineColorOvr = Color3(0,255,255);
|
||||
button->boxColorDn = Color4(button->boxColor.r,button->boxColor.g,button->boxColor.b, 0.2F);
|
||||
//TODO Define Action
|
||||
//button->setButtonListener(toolbar);
|
||||
//toolbar.addButtonRef(button);
|
||||
|
||||
button = makeTextButton();
|
||||
button->boxBegin = Vector2(0, -120);
|
||||
button->boxEnd = Vector2(80, -96);
|
||||
button->floatBottom = true;
|
||||
button->setParent(this);
|
||||
button->font = fntlighttrek;
|
||||
button->textColor = Color3(0,255,255);
|
||||
button->title = "Model";
|
||||
button->selected = true;
|
||||
button->fontLocationRelativeTo = Vector2(10, 3);
|
||||
button->setAllColorsSame();
|
||||
button->boxOutlineColorOvr = Color3(0,255,255);
|
||||
button->boxColorDn = Color4(button->boxColor.r,button->boxColor.g,button->boxColor.b, 0.2F);
|
||||
//TODO Define Action
|
||||
//button->setButtonListener(toolbar);
|
||||
//toolbar.addButtonRef(button);
|
||||
|
||||
//Top bar
|
||||
button = makeTextButton();
|
||||
button->boxBegin = Vector2(0, 0);
|
||||
button->boxEnd = Vector2(125, 25);
|
||||
button->setParent(this);
|
||||
button->font = fntlighttrek;
|
||||
button->textColor = Color3::white();
|
||||
button->boxColor = Color4::clear();
|
||||
button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F);
|
||||
button->title = "File";
|
||||
button->textSize = 16;
|
||||
button->fontLocationRelativeTo = Vector2(10, 0);
|
||||
button->setAllColorsSame();
|
||||
button->boxColorOvr = Color4(0.6F,0.6F,0.6F,0.4F);
|
||||
button->name = "file";
|
||||
//TODO Define Action
|
||||
//button->setButtonListener(menuListener);
|
||||
|
||||
button = makeTextButton();
|
||||
button->boxBegin = Vector2(125, 0);
|
||||
button->boxEnd = Vector2(250, 25);
|
||||
button->setParent(this);
|
||||
button->font = fntlighttrek;
|
||||
button->textColor = Color3::white();
|
||||
button->boxColor = Color4::clear();
|
||||
button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F);
|
||||
button->title = "Edit";
|
||||
button->textSize = 16;
|
||||
button->fontLocationRelativeTo = Vector2(10, 0);
|
||||
button->setAllColorsSame();
|
||||
button->boxColorOvr = Color4(0.6F,0.6F,0.6F,0.4F);
|
||||
button->name = "edit";
|
||||
//TODO Define Action
|
||||
//button->setButtonListener(menuListener);
|
||||
|
||||
button = makeTextButton();
|
||||
button->boxBegin = Vector2(250, 0);
|
||||
button->boxEnd = Vector2(375, 25);
|
||||
button->setParent(this);
|
||||
button->font = fntlighttrek;
|
||||
button->textColor = Color3::white();
|
||||
button->boxColor = Color4::clear();
|
||||
button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F);
|
||||
button->title = "View";
|
||||
button->textSize = 16;
|
||||
button->fontLocationRelativeTo = Vector2(10, 0);
|
||||
button->setAllColorsSame();
|
||||
button->boxColorOvr = Color4(0.6F,0.6F,0.6F,0.4F);
|
||||
button->name = "view";
|
||||
//TODO Define Action
|
||||
//button->setButtonListener(menuListener);
|
||||
|
||||
button = makeTextButton();
|
||||
button->boxBegin = Vector2(375, 0);
|
||||
button->boxEnd = Vector2(500, 25);
|
||||
button->setParent(this);
|
||||
button->font = fntlighttrek;
|
||||
button->textColor = Color3::white();
|
||||
button->boxColor = Color4::clear();
|
||||
button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F);
|
||||
button->title = "Insert";
|
||||
button->textSize = 16;
|
||||
button->fontLocationRelativeTo = Vector2(10, 0);
|
||||
button->setAllColorsSame();
|
||||
button->boxColorOvr = Color4(0.6F,0.6F,0.6F,0.4F);
|
||||
button->name = "insert";
|
||||
//TODO Define Action
|
||||
//button->setButtonListener(menuListener);
|
||||
|
||||
button = makeTextButton();
|
||||
button->boxBegin = Vector2(500, 0);
|
||||
button->boxEnd = Vector2(625, 25);
|
||||
button->setParent(this);
|
||||
button->font = fntlighttrek;
|
||||
button->textColor = Color3::white();
|
||||
button->boxColor = Color4::clear();
|
||||
button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F);
|
||||
button->title = "Format";
|
||||
button->textSize = 16;
|
||||
button->fontLocationRelativeTo = Vector2(10, 0);
|
||||
button->setAllColorsSame();
|
||||
button->boxColorOvr = Color4(0.6F,0.6F,0.6F,0.4F);
|
||||
button->name = "format";
|
||||
//TODO Define Action
|
||||
//button->setButtonListener(menuListener);
|
||||
|
||||
//Menu
|
||||
button = makeTextButton();
|
||||
button->boxBegin = Vector2(0,215);
|
||||
button->boxEnd = Vector2(80,235);
|
||||
button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F);
|
||||
button->textColor = Color3(0,1,1);
|
||||
button->boxColor = Color4::clear();
|
||||
button->textSize = 12;
|
||||
button->title = "Group";
|
||||
button->name = "Group";
|
||||
button->setAllColorsSame();
|
||||
button->textColorDis = Color3(0.8F,0.8F,0.8F);
|
||||
button->boxColorOvr = Color4(0.6F,0.6F,0.6F,0.4F);
|
||||
button->font = fntlighttrek;
|
||||
button->fontLocationRelativeTo = Vector2(10, 0);
|
||||
button->setParent(this);
|
||||
//TODO Define Action
|
||||
//button->setButtonListener(gud);
|
||||
|
||||
button = makeTextButton();
|
||||
button->boxBegin = Vector2(0,240);
|
||||
button->boxEnd = Vector2(80,260);
|
||||
button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F);
|
||||
button->textColor = Color3(0,1,1);
|
||||
button->boxColor = Color4::clear();
|
||||
button->textSize = 12;
|
||||
button->title = "UnGroup";
|
||||
button->name = "UnGroup";
|
||||
button->setAllColorsSame();
|
||||
button->textColorDis = Color3(0.8F,0.8F,0.8F);
|
||||
button->boxColorOvr = Color4(0.6F,0.6F,0.6F,0.4F);
|
||||
button->font = fntlighttrek;
|
||||
button->fontLocationRelativeTo = Vector2(10, 0);
|
||||
button->setParent(this);
|
||||
//TODO Define Action
|
||||
//button->setButtonListener(gud);
|
||||
|
||||
button = makeTextButton();
|
||||
button->boxBegin = Vector2(0,265);
|
||||
button->boxEnd = Vector2(80,285);
|
||||
button->textOutlineColor = Color4(0.5F,0.5F,0.5F,0.5F);
|
||||
button->textColor = Color3(0,1,1);
|
||||
button->boxColor = Color4::clear();
|
||||
button->textSize = 12;
|
||||
button->title = "Duplicate";
|
||||
button->setAllColorsSame();
|
||||
button->textColorDis = Color3(0.8F,0.8F,0.8F);
|
||||
button->boxColorOvr = Color4(0.6F,0.6F,0.6F,0.4F);
|
||||
button->font = fntlighttrek;
|
||||
button->fontLocationRelativeTo = Vector2(10, 0);
|
||||
button->setParent(this);
|
||||
button->name = "Duplicate";
|
||||
//TODO Define Action
|
||||
//button->setButtonListener(gud);
|
||||
|
||||
//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 = fntlighttrek;
|
||||
button->fontLocationRelativeTo = Vector2(10, 0);
|
||||
button->setParent(this);
|
||||
button->name = "MENU";
|
||||
//TODO Define Action
|
||||
//button->setButtonListener(menuListener);
|
||||
|
||||
ImageButtonInstance* instance = new ToggleImageButtonInstance(
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/Run.png")),
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/Run_ovr.png")),
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/Run_dn.png")),
|
||||
NULL,
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/Stop.png")),
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/Stop_ovr.png")),
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/Stop_dn.png"))
|
||||
);
|
||||
//TODO Define Action
|
||||
//instance->setButtonListener(menuListener);
|
||||
instance->name = "go";
|
||||
instance->size = Vector2(65,65);
|
||||
instance->position = Vector2(6.5, 25);
|
||||
instance->setParent(this);
|
||||
|
||||
|
||||
instance = makeImageButton(
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/ArrowTool.png")),
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/ArrowTool_ovr.png")),
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/ArrowTool_dn.png")),
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/ArrowTool_ds.png")));
|
||||
instance->size = Vector2(50,50);
|
||||
instance->position = Vector2(15, 90);
|
||||
instance->setParent(this);
|
||||
instance->name = "Cursor";
|
||||
//TODO Define Action
|
||||
//instance->setButtonListener(msl);
|
||||
|
||||
instance = makeImageButton(Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/ScaleTool.png")),Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/ScaleTool_ovr.png")),Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/ScaleTool_dn.png")),Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/ScaleTool_ds.png")));
|
||||
instance->size = Vector2(40,40);
|
||||
instance->position = Vector2(0, 140);
|
||||
instance->setParent(this);
|
||||
instance->name = "Resize";
|
||||
//TODO Define Action
|
||||
//instance->setButtonListener(msl);
|
||||
|
||||
|
||||
instance = makeImageButton(
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/MoveTool.png")),
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/MoveTool_ovr.png")),
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/MoveTool_dn.png")),
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/MoveTool_ds.png")));
|
||||
instance->size = Vector2(40,40);
|
||||
instance->position = Vector2(40, 140);
|
||||
instance->setParent(this);
|
||||
instance->name = "Arrows";
|
||||
//TODO Define Action
|
||||
//instance->setButtonListener(msl);
|
||||
|
||||
instance = makeImageButton(
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/SelectionRotate.png")),
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/SelectionRotate_ovr.png")),
|
||||
NULL,
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/SelectionRotate_ds.png")));
|
||||
instance->size = Vector2(30,30);
|
||||
instance->position = Vector2(10, 175);
|
||||
instance->setParent(this);
|
||||
instance->name = "Rotate";
|
||||
//TODO Define Action
|
||||
//instance->setButtonListener(rbl);
|
||||
|
||||
instance = makeImageButton(
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/SelectionTilt.png")),
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/SelectionTilt_ovr.png")),
|
||||
NULL,
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/SelectionTilt_ds.png")));
|
||||
instance->size = Vector2(30,30);
|
||||
instance->position = Vector2(40, 175);
|
||||
instance->setParent(this);
|
||||
instance->name = "Tilt";
|
||||
//TODO Define Action
|
||||
//instance->setButtonListener(rbl);
|
||||
|
||||
|
||||
instance = makeImageButton(
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/Delete.png")),
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/Delete_ovr.png")),
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/Delete_dn.png")),
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/Delete_ds.png")));
|
||||
instance->size = Vector2(40,46);
|
||||
instance->position = Vector2(20, 284);
|
||||
instance->setParent(this);
|
||||
instance->name = "Delete";
|
||||
//TODO Define Action
|
||||
//instance->setButtonListener(delet);
|
||||
|
||||
instance = makeImageButton(
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraZoomIn.png")),
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraZoomIn_ovr.png")),
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraZoomIn_dn.png")));
|
||||
instance->size = Vector2(34,25);
|
||||
instance->floatBottom = true;
|
||||
instance->floatRight = true;
|
||||
instance->position = Vector2(-77, -90);
|
||||
instance->setParent(this);
|
||||
instance->name = "ZoomIn";
|
||||
//TODO Define Action
|
||||
//instance->setButtonListener(cam);
|
||||
|
||||
instance = makeImageButton(
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraZoomOut.png")),
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraZoomOut_ovr.png")),
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraZoomOut_dn.png")));
|
||||
instance->size = Vector2(34,26);
|
||||
instance->floatBottom = true;
|
||||
instance->floatRight = true;
|
||||
instance->position = Vector2(-77, -31);
|
||||
instance->setParent(this);
|
||||
instance->name = "ZoomOut";
|
||||
//TODO Define Action
|
||||
//instance->setButtonListener(cam);
|
||||
|
||||
instance = makeImageButton(
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraPanLeft.png")),
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraPanLeft_ovr.png")),
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraPanLeft_dn.png")));
|
||||
instance->size = Vector2(34,34);
|
||||
instance->floatBottom = true;
|
||||
instance->floatRight = true;
|
||||
instance->position = Vector2(-110, -50);
|
||||
instance->setParent(this);
|
||||
instance->name = "PanLeft";
|
||||
//TODO Define Action
|
||||
//instance->setButtonListener(cam);
|
||||
|
||||
instance = makeImageButton(
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraPanRight.png")),
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraPanRight_ovr.png")),
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraPanRight_dn.png")));
|
||||
instance->size = Vector2(34,34);
|
||||
instance->floatBottom = true;
|
||||
instance->floatRight = true;
|
||||
instance->position = Vector2(-45, -50);
|
||||
instance->setParent(this);
|
||||
instance->name = "PanRight";
|
||||
//TODO Define Action
|
||||
//instance->setButtonListener(cam);
|
||||
|
||||
instance = makeImageButton(
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraCenter.png")),
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraCenter_ovr.png")),
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraCenter_dn.png")));
|
||||
instance->size = Vector2(34,20);
|
||||
instance->floatBottom = true;
|
||||
instance->floatRight = true;
|
||||
instance->position = Vector2(-77, -60);
|
||||
instance->setParent(this);
|
||||
instance->name = "CenterCam";
|
||||
//TODO Define Action
|
||||
//instance->setButtonListener(cam);
|
||||
|
||||
instance = makeImageButton(
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraTiltUp.png")),
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraTiltUp_ovr.png")),
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraTiltUp_dn.png")));
|
||||
instance->size = Vector2(24,24);
|
||||
instance->floatBottom = true;
|
||||
instance->floatRight = true;
|
||||
instance->position = Vector2(-105, -75);
|
||||
instance->setParent(this);
|
||||
instance->name = "TiltUp";
|
||||
//TODO Define Action
|
||||
//instance->setButtonListener(cam);
|
||||
|
||||
instance = makeImageButton(
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraTiltDown.png")),
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraTiltDown_ovr.png")),
|
||||
Texture::fromFile(VS03_WORKAROUND GetFileInPath("/content/images/CameraTiltDown_dn.png")));
|
||||
instance->size = Vector2(24,24);
|
||||
instance->floatBottom = true;
|
||||
instance->floatRight = true;
|
||||
instance->position = Vector2(-40, -75);
|
||||
instance->setParent(this);
|
||||
instance->name = "TiltDown";
|
||||
//TODO Define Action
|
||||
//instance->setButtonListener(cam);
|
||||
}
|
||||
|
||||
|
||||
void GuiRootInstance::drawButtons(RenderDevice* rd)
|
||||
{
|
||||
rd->pushState();
|
||||
rd->beforePrimitive();
|
||||
//this->render(rd);
|
||||
rd->afterPrimitive();
|
||||
rd->popState();
|
||||
}
|
||||
|
||||
void GuiRootInstance::setDebugMessage(std::string msg, G3D::RealTime msgTime)
|
||||
{
|
||||
_messageTime = msgTime;
|
||||
_message = msg;
|
||||
}
|
||||
|
||||
//void GuiRootInstance::render(G3D::RenderDevice* renderDevice) {}
|
||||
|
||||
void GuiRootInstance::renderGUI(G3D::RenderDevice* rd, double fps)
|
||||
{
|
||||
if(_hideGui) return;
|
||||
//TODO--Move these to their own instance
|
||||
|
||||
std::stringstream stream;
|
||||
stream << std::fixed << std::setprecision(1) << parentDataModel->getLevel()->timer.getValue();
|
||||
fntdominant->draw2D(rd, "Timer: " + stream.str(), Vector2(rd->getWidth() - 120, 25), 20, Color3::fromARGB(0x81C518), Color3::black());
|
||||
fntdominant->draw2D(rd, "Score: " + Convert(parentDataModel->getLevel()->score.getValue()), Vector2(rd->getWidth() - 120, 50), 20, Color3::fromARGB(0x81C518), Color3::black());
|
||||
//FPS
|
||||
#ifdef _DEBUG
|
||||
stream.str("");
|
||||
stream.clear();
|
||||
stream << std::fixed << std::setprecision(3) << fps;
|
||||
fntdominant->draw2D(rd, "FPS: " + stream.str(), Vector2(120, 25), 10, Color3::fromARGB(0xFFFF00), Color3::black());
|
||||
#endif
|
||||
//GUI Boxes
|
||||
Draw::box(G3D::Box(Vector3(0,25,0),Vector3(80,355,0)),rd,Color4(0.6F,0.6F,0.6F,0.4F), Color4(0,0,0,0));
|
||||
Draw::box(G3D::Box(Vector3(rd->getWidth() - 120,rd->getHeight() - 117,0),Vector3(rd->getWidth(),rd->getHeight(),0)),rd,Color4(0.6F,0.6F,0.6F,0.4F), Color4(0,0,0,0));
|
||||
|
||||
//Camera menu title
|
||||
fntlighttrek->draw2D(rd, "CameraMenu", Vector2(rd->getWidth()-(fntlighttrek->get2DStringBounds("CameraMenu", 14).x+1),rd->getHeight() - 120), 14, Color3::white(), Color4(0.5F,0.5F,0.5F,0.5F));
|
||||
|
||||
//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));
|
||||
|
||||
|
||||
|
||||
//drawButtons(rd);
|
||||
if(System::time() - 3 < _messageTime)
|
||||
{
|
||||
fntdominant->draw2D(rd, _message, Vector2((rd->getWidth()/2)-(fntdominant->get2DStringBounds(_message, 20).x/2),(rd->getHeight()/2)-(fntdominant->get2DStringBounds(_message, 20).y/2)), 20, Color3::yellow(), Color3::black());
|
||||
}
|
||||
|
||||
parentDataModel->drawMessage(rd);
|
||||
render(rd);
|
||||
}
|
||||
|
||||
bool GuiRootInstance::mouseInGUI(G3D::RenderDevice* renderDevice,int x,int y)
|
||||
{
|
||||
//What???
|
||||
std::vector<Instance*> instances_2D = parentDataModel->getGuiRoot()->getAllChildren();
|
||||
for(size_t i = 0; i < instances_2D.size(); i++)
|
||||
{
|
||||
if(BaseButtonInstance* button = dynamic_cast<BaseButtonInstance*>(instances_2D.at(i)))
|
||||
{
|
||||
if(button->mouseInButton(x,y, renderDevice))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//Oh eww...
|
||||
void GuiRootInstance::update()
|
||||
{
|
||||
Instance * obj6 = this->findFirstChild("Delete");
|
||||
Instance * obj = this->findFirstChild("Duplicate");
|
||||
Instance * obj2 = this->findFirstChild("Group");
|
||||
Instance * obj3 = this->findFirstChild("UnGroup");
|
||||
Instance * obj4 = this->findFirstChild("Rotate");
|
||||
Instance * obj5 = this->findFirstChild("Tilt");
|
||||
|
||||
SelectionService* getSelectionService = parentDataModel->getSelectionService();
|
||||
|
||||
if(obj != NULL && obj2 != NULL && obj3 != NULL && obj4 !=NULL && obj5 != NULL && obj6 != NULL)
|
||||
{
|
||||
BaseButtonInstance* button = (BaseButtonInstance*)obj;
|
||||
BaseButtonInstance* button2 = (BaseButtonInstance*)obj2;
|
||||
BaseButtonInstance* button3 = (BaseButtonInstance*)obj3;
|
||||
BaseButtonInstance* button4 = (BaseButtonInstance*)obj4;
|
||||
BaseButtonInstance* button5 = (BaseButtonInstance*)obj5;
|
||||
BaseButtonInstance* button6 = (BaseButtonInstance*)obj6;
|
||||
button->disabled = true;
|
||||
button2->disabled = true;
|
||||
button3->disabled = true;
|
||||
button4->disabled = true;
|
||||
button5->disabled = true;
|
||||
button6->disabled = true;
|
||||
for(size_t i = 0; i < getSelectionService->getSelection().size(); i++)
|
||||
if(getSelectionService->getSelection()[i]->canDelete)
|
||||
{
|
||||
button->disabled = false;
|
||||
button4->disabled = false;
|
||||
button5->disabled = false;
|
||||
button6->disabled = false;
|
||||
|
||||
|
||||
if (getSelectionService->getSelection().size() > 1){
|
||||
button2->disabled = false;
|
||||
}
|
||||
|
||||
if (dynamic_cast<GroupInstance*>(getSelectionService->getSelection()[i])){
|
||||
button3->disabled = false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GuiRootInstance::~GuiRootInstance()
|
||||
{
|
||||
}
|
||||
|
||||
void GuiRootInstance::onMouseLeftUp(G3D::RenderDevice* renderDevice, int x,int y)
|
||||
{
|
||||
std::vector<Instance*> instances_2D = this->getAllChildren();
|
||||
for(size_t i = 0; i < instances_2D.size(); i++)
|
||||
{
|
||||
if(BaseButtonInstance* button = dynamic_cast<BaseButtonInstance*>(instances_2D[i]))
|
||||
{
|
||||
if(button->mouseInButton(x, y, renderDevice))
|
||||
{
|
||||
button->onMouseClick();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GuiRootInstance::hideGui(bool doHide) {
|
||||
_hideGui = doHide;
|
||||
}
|
||||
133
src/source/DataModelV3/Gui/ImageButtonInstance.cpp
Normal file
133
src/source/DataModelV3/Gui/ImageButtonInstance.cpp
Normal file
@@ -0,0 +1,133 @@
|
||||
#include "DataModelV3/Gui/ImageButtonInstance.h"
|
||||
|
||||
//TODO ***what the hell***
|
||||
using namespace B3D;
|
||||
ImageButtonInstance::ImageButtonInstance(G3D::TextureRef newImage, G3D::TextureRef overImage = NULL, G3D::TextureRef downImage = NULL, G3D::TextureRef disableImage = NULL)
|
||||
{
|
||||
BaseButtonInstance::BaseButtonInstance();
|
||||
image = newImage;
|
||||
openGLID = image->getOpenGLID();
|
||||
image_ovr = overImage;
|
||||
if(!image_ovr.isNull())
|
||||
openGLID_ovr = image_ovr->getOpenGLID();
|
||||
image_dn = downImage;
|
||||
if(!image_dn.isNull())
|
||||
openGLID_dn = image_dn->getOpenGLID();
|
||||
image_ds = disableImage;
|
||||
if(!image_ds.isNull())
|
||||
openGLID_ds = image_ds->getOpenGLID();
|
||||
Vector2 size = Vector2(0,0);
|
||||
Vector2 position = Vector2(0,0);
|
||||
floatCenter = false;
|
||||
floatBottom = false;
|
||||
floatRight = false;
|
||||
disabled = false;
|
||||
}
|
||||
|
||||
ImageButtonInstance::~ImageButtonInstance(void)
|
||||
{
|
||||
//Delete everything on destruction
|
||||
image.~ReferenceCountedPointer();
|
||||
delete image.getPointer();
|
||||
image_ovr.~ReferenceCountedPointer();
|
||||
delete image_ovr.getPointer();
|
||||
image_ds.~ReferenceCountedPointer();
|
||||
delete image_ds.getPointer();
|
||||
image_dn.~ReferenceCountedPointer();
|
||||
delete image_dn.getPointer();
|
||||
image = NULL;
|
||||
image_ovr = NULL;
|
||||
image_ds = NULL;
|
||||
image_dn = NULL;
|
||||
actionCode = 0;
|
||||
selected = false;
|
||||
}
|
||||
|
||||
bool ImageButtonInstance::mouseInButton(float mousex, float mousey, RenderDevice* rd)
|
||||
{
|
||||
Vector2 positionRelative = position;
|
||||
if(floatRight && floatBottom)
|
||||
{
|
||||
positionRelative = Vector2(rd->getWidth() + position.x, rd->getHeight() + position.y);
|
||||
}
|
||||
else if(floatBottom)
|
||||
{
|
||||
positionRelative = Vector2(position.x, rd->getHeight() + position.y);
|
||||
}
|
||||
else if(floatRight)
|
||||
{
|
||||
positionRelative = Vector2(rd->getWidth() + position.x, position.y);
|
||||
}
|
||||
if(mousex >= positionRelative.x && mousey >= positionRelative.y)
|
||||
{
|
||||
if(mousex < positionRelative.x + size.x && mousey < positionRelative.y + size.y)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void ImageButtonInstance::drawObj(RenderDevice* rd, Vector2 mousePos, bool mouseDown)
|
||||
{
|
||||
bool drawDisabledBox = false;
|
||||
Vector2 positionRelative = position;
|
||||
if(floatRight && floatBottom)
|
||||
{
|
||||
positionRelative = Vector2(rd->getWidth() + position.x, rd->getHeight() + position.y);
|
||||
}
|
||||
else if(floatBottom)
|
||||
{
|
||||
positionRelative = Vector2(position.x, rd->getHeight() + position.y);
|
||||
}
|
||||
else if(floatRight)
|
||||
{
|
||||
positionRelative = Vector2(rd->getWidth() + position.x, position.y);
|
||||
}
|
||||
int renderimage = openGLID;
|
||||
if(selected == true && !image_dn.isNull() && !disabled)
|
||||
{
|
||||
renderimage = openGLID_dn;
|
||||
}
|
||||
else if(disabled)
|
||||
{
|
||||
if(!image_ds.isNull())
|
||||
renderimage = openGLID_ds;
|
||||
else
|
||||
drawDisabledBox = true;
|
||||
}
|
||||
else if(mouseInArea(positionRelative.x, positionRelative.y, positionRelative.x + size.x, positionRelative.y + size.y, mousePos.x, mousePos.y))
|
||||
{
|
||||
if(mouseDown && !image_dn.isNull())
|
||||
{
|
||||
renderimage = openGLID_dn;
|
||||
}
|
||||
else if(!image_ovr.isNull())
|
||||
{
|
||||
renderimage = openGLID_ovr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
glEnable( GL_TEXTURE_2D );
|
||||
glEnable(GL_BLEND);// you enable blending function
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glBindTexture( GL_TEXTURE_2D, renderimage);
|
||||
glBegin( GL_QUADS );
|
||||
glTexCoord2d(0.0,0.0);
|
||||
glVertex2f( positionRelative.x, positionRelative.y );
|
||||
glTexCoord2d( 1.0,0.0 );
|
||||
glVertex2f( positionRelative.x + size.x, positionRelative.y );
|
||||
glTexCoord2d( 1.0,1.0 );
|
||||
glVertex2f( positionRelative.x + size.x, positionRelative.y + size.y );
|
||||
glTexCoord2d( 0.0,1.0 );
|
||||
glVertex2f( positionRelative.x, positionRelative.y + size.y );
|
||||
glEnd();
|
||||
glDisable( GL_TEXTURE_2D );
|
||||
|
||||
if(drawDisabledBox)
|
||||
{
|
||||
Draw::box(Box(Vector3(positionRelative.x, positionRelative.y, 0), Vector3(positionRelative.x+size.x, positionRelative.y+size.y, 0)), rd, Color4(0.7F,0.7F,0.7F,0.3F), Color4::clear());
|
||||
}
|
||||
}
|
||||
112
src/source/DataModelV3/Gui/TextButtonInstance.cpp
Normal file
112
src/source/DataModelV3/Gui/TextButtonInstance.cpp
Normal file
@@ -0,0 +1,112 @@
|
||||
#include "DataModelV3/Gui/TextButtonInstance.h"
|
||||
#include "DataModelV3/Gui/BaseGuiInstance.h"
|
||||
using namespace B3D;
|
||||
TextButtonInstance::TextButtonInstance(void)
|
||||
{
|
||||
BaseButtonInstance::BaseButtonInstance();
|
||||
boxBegin = Vector2(0,0);
|
||||
boxEnd = Vector2(0,0);
|
||||
fontLocationRelativeTo = Vector2(0,0);
|
||||
centeredWithinBox = false;
|
||||
title = "TextBox";
|
||||
textColor = Color4(1, 1, 1, 1);
|
||||
textOutlineColor = Color4(0, 0, 0, 0);
|
||||
boxColor = BaseGuiInstance::translucentBackdrop();
|
||||
boxOutlineColor = Color4(0, 0, 0, 0);
|
||||
setAllColorsSame();
|
||||
textSize = 12;
|
||||
floatBottom = false;
|
||||
floatRight = false;
|
||||
floatCenter = false;
|
||||
visible = true;
|
||||
disabled = false;
|
||||
selected = false;
|
||||
}
|
||||
|
||||
bool TextButtonInstance::mouseInButton(float mousex, float mousey, RenderDevice* rd)
|
||||
{
|
||||
Vector3 point1;
|
||||
Vector3 point2;
|
||||
if(floatBottom)
|
||||
{
|
||||
point1 = Vector3(boxBegin.x, rd->getHeight() + boxBegin.y,0);
|
||||
point2 = Vector3(boxEnd.x, rd->getHeight() + boxEnd.y,0);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
point1 = Vector3(boxBegin.x, boxBegin.y,0);
|
||||
point2 = Vector3(boxEnd.x, boxEnd.y,0);
|
||||
}
|
||||
if(mousex >= point1.x && mousey >= point1.y)
|
||||
{
|
||||
if(mousex < point2.x && mousey < point2.y)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void TextButtonInstance::setAllColorsSame()
|
||||
{
|
||||
textColorOvr = textColor;
|
||||
textOutlineColorOvr = textOutlineColor;
|
||||
boxColorOvr = boxColor;
|
||||
boxOutlineColorOvr = boxOutlineColor;
|
||||
textColorDn = textColor;
|
||||
textOutlineColorDn = textOutlineColor;
|
||||
boxColorDn = boxColor;
|
||||
boxOutlineColorDn = boxOutlineColor;
|
||||
textColorDis = textColor;
|
||||
textOutlineColorDis = textOutlineColor;
|
||||
boxColorDis = boxColor;
|
||||
boxOutlineColorDis = boxOutlineColor;
|
||||
}
|
||||
|
||||
TextButtonInstance::~TextButtonInstance(void)
|
||||
{
|
||||
}
|
||||
|
||||
void TextButtonInstance::drawObj(RenderDevice* rd, Vector2 mousePos, bool mouseDown)
|
||||
{
|
||||
Vector3 point1;
|
||||
Vector3 point2;
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
|
||||
if(floatBottom)
|
||||
{
|
||||
point1 = Vector3(boxBegin.x, rd->getHeight() + boxBegin.y,0);
|
||||
point2 = Vector3(boxEnd.x, rd->getHeight() + boxEnd.y,0);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
point1 = Vector3(boxBegin.x, boxBegin.y,0);
|
||||
point2 = Vector3(boxEnd.x, boxEnd.y,0);
|
||||
}
|
||||
Vector2 RelativeTo = Vector2(point1.x + fontLocationRelativeTo.x, point1.y + fontLocationRelativeTo.y);
|
||||
if(disabled)
|
||||
{
|
||||
Draw::box(Box(point1, point2), rd, boxColorDis, boxOutlineColorDis);
|
||||
font->draw2D(rd, title, RelativeTo, textSize, textColorDis, textOutlineColorDis);
|
||||
}
|
||||
else if(mouseInArea(point1.x, point1.y, point2.x, point2.y, mousePos.x, mousePos.y) && mouseDown)
|
||||
{
|
||||
Draw::box(Box(point1, point2), rd, boxColorDn, boxOutlineColorDn);
|
||||
font->draw2D(rd, title, RelativeTo, textSize, textColorDn, textOutlineColorDn);
|
||||
}
|
||||
else if(selected || mouseInArea(point1.x, point1.y, point2.x, point2.y, mousePos.x, mousePos.y))
|
||||
{
|
||||
Draw::box(Box(point1, point2), rd, boxColorOvr, boxOutlineColorOvr);
|
||||
font->draw2D(rd, title, RelativeTo, textSize, textColorOvr, textOutlineColorOvr);
|
||||
}
|
||||
else
|
||||
{
|
||||
Draw::box(Box(point1, point2), rd, boxColor, boxOutlineColor);
|
||||
font->draw2D(rd, title, RelativeTo, textSize, textColor, textOutlineColor);
|
||||
}
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
}
|
||||
136
src/source/DataModelV3/Gui/ToggleImageButtonInstance.cpp
Normal file
136
src/source/DataModelV3/Gui/ToggleImageButtonInstance.cpp
Normal file
@@ -0,0 +1,136 @@
|
||||
#include "DataModelV3/Gui/ToggleImageButtonInstance.h"
|
||||
using namespace B3D;
|
||||
ToggleImageButtonInstance::ToggleImageButtonInstance(G3D::TextureRef newImage,
|
||||
G3D::TextureRef overImage,
|
||||
G3D::TextureRef downImage,
|
||||
G3D::TextureRef disableImage,
|
||||
G3D::TextureRef newImage2,
|
||||
G3D::TextureRef overImage2,
|
||||
G3D::TextureRef downImage2,
|
||||
G3D::TextureRef disableImage2) : ImageButtonInstance(newImage, overImage, downImage, disableImage)
|
||||
{
|
||||
image2 = newImage2;
|
||||
openGLID2 = image2->getOpenGLID();
|
||||
image_ovr2 = overImage2;
|
||||
if(!image_ovr2.isNull())
|
||||
openGLID2_ovr = image_ovr2->getOpenGLID();
|
||||
image_dn2 = downImage2;
|
||||
if(!image_dn2.isNull())
|
||||
openGLID2_dn = image_dn2->getOpenGLID();
|
||||
image_ds2 = disableImage2;
|
||||
if(!image_ds2.isNull())
|
||||
openGLID2_ds = image_ds2->getOpenGLID();
|
||||
checked = false;
|
||||
}
|
||||
|
||||
ToggleImageButtonInstance::~ToggleImageButtonInstance(void)
|
||||
{
|
||||
//Delete everything on destruction
|
||||
image2.~ReferenceCountedPointer();
|
||||
delete image2.getPointer();
|
||||
image_ovr2.~ReferenceCountedPointer();
|
||||
delete image_ovr2.getPointer();
|
||||
image_ds2.~ReferenceCountedPointer();
|
||||
delete image_ds2.getPointer();
|
||||
image_dn2.~ReferenceCountedPointer();
|
||||
delete image_dn2.getPointer();
|
||||
image = NULL;
|
||||
image_ovr = NULL;
|
||||
image_ds = NULL;
|
||||
image_dn = NULL;
|
||||
selected = false;
|
||||
}
|
||||
|
||||
|
||||
void ToggleImageButtonInstance::drawObj(RenderDevice* rd, Vector2 mousePos, bool mouseDown)
|
||||
{
|
||||
bool drawDisabledBox = false;
|
||||
Vector2 positionRelative = position;
|
||||
if(floatRight && floatBottom)
|
||||
{
|
||||
positionRelative = Vector2(rd->getWidth() + position.x, rd->getHeight() + position.y);
|
||||
}
|
||||
else if(floatBottom)
|
||||
{
|
||||
positionRelative = Vector2(position.x, rd->getHeight() + position.y);
|
||||
}
|
||||
else if(floatRight)
|
||||
{
|
||||
positionRelative = Vector2(rd->getWidth() + position.x, position.y);
|
||||
}
|
||||
int renderimage = openGLID;
|
||||
if(checked)
|
||||
{
|
||||
renderimage = openGLID2;
|
||||
if(selected == true && !image_dn2.isNull() && !disabled)
|
||||
{
|
||||
renderimage = openGLID2_dn;
|
||||
}
|
||||
else if(disabled)
|
||||
{
|
||||
if(!image_ds2.isNull())
|
||||
renderimage = openGLID2_ds;
|
||||
else
|
||||
drawDisabledBox = true;
|
||||
}
|
||||
else if(mouseInArea(positionRelative.x, positionRelative.y, positionRelative.x + size.x, positionRelative.y + size.y, mousePos.x, mousePos.y))
|
||||
{
|
||||
if(mouseDown && !image_dn2.isNull())
|
||||
{
|
||||
renderimage = openGLID2_dn;
|
||||
}
|
||||
else if(!image_ovr2.isNull())
|
||||
{
|
||||
renderimage = openGLID2_ovr;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(selected == true && !image_dn.isNull() && !disabled)
|
||||
{
|
||||
renderimage = openGLID_dn;
|
||||
}
|
||||
else if(disabled)
|
||||
{
|
||||
if(!image_ds.isNull())
|
||||
renderimage = openGLID_ds;
|
||||
else
|
||||
drawDisabledBox = true;
|
||||
}
|
||||
else if(mouseInArea(positionRelative.x, positionRelative.y, positionRelative.x + size.x, positionRelative.y + size.y, mousePos.x, mousePos.y))
|
||||
{
|
||||
if(mouseDown && !image_dn.isNull())
|
||||
{
|
||||
renderimage = openGLID_dn;
|
||||
}
|
||||
else if(!image_ovr.isNull())
|
||||
{
|
||||
renderimage = openGLID_ovr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
glEnable( GL_TEXTURE_2D );
|
||||
glEnable(GL_BLEND);// you enable blending function
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glBindTexture( GL_TEXTURE_2D, renderimage);
|
||||
glBegin( GL_QUADS );
|
||||
glTexCoord2d(0.0,0.0);
|
||||
glVertex2f( positionRelative.x, positionRelative.y );
|
||||
glTexCoord2d( 1.0,0.0 );
|
||||
glVertex2f( positionRelative.x + size.x, positionRelative.y );
|
||||
glTexCoord2d( 1.0,1.0 );
|
||||
glVertex2f( positionRelative.x + size.x, positionRelative.y + size.y );
|
||||
glTexCoord2d( 0.0,1.0 );
|
||||
glVertex2f( positionRelative.x, positionRelative.y + size.y );
|
||||
glEnd();
|
||||
glDisable( GL_TEXTURE_2D );
|
||||
|
||||
if(drawDisabledBox)
|
||||
{
|
||||
Draw::box(Box(Vector3(positionRelative.x, positionRelative.y, 0), Vector3(positionRelative.x+size.x, positionRelative.y+size.y, 0)), rd, Color4(0.7F,0.7F,0.7F,0.3F), Color4::clear());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user