Ported all instances, now the hard part

This commit is contained in:
Vulpovile
2023-11-07 17:21:21 -08:00
parent 944afec7a3
commit ce808f672f
16 changed files with 1382 additions and 7 deletions

View File

@@ -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;

View 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);
};
}

View 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);
};
}

View 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;
};
}

View 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*);
};
}

View 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*);
};
}

View 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;
};
}

View File

@@ -1,5 +1,4 @@
#pragma once
#define WINVER 0x0400
#include "Reflection/Reflection.h"
#include "Reflection/ReflectionDataTable.h"
#include "Reflection/ReflectionProperty.h"