Color container type for Python working. I still need to implement UIFrame using it.
This commit is contained in:
parent
ba97aebf3e
commit
c4d5a497d4
4 changed files with 159 additions and 240 deletions
23
src/UI.cpp
23
src/UI.cpp
|
|
@ -7,15 +7,30 @@ void UIDrawable::render()
|
|||
//std::cout << "Rendering base UIDrawable\n";
|
||||
render(sf::Vector2f());
|
||||
}
|
||||
UIFrame::UIFrame():
|
||||
x(0), y(0), w(0), h(0), outline(0), fillColor(0,0,0,255), outlineColor(0,0,0,0)
|
||||
{}
|
||||
|
||||
UIFrame::UIFrame(float _x, float _y, float _w, float _h):
|
||||
x(_x), y(_y), w(_w), h(_h), outline(0), fillColor(0,0,0,255), outlineColor(0,0,0,0)
|
||||
{}
|
||||
|
||||
void UIFrame::render(sf::Vector2f offset)
|
||||
{
|
||||
//std::cout << "Rendering UIFrame w/ offset\n";
|
||||
box.move(offset);
|
||||
//std::cout << "Rendering UIFrame w/ offset " << offset.x << ", " << offset.y << "\n";
|
||||
//std::cout << "position = " << x << ", " << y << "\n";
|
||||
//box.move(offset);
|
||||
//Resources::game->getWindow().draw(box);
|
||||
//box.move(-offset);
|
||||
sf::RectangleShape box = sf::RectangleShape(sf::Vector2f(w,h));
|
||||
sf::Vector2f pos = sf::Vector2f(x, y);
|
||||
box.setPosition(offset + pos);
|
||||
box.setFillColor(fillColor);
|
||||
box.setOutlineColor(outlineColor);
|
||||
box.setOutlineThickness(outline);
|
||||
Resources::game->getWindow().draw(box);
|
||||
box.move(-offset);
|
||||
for (auto drawable : children) {
|
||||
drawable->render(offset + box.getPosition());
|
||||
drawable->render(offset + pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue