Worked out an initial stab at a GrabSource for drag-n-drop or just simple grabbing things in the UI.
parent
94385b195d
commit
842aac3127
@ -1,8 +1,28 @@ |
|||||||
|
#pragma once |
||||||
#include "components.hpp" |
#include "components.hpp" |
||||||
#include "events.hpp" |
#include "events.hpp" |
||||||
#include <guecs/ui.hpp> |
#include <guecs/ui.hpp> |
||||||
|
#include "textures.hpp" |
||||||
|
|
||||||
namespace guecs { |
namespace guecs { |
||||||
Clickable make_action(DinkyECS::World& target, Events::GUI event); |
Clickable make_action(DinkyECS::World& target, Events::GUI event); |
||||||
Clickable make_action(DinkyECS::World& target, Events::GUI event, std::any data); |
Clickable make_action(DinkyECS::World& target, Events::GUI event, std::any data); |
||||||
|
|
||||||
|
struct GrabSource : public Sprite { |
||||||
|
void grab(sf::RenderWindow& window) { |
||||||
|
window.setMouseCursorVisible(false); |
||||||
|
sprite->setOrigin({128, 128}); |
||||||
|
} |
||||||
|
|
||||||
|
void move(sf::Vector2i position) { |
||||||
|
sprite->setPosition({ |
||||||
|
float(position.x), |
||||||
|
float(position.y) |
||||||
|
}); |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
struct DropTarget { |
||||||
|
|
||||||
|
}; |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue