2021-10-05 14:48:28 -04:00
|
|
|
#include "editorwidget.h"
|
2021-11-02 13:03:27 -04:00
|
|
|
#include "core/editor.h"
|
2021-10-05 14:48:28 -04:00
|
|
|
|
|
|
|
EditorWidget::EditorWidget(const std::shared_ptr<Editor>& editor) :
|
|
|
|
_editor(editor)
|
|
|
|
{}
|
|
|
|
|
|
|
|
void EditorWidget::input(const sf::Event& event)
|
|
|
|
{
|
2021-11-02 13:03:27 -04:00
|
|
|
_editor->input(PlayerInput{0, event});
|
2021-10-05 14:48:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void EditorWidget::update(const sf::Time& dt)
|
|
|
|
{
|
2021-11-02 13:03:27 -04:00
|
|
|
_editor->update(dt);
|
2021-10-05 14:48:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void EditorWidget::draw(sf::RenderTarget& target, sf::RenderStates states) const
|
|
|
|
{
|
2021-11-02 13:03:27 -04:00
|
|
|
// !!!!!!!!!!!!!!!!!
|
|
|
|
(void)target; (void)states;
|
|
|
|
_editor->draw();
|
2021-10-05 14:48:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void EditorWidget::move(const sf::Vector2f& delta)
|
|
|
|
{
|
2021-11-02 13:03:27 -04:00
|
|
|
(void)delta;
|
|
|
|
// delegate to children
|
2021-10-05 14:48:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool EditorWidget::isUnderMouse(int mouse_x, int mouse_y) const
|
|
|
|
{
|
2021-11-02 13:03:27 -04:00
|
|
|
return _parent->isUnderMouse(mouse_x, mouse_y);
|
2021-10-05 14:48:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void EditorWidget::setRect(const sf::FloatRect& rect)
|
|
|
|
{
|
2021-11-02 13:03:27 -04:00
|
|
|
(void)rect;
|
|
|
|
// basically useless beacuse editor widget fills the entire screen
|
2021-10-05 14:48:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
sf::FloatRect EditorWidget::rect() const
|
|
|
|
{
|
2021-11-02 13:03:27 -04:00
|
|
|
return {};
|
2021-10-05 14:48:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void EditorWidget::setPosition(const sf::Vector2f& position)
|
|
|
|
{
|
2021-11-02 13:03:27 -04:00
|
|
|
(void)position;
|
2021-10-05 14:48:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
sf::Vector2f EditorWidget::position() const
|
|
|
|
{
|
2021-11-02 13:03:27 -04:00
|
|
|
return {};
|
2021-10-05 14:48:28 -04:00
|
|
|
}
|