Created
February 19, 2013 18:12
-
-
Save nddrylliog/4988371 to your computer and use it in GitHub Desktop.
Weird closure bug.
This file contains hidden or 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
void gnaar_ui__Frame_initEvents_impl(gnaar_ui__Frame* this) { | |
__gnaar_ui_closure1000_ctx* __ctx1001 = lang_Memory__gc_malloc(((lang_types__Class*)__gnaar_ui_closure1000_ctx_class())->size); | |
(*(__ctx1001)) = (__gnaar_ui_closure1000_ctx) { | |
this | |
}; | |
lang_types__Closure __closure1002 = (lang_types__Closure) { | |
gnaar_ui____gnaar_ui_closure1000_thunk, | |
__ctx1001 | |
}; | |
dye_input__Input_onMousePress(this->input, SDL_BUTTON_LEFT, __closure1002); | |
__gnaar_ui_closure1003_ctx* __ctx1004 = lang_Memory__gc_malloc(((lang_types__Class*)__gnaar_ui_closure1003_ctx_class())->size); | |
(*(__ctx1004)) = (__gnaar_ui_closure1003_ctx) { | |
this, | |
clickEvent | |
}; | |
lang_types__Closure __closure1005 = (lang_types__Closure) { | |
gnaar_ui____gnaar_ui_closure1003_thunk, | |
__ctx1004 | |
}; | |
dye_input__Input_onMouseRelease(this->input, SDL_BUTTON_LEFT, __closure1005); | |
__gnaar_ui_closure1006_ctx* __ctx1007 = lang_Memory__gc_malloc(((lang_types__Class*)__gnaar_ui_closure1006_ctx_class())->size); | |
(*(__ctx1007)) = (__gnaar_ui_closure1006_ctx) { | |
this | |
}; | |
lang_types__Closure __closure1008 = (lang_types__Closure) { | |
gnaar_ui____gnaar_ui_closure1006_thunk, | |
__ctx1007 | |
}; | |
dye_input__Input_onMouseRelease(this->input, SDL_BUTTON_MIDDLE, __closure1008); | |
__gnaar_ui_closure1009_ctx* __ctx1010 = lang_Memory__gc_malloc(((lang_types__Class*)__gnaar_ui_closure1009_ctx_class())->size); | |
(*(__ctx1010)) = (__gnaar_ui_closure1009_ctx) { | |
this | |
}; | |
lang_types__Closure __closure1011 = (lang_types__Closure) { | |
gnaar_ui____gnaar_ui_closure1009_thunk, | |
__ctx1010 | |
}; | |
dye_input__Input_onMouseRelease(this->input, SDL_BUTTON_RIGHT, __closure1011); | |
} |
This file contains hidden or 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
initEvents: func { | |
input onMousePress(MouseButton LEFT, |ev| | |
dragStart = true | |
dragPath = vec2(0, 0) | |
dragging = false | |
) | |
input onMouseRelease(MouseButton LEFT, |ev| | |
dragStart = false | |
if (dragging) { | |
dragging = false | |
queue push(DragStopEvent new()) | |
} else { | |
clickPos := input getMousePos() | |
clickEvent := ClickEvent new(MouseButton LEFT, clickPos) | |
collideTree(clickPos, |widget, touching| | |
if (touching) { | |
widget process(clickEvent) | |
} | |
) | |
queue push(clickEvent) | |
} | |
) | |
input onMouseRelease(MouseButton MIDDLE, |ev| | |
queue push(ClickEvent new(MouseButton MIDDLE, input getMousePos())) | |
) | |
input onMouseRelease(MouseButton RIGHT, |ev| | |
queue push(ClickEvent new(MouseButton RIGHT, input getMousePos())) | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment