Created
August 14, 2018 13:42
-
-
Save copygirl/148b127713d7fc132e736e32ec7bfc06 to your computer and use it in GitHub Desktop.
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
# input.nim | |
event InputEvent: | |
time: uint32 | |
MouseDown, MouseUp: | |
mousePosition: Point | |
KeyUp, KeyDown: | |
keysym: KeySym | |
# In module 1 | |
event Module1Event: | |
data1: int | |
data2: string | |
# In module 2 | |
import | |
events, | |
module1, | |
input | |
subscribe Module1Event(data1: int, data2: string) = | |
[...] | |
# Both of the following would be equal? | |
subscribe InputEvent = | |
case event.kind | |
of MouseDown: | |
"[time: $1, pos: $2]" % [$event.time, $event.mousePosition] | |
subscribe InputEvent.MouseDown(time: uint32, mousePosition: Point) = | |
"[time: $1, pos: $2]" % [$event.time, $event.mousePosition] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment