Created
June 10, 2016 07:29
Star
You must be signed in to star a gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct DropInfo | |
typeid : uint | |
source : ImGuiID | |
struct DragState | |
item : DropInfo | |
active : DropInfo | |
last_source : DropInfo | |
last_target : DropInfo | |
target : DropInfo | |
const dragstate : DragState | |
static BeginDragSource(name typeid) : | |
bool <- (rawstring uint) | |
.= dragstate.last_source | |
source | |
GetID name | |
typeid typeid | |
do-if | |
and (dragstate.active.source == dragstate.last_source.source) | |
IsMouseDragging 0 | |
dragstate.item = dragstate.active | |
BeginGroup ; | |
dragstate.item.source == dragstate.last_source.source | |
static EndDragSource () : | |
void <- () | |
EndGroup ; | |
do-if | |
and | |
IsMouseClicked 0 | |
IsItemHoveredRect ; | |
dragstate.active = dragstate.last_source | |
static BeginDropTarget (*) | |
static (name typeid typemask) : | |
bool <- (rawstring uint uint) | |
.= dragstate.last_target | |
source | |
GetID name | |
typeid | |
if ((dragstate.item.typeid & typemask) == typeid) | |
dragstate.item.typeid | |
0 | |
BeginGroup ; | |
dragstate.target.source == dragstate.last_target.source | |
static (name typeid) : | |
bool <- (rawstring uint) | |
BeginDropTarget name typeid 0xffffffff | |
static EndDropTarget () : | |
void <- () | |
EndGroup ; | |
do-if | |
and | |
dragstate.item.typeid != 0 | |
dragstate.item.typeid == dragstate.last_target.typeid | |
cond | |
(IsItemHoveredRect) | |
dragstate.target = dragstate.last_target | |
(dragstate.target.source == dragstate.last_target.source) | |
.= dragstate.target | |
source 0 | |
typeid 0 | |
tuple ; | |
static GetDropType () : | |
uint <- () | |
dragstate.item.typeid | |
static BeginDropHandle () : | |
bool <- () | |
cond | |
(IsMouseReleased 0) | |
.= dragstate.item | |
source 0 | |
typeid 0 | |
.= dragstate.active | |
source 0 | |
typeid 0 | |
.= dragstate.target | |
source 0 | |
typeid 0 | |
false | |
(dragstate.item.typeid == 0) | |
false | |
else | |
BeginTooltip ; | |
true | |
static EndDropHandle () : | |
void <- () | |
EndTooltip ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment