Cleaning for mesh addition.
This commit is contained in:
parent
8e0ce22b57
commit
402f381d10
67 changed files with 655 additions and 456 deletions
|
@ -1,7 +1,7 @@
|
|||
#include "Button.h"
|
||||
|
||||
#include "TextElement.h"
|
||||
#include "GeometryElement.h"
|
||||
#include "TextNode.h"
|
||||
#include "GeometryNode.h"
|
||||
#include "VisualLayer.h"
|
||||
#include "MouseEvent.h"
|
||||
|
||||
|
@ -11,9 +11,10 @@ Button::Button()
|
|||
: Widget(),
|
||||
mLabel(),
|
||||
mCachedColor(255, 255, 255),
|
||||
mClickedColor(Color(180, 180, 180)),
|
||||
mClickFunc()
|
||||
{
|
||||
mClickedColor = Color::Create(180, 180, 180);
|
||||
|
||||
}
|
||||
|
||||
std::unique_ptr<Button> Button::Create()
|
||||
|
@ -39,8 +40,8 @@ void Button::onMyMouseEvent(const MouseEvent* event)
|
|||
{
|
||||
if(event->GetAction() == MouseEvent::Action::Pressed)
|
||||
{
|
||||
mCachedColor = *mBackgroundColor;
|
||||
setBackgroundColor(Color::Create(*mClickedColor));
|
||||
mCachedColor = mBackgroundColor;
|
||||
setBackgroundColor(mClickedColor);
|
||||
if(mClickFunc)
|
||||
{
|
||||
mClickFunc(this);
|
||||
|
@ -48,7 +49,7 @@ void Button::onMyMouseEvent(const MouseEvent* event)
|
|||
}
|
||||
else if(event->GetAction() == MouseEvent::Action::Released)
|
||||
{
|
||||
setBackgroundColor(Color::Create(mCachedColor));
|
||||
setBackgroundColor(mCachedColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,9 +75,9 @@ void Button::onPaintEvent(const PaintEvent* event)
|
|||
unsigned fontOffset = unsigned(mLabel.size()) * 4;
|
||||
auto middle = DiscretePoint(mLocation.GetX() + mSize.mWidth/2 - fontOffset, mLocation.GetY() + mSize.mHeight/2 + 4);
|
||||
auto textLayer = VisualLayer::Create();
|
||||
auto textElement = TextElement::Create(mLabel, middle);
|
||||
textElement->SetFillColor(Color::Create(*mBackgroundColor));
|
||||
textLayer->SetText(std::move(textElement));
|
||||
auto textElement = TextNode::Create(mLabel, middle);
|
||||
textElement->setFillColor(mBackgroundColor);
|
||||
textLayer->setText(std::move(textElement));
|
||||
mMyLayers.push_back(std::move(textLayer));
|
||||
}
|
||||
mDirty = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue