Implementing ECS SystemBase and updating slang

This commit is contained in:
Dynamitos
2022-11-15 12:19:11 +01:00
parent 05bc31a2b4
commit f635ee2100
106 changed files with 1083 additions and 1675 deletions
+2 -2
View File
@@ -59,12 +59,12 @@ bool Element::isEnabled() const
return enabled;
}
Rect& Element::getBoundingBox()
Math::Rect& Element::getBoundingBox()
{
return boundingBox;
}
const Rect Element::getBoundingBox() const
const Math::Rect Element::getBoundingBox() const
{
return boundingBox;
}
+3 -3
View File
@@ -23,13 +23,13 @@ public:
bool isEnabled() const;
// maybe not the healthiest inteface
// non-const version
Rect& getBoundingBox();
Math::Rect& getBoundingBox();
// The bounding box describes the relative size of any Element
// relative to the total view, meaning a bounding box of (0,0), (1,1)
// would take up the entire view
const Rect getBoundingBox() const;
const Math::Rect getBoundingBox() const;
protected:
Rect boundingBox;
Math::Rect boundingBox;
bool dirty;
bool enabled;
+2 -2
View File
@@ -18,14 +18,14 @@ HorizontalLayout::~HorizontalLayout()
void HorizontalLayout::apply()
{
Array<PElement> children = element->getChildren();
const Rect parent = element->getBoundingBox();
const Math::Rect parent = element->getBoundingBox();
float xOffset = parent.offset.x;
float yOffset = parent.offset.y;
float xSize = parent.size.x / children.size();
float ySize = parent.size.y;
for(uint32 index = 0; index < children.size(); ++index)
{
Rect& child = children[index]->getBoundingBox();
Math::Rect& child = children[index]->getBoundingBox();
child.offset.x = xOffset + (index * xSize);
child.offset.y = yOffset;
child.size.x = xSize;
+4 -4
View File
@@ -9,9 +9,9 @@ namespace UI
{
struct RenderElementStyle
{
Vector position = Vector(0, 0, 0);
uint32 backgroundImageIndex = -1;
Vector backgroundColor = Vector(1, 1, 1);
Math::Vector position = Math::Vector(0, 0, 0);
uint32 backgroundImageIndex = UINT32_MAX;
Math::Vector backgroundColor = Math::Vector(1, 1, 1);
float opacity = 1.0f;
//Vector4 borderBottomColor = Vector4(1, 1, 1, 1);
//Vector4 borderLeftColor = Vector4(1, 1, 1, 1);
@@ -21,7 +21,7 @@ struct RenderElementStyle
//float borderBottomRightRadius = 0;
//float borderTopLeftRadius = 0;
//float borderTopRightRadius = 0;
Vector2 dimensions = Vector2(1, 1);
Math::Vector2 dimensions = Math::Vector2(1, 1);
};
class RenderElement
{
+5 -5
View File
@@ -26,9 +26,9 @@ 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.position = Math::Vector(0, 0, -0.1);
style.dimensions = Math::Vector2(0.4, 0.4);
style.backgroundColor = Math::Vector(0.2, 0.3, 0.1);
style.backgroundImageIndex = 0;
uiPassData.usedTextures.add(AssetRegistry::findTexture("")->getTexture());
return uiPassData;
@@ -41,8 +41,8 @@ TextPassData System::getTextPassData()
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.position = Math::Vector2(0.f, 300.f);
render.scale = 0.1f;
render.textColor = Vector4(1, 0, 0, 1);
render.textColor = Math::Vector4(1, 0, 0, 1);
return textPassData;
}
+2 -2
View File
@@ -18,14 +18,14 @@ VerticalLayout::~VerticalLayout()
void VerticalLayout::apply()
{
Array<PElement> children = element->getChildren();
const Rect parent = element->getBoundingBox();
const Math::Rect parent = element->getBoundingBox();
float xOffset = parent.offset.x;
float yOffset = parent.offset.y;
float xSize = parent.size.x;
float ySize = parent.size.y / children.size();
for(uint32 index = 0; index < children.size(); ++index)
{
Rect& child = children[index]->getBoundingBox();
Math::Rect& child = children[index]->getBoundingBox();
child.offset.x = xOffset;
child.offset.y = yOffset + (index * ySize);
child.size.x = xSize;