Basic UI quad, yay

This commit is contained in:
Dynamitos
2021-09-23 10:10:39 +02:00
parent df977110d3
commit 632d120f6d
51 changed files with 579 additions and 187 deletions
+4
View File
@@ -0,0 +1,4 @@
target_sources(SeeleEngine
PRIVATE
Element.h
Element.cpp)
+52
View File
@@ -0,0 +1,52 @@
#include "Element.h"
using namespace Seele;
using namespace Seele::UI;
Element::Element()
{
}
Element::~Element()
{
}
void Element::addChild(PElement element)
{
children.add(element);
}
const Array<PElement> Element::getChildren()
{
return children;
}
void Element::clear()
{
children.clear();
}
void Element::remove(PElement element)
{
children.remove(children.find(element));
}
void Element::setEnabled(bool newEnabled)
{
enabled = newEnabled;
}
bool Element::isEnabled() const
{
return enabled;
}
Rect& Element::getBoundingBox()
{
return boundingBox;
}
const Rect Element::getBoundingBox() const
{
return boundingBox;
}
+40
View File
@@ -0,0 +1,40 @@
#pragma once
#include "MinimalEngine.h"
namespace Seele
{
namespace UI
{
//Element defines any part of the UI
DECLARE_REF(Element)
class Element
{
public:
Element();
virtual ~Element();
void setParent(PElement element);
PElement getParent() const;
void addChild(PElement element);
const Array<PElement> getChildren();
void clear();
void remove(PElement element);
void setEnabled(bool newEnabled);
bool isEnabled() const;
// maybe not the healthiest inteface
// non-const version
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;
protected:
Rect boundingBox;
bool enabled;
PElement parent;
Array<PElement> children;
friend class Layout;
friend class RenderElement;
};
DEFINE_REF(Element)
} // namespace UI
} // namespace Seele
+15
View File
@@ -0,0 +1,15 @@
#pragma once
#include "Element.h"
namespace Seele
{
namespace UI
{
class Panel : Element
{
public:
Panel();
virtual ~Panel();
};
} // namespace UI
} // namespace Seele