overhauled physics engine
This commit is contained in:
@@ -59,12 +59,12 @@ bool Element::isEnabled() const
|
||||
return enabled;
|
||||
}
|
||||
|
||||
Math::Rect& Element::getBoundingBox()
|
||||
Rect& Element::getBoundingBox()
|
||||
{
|
||||
return boundingBox;
|
||||
}
|
||||
|
||||
const Math::Rect Element::getBoundingBox() const
|
||||
const Rect Element::getBoundingBox() const
|
||||
{
|
||||
return boundingBox;
|
||||
}
|
||||
@@ -23,13 +23,13 @@ public:
|
||||
bool isEnabled() const;
|
||||
// maybe not the healthiest inteface
|
||||
// non-const version
|
||||
Math::Rect& getBoundingBox();
|
||||
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 Math::Rect getBoundingBox() const;
|
||||
const Rect getBoundingBox() const;
|
||||
protected:
|
||||
Math::Rect boundingBox;
|
||||
Rect boundingBox;
|
||||
bool dirty;
|
||||
|
||||
bool enabled;
|
||||
|
||||
@@ -18,14 +18,14 @@ HorizontalLayout::~HorizontalLayout()
|
||||
void HorizontalLayout::apply()
|
||||
{
|
||||
Array<PElement> children = element->getChildren();
|
||||
const Math::Rect parent = element->getBoundingBox();
|
||||
const 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)
|
||||
{
|
||||
Math::Rect& child = children[index]->getBoundingBox();
|
||||
Rect& child = children[index]->getBoundingBox();
|
||||
child.offset.x = xOffset + (index * xSize);
|
||||
child.offset.y = yOffset;
|
||||
child.size.x = xSize;
|
||||
|
||||
@@ -9,9 +9,9 @@ namespace UI
|
||||
{
|
||||
struct RenderElementStyle
|
||||
{
|
||||
Math::Vector position = Math::Vector(0, 0, 0);
|
||||
Vector position = Vector(0, 0, 0);
|
||||
uint32 backgroundImageIndex = UINT32_MAX;
|
||||
Math::Vector backgroundColor = Math::Vector(1, 1, 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);
|
||||
@@ -21,7 +21,7 @@ struct RenderElementStyle
|
||||
//float borderBottomRightRadius = 0;
|
||||
//float borderTopLeftRadius = 0;
|
||||
//float borderTopRightRadius = 0;
|
||||
Math::Vector2 dimensions = Math::Vector2(1, 1);
|
||||
Vector2 dimensions = Vector2(1, 1);
|
||||
};
|
||||
class RenderElement
|
||||
{
|
||||
|
||||
@@ -31,9 +31,9 @@ UIPassData System::getUIPassData()
|
||||
{
|
||||
UIPassData uiPassData;
|
||||
RenderElementStyle& style = uiPassData.renderElements.add();
|
||||
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.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;
|
||||
@@ -46,9 +46,9 @@ 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 = Math::Vector2(0.f, 300.f);
|
||||
render.position = Vector2(0.f, 300.f);
|
||||
render.scale = 0.1f;
|
||||
render.textColor = Math::Vector4(1, 0, 0, 1);
|
||||
render.textColor = Vector4(1, 0, 0, 1);
|
||||
return textPassData;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,14 +18,14 @@ VerticalLayout::~VerticalLayout()
|
||||
void VerticalLayout::apply()
|
||||
{
|
||||
Array<PElement> children = element->getChildren();
|
||||
const Math::Rect parent = element->getBoundingBox();
|
||||
const 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)
|
||||
{
|
||||
Math::Rect& child = children[index]->getBoundingBox();
|
||||
Rect& child = children[index]->getBoundingBox();
|
||||
child.offset.x = xOffset;
|
||||
child.offset.y = yOffset + (index * ySize);
|
||||
child.size.x = xSize;
|
||||
|
||||
Reference in New Issue
Block a user