project-kyoku/src/application/widgets/editorwidget.cpp

56 lines
1.0 KiB
C++
Raw Normal View History

2021-10-05 14:48:28 -04:00
#include "editorwidget.h"
#include "core/editor.h"
2021-10-05 14:48:28 -04:00
2021-12-02 11:02:13 -05:00
EditorWidget::EditorWidget(Callbacks&& callbacks) :
_input(std::move(callbacks.onInput)),
_update(std::move(callbacks.onUpdate)),
_draw(std::move(callbacks.onDraw))
2021-10-05 14:48:28 -04:00
{}
void EditorWidget::input(const sf::Event& event)
{
2021-12-02 11:02:13 -05:00
_input(event);
2021-10-05 14:48:28 -04:00
}
void EditorWidget::update(const sf::Time& dt)
{
2021-12-02 11:02:13 -05:00
_update(dt);
2021-10-05 14:48:28 -04:00
}
void EditorWidget::draw(sf::RenderTarget& target, sf::RenderStates states) const
{
2021-12-02 11:02:13 -05:00
_draw(target, states);
2021-10-05 14:48:28 -04:00
}
void EditorWidget::move(const sf::Vector2f& delta)
{
(void)delta;
// delegate to children
2021-10-05 14:48:28 -04:00
}
bool EditorWidget::isUnderMouse(int mouse_x, int mouse_y) const
{
return _parent->isUnderMouse(mouse_x, mouse_y);
2021-10-05 14:48:28 -04:00
}
void EditorWidget::setRect(const sf::FloatRect& rect)
{
(void)rect;
// basically useless beacuse editor widget fills the entire screen
2021-10-05 14:48:28 -04:00
}
sf::FloatRect EditorWidget::rect() const
{
return {};
2021-10-05 14:48:28 -04:00
}
void EditorWidget::setPosition(const sf::Vector2f& position)
{
(void)position;
2021-10-05 14:48:28 -04:00
}
sf::Vector2f EditorWidget::position() const
{
return {};
2021-10-05 14:48:28 -04:00
}