ui rendering works now
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
target_sources(Engine
|
||||
PRIVATE
|
||||
Element.h
|
||||
Element.cpp)
|
||||
Element.cpp
|
||||
Panel.h
|
||||
Panel.cpp)
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "Element.h"
|
||||
#include "UI/System.h"
|
||||
#include "Graphics/Graphics.h"
|
||||
|
||||
using namespace Seele;
|
||||
using namespace Seele::UI;
|
||||
|
||||
@@ -36,7 +36,6 @@ protected:
|
||||
PSystem system;
|
||||
PElement parent;
|
||||
Array<PElement> children;
|
||||
friend class Layout;
|
||||
friend class RenderElement;
|
||||
};
|
||||
DEFINE_REF(Element)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
#include "Panel.h"
|
||||
#include "UI/Layout.h"
|
||||
|
||||
using namespace Seele;
|
||||
using namespace Seele::UI;
|
||||
|
||||
Panel::Panel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Panel::~Panel()
|
||||
{
|
||||
|
||||
}
|
||||
@@ -5,12 +5,16 @@ namespace Seele
|
||||
{
|
||||
namespace UI
|
||||
{
|
||||
DECLARE_REF(Layout)
|
||||
class Panel : Element
|
||||
{
|
||||
public:
|
||||
Panel();
|
||||
virtual ~Panel();
|
||||
private:
|
||||
PLayout activeLayout;
|
||||
};
|
||||
|
||||
DEFINE_REF(Panel);
|
||||
} // namespace UI
|
||||
} // namespace Seele
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "HorizontalLayout.h"
|
||||
#include "Elements/Element.h"
|
||||
|
||||
using namespace Seele;
|
||||
using namespace Seele::UI;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "Layout.h"
|
||||
#include "Elements/Element.h"
|
||||
|
||||
using namespace Seele;
|
||||
using namespace Seele::UI;
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#pragma once
|
||||
#include "Elements/Element.h"
|
||||
#include "MinimalEngine.h"
|
||||
|
||||
namespace Seele
|
||||
{
|
||||
namespace UI
|
||||
{
|
||||
DECLARE_REF(Element);
|
||||
class Layout
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -9,23 +9,20 @@ namespace UI
|
||||
{
|
||||
struct RenderElementStyle
|
||||
{
|
||||
Vector2 position;
|
||||
Vector2 dimensions;
|
||||
Vector backgroundColor;
|
||||
uint32 backgroundImageIndex;
|
||||
Vector4 borderBottomColor;
|
||||
Vector4 borderLeftColor;
|
||||
Vector4 borderRightColor;
|
||||
Vector4 borderTopColor;
|
||||
float borderBottomLeftRadius;
|
||||
float borderBottomRightRadius;
|
||||
float borderTopLeftRadius;
|
||||
float borderTopRightRadius;
|
||||
Vector4 fontColor;
|
||||
float fontSize;
|
||||
float opacity;
|
||||
Vector position = Vector(0, 0, 0);
|
||||
uint32 backgroundImageIndex = -1;
|
||||
Vector backgroundColor = Vector(1, 1, 1);
|
||||
float opacity = 1.0f;
|
||||
//Vector4 borderBottomColor = Vector4(1, 1, 1, 1);
|
||||
//Vector4 borderLeftColor = Vector4(1, 1, 1, 1);
|
||||
//Vector4 borderRightColor = Vector4(1, 1, 1, 1);
|
||||
//Vector4 borderTopColor = Vector4(1, 1, 1, 1);
|
||||
//float borderBottomLeftRadius = 0;
|
||||
//float borderBottomRightRadius = 0;
|
||||
//float borderTopLeftRadius = 0;
|
||||
//float borderTopRightRadius = 0;
|
||||
Vector2 dimensions = Vector2(1, 1);
|
||||
};
|
||||
static_assert(sizeof(RenderElementStyle) == 34*4);
|
||||
class RenderElement
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#include "System.h"
|
||||
#include "Elements/Panel.h"
|
||||
#include "Graphics/Graphics.h"
|
||||
#include "Asset/AssetRegistry.h"
|
||||
#include "Asset/TextureAsset.h"
|
||||
|
||||
using namespace Seele;
|
||||
using namespace Seele::UI;
|
||||
@@ -13,3 +16,33 @@ System::~System()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void System::update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
UIPassData System::getUIPassData()
|
||||
{
|
||||
UIPassData uiPassData;
|
||||
RenderElementStyle& style = uiPassData.renderElements.add();
|
||||
style.position = Vector(0, 0, -0.1);
|
||||
style.dimensions = Vector2(0.4, 0.4);
|
||||
style.backgroundColor = Vector(0.2, 0.3, 0.1);
|
||||
style.backgroundImageIndex = 0;
|
||||
uiPassData.usedTextures.add(AssetRegistry::findTexture("")->getTexture());
|
||||
return uiPassData;
|
||||
}
|
||||
|
||||
TextPassData System::getTextPassData()
|
||||
{
|
||||
TextPassData textPassData;
|
||||
TextRender& render = textPassData.texts.add();
|
||||
render.font = AssetRegistry::findFont("Calibri");
|
||||
render.text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus quis magna ex. Morbi ullamcorper fringilla risus eget vehicula. Praesent vel quam vel ante molestie gravida vitae ac enim. Donec vitae eleifend orci. Phasellus at sodales lorem, ac eleifend turpis. Vivamus vitae condimentum lacus, a bibendum neque. Ut et est ut felis varius vehicula. Etiam lorem magna, dapibus vitae felis in, vulputate suscipit neque. Aenean facilisis ac risus et scelerisque. Ut tincidunt eros quis posuere iaculis. Curabitur justo lacus, molestie id varius vel, sodales efficitur diam. Integer orci velit, condimentum sit amet turpis sit amet, congue blandit nisl. Donec pretium ligula id mauris pretium commodo. Mauris quis lectus mi. In blandit, dolor non accumsan venenatis, ipsum erat congue neque, quis elementum orci nunc vel justo. ";
|
||||
//render.text = "Seele Engine";
|
||||
render.position = Vector2(0.f, 300.f);
|
||||
render.scale = 0.1f;
|
||||
render.textColor = Vector4(1, 0, 0, 1);
|
||||
return textPassData;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
#include "MinimalEngine.h"
|
||||
#include "RenderHierarchy.h"
|
||||
#include "Graphics/RenderPass/UIPass.h"
|
||||
#include "Graphics/RenderPass/TextPass.h"
|
||||
|
||||
namespace Seele
|
||||
{
|
||||
@@ -12,9 +14,12 @@ class System
|
||||
public:
|
||||
System();
|
||||
virtual ~System();
|
||||
void update();
|
||||
UIPassData getUIPassData();
|
||||
TextPassData getTextPassData();
|
||||
private:
|
||||
PPanel rootPanel;
|
||||
Array<RenderHierarchyUpdate*> updates;
|
||||
RenderHierarchy hierarchy;
|
||||
};
|
||||
DEFINE_REF(System)
|
||||
} // namespace UI
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "VerticalLayout.h"
|
||||
#include "Elements/Element.h"
|
||||
|
||||
using namespace Seele;
|
||||
using namespace Seele::UI;
|
||||
|
||||
Reference in New Issue
Block a user