Cleaning for mesh addition.

This commit is contained in:
James Grogan 2022-11-13 17:02:09 +00:00
parent 8e0ce22b57
commit 402f381d10
67 changed files with 655 additions and 456 deletions

View file

@ -1,16 +1,15 @@
#include "Widget.h"
#include "RectangleElement.h"
#include "RectangleNode.h"
#include "MouseEvent.h"
#include "KeyboardEvent.h"
#include "PaintEvent.h"
#include "VisualLayer.h"
#include "TextElement.h"
#include "TextNode.h"
#include "Color.h"
#include <algorithm>
#include <iterator>
#include <iostream>
Widget::Widget()
: mLocation(DiscretePoint(0, 0)),
@ -21,8 +20,8 @@ Widget::Widget()
mLayers(),
mChildren(),
mBorderThickness(0),
mBackgroundColor(Color::Create(255, 255, 255)),
mBorderColor(Color::Create(0, 0, 0)),
mBackgroundColor(Color(255, 255, 255)),
mBorderColor(Color(0, 0, 0)),
mVisible(true)
{
@ -48,7 +47,7 @@ Widget::BoundedSize Widget::getSize() const
return mSize;
}
DiscretePoint Widget::getLocation() const
const DiscretePoint& Widget::getLocation() const
{
return mLocation;
}
@ -105,7 +104,7 @@ void Widget::setBounds(unsigned width, unsigned height)
mSize.mHeight = height;
}
void Widget::setBackgroundColor(ColorUPtr color)
void Widget::setBackgroundColor(const Color& color)
{
if (mBackgroundColor != color)
{
@ -273,16 +272,10 @@ void Widget::addBackground(const PaintEvent* event)
unsigned locY = mLocation.GetY() + mMargin.mTop;
unsigned deltaX = mSize.mWidth - mMargin.mLeft - mMargin.mRight;
unsigned deltaY = mSize.mHeight - mMargin.mTop - mMargin.mBottom;
auto shape = RectangleElement::Create(DiscretePoint(locX, locY), deltaX, deltaY);
std::cout << "Adding shape at : " << locX << " | " << locY << std::endl;
std::cout << "Has dimensions : " << deltaX << " | " << deltaY << std::endl;
auto color = Color::Create(*mBackgroundColor);
std::cout << "Has color : " << color->GetR() << " | " << color->GetG() << " | " << color->GetB() << " | " << color->GetAlpha() << std::endl;
shape->SetFillColor(std::move(color));
auto shape = RectangleNode::Create(DiscretePoint(locX, locY), deltaX, deltaY);
shape->setFillColor(mBackgroundColor);
auto shapeLayer = VisualLayer::Create();
shapeLayer->SetShape(std::move(shape));
shapeLayer->setShape(std::move(shape));
mMyLayers.push_back(std::move(shapeLayer));
}