rubygoo 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,4 +7,9 @@
7
7
  * refactored rubygame input/rendering into adapters
8
8
  * started adding support for gosu applications
9
9
 
10
+ === 0.0.4 / 2008-09-30
11
+
12
+ * Rubygoo gets better Gosu support
13
+ * keys work now in Gosu
14
+ * properly namespaced in Rubygoo module
10
15
 
@@ -29,6 +29,8 @@ lib/rubygoo/dialog.rb
29
29
  lib/rubygoo/goo_color.rb
30
30
  lib/rubygoo/goo_event.rb
31
31
  lib/rubygoo/label.rb
32
+ lib/rubygoo/mouse_cursor.rb
33
+ lib/rubygoo/rect.rb
32
34
  lib/rubygoo/text_field.rb
33
35
  lib/rubygoo/widget.rb
34
36
  samples/gosu_app.rb
data/TODO CHANGED
@@ -1,10 +1,7 @@
1
1
  TODO
2
- - should rubygoo take control of the screen & events?
3
- - just provide callbacks?
2
+ - make mouse cursor injectable
4
3
  - make clicking on a component focus it
5
4
  - add more listener types (when mouse_enter, mouse_leave, mouse_click, focus, key_pressed...)
6
5
  - image icons for buttons
7
6
 
8
- - abstract the events that rubygoo takes and the renderer to allow for gosu-ness
9
- - rework color scheme to not suck
10
7
  - double-check the tab focus stuff on modal dialogs
@@ -1,19 +1,20 @@
1
1
  $: << File.dirname(__FILE__)
2
2
  $: << File.join(File.dirname(__FILE__),"rubygoo")
3
3
  $: << File.join(File.dirname(__FILE__),"rubygoo","adapters")
4
- class Rubygoo
5
- VERSION = '0.0.3'
4
+ module Rubygoo
5
+ VERSION = '0.0.4'
6
6
  end
7
7
 
8
- require 'goo_event'
9
- require 'goo_color'
10
- require 'adapter_factory'
8
+ require 'rubygoo/goo_event'
9
+ require 'rubygoo/goo_color'
10
+ require 'rubygoo/adapters/adapter_factory'
11
11
  require 'yaml'
12
- require 'widget'
13
- require 'container'
14
- require 'app'
15
- require 'label'
16
- require 'button'
17
- require 'check_box'
18
- require 'text_field'
19
- require 'dialog'
12
+ require 'rubygoo/widget'
13
+ require 'rubygoo/container'
14
+ require 'rubygoo/mouse_cursor'
15
+ require 'rubygoo/app'
16
+ require 'rubygoo/label'
17
+ require 'rubygoo/button'
18
+ require 'rubygoo/check_box'
19
+ require 'rubygoo/text_field'
20
+ require 'rubygoo/dialog'
@@ -1,14 +1,17 @@
1
- class AdapterFactory
1
+ module Rubygoo
2
+ class AdapterFactory
2
3
 
3
- def app_for(platform,*args)
4
- require "#{platform}_app_adapter"
5
- ObjectSpace.const_get("#{platform.to_s.capitalize}AppAdapter").new *args
6
- end
4
+ def app_for(platform,*args)
5
+ require "#{platform}_app_adapter"
6
+ Rubygoo.const_get("#{platform.to_s.capitalize}AppAdapter").new *args
7
+ # ::ObjectSpace.const_get("#{platform.to_s.capitalize}AppAdapter").new *args
8
+ end
7
9
 
8
- def renderer_for(platform,*args)
9
- require "#{platform}_render_adapter"
10
- ObjectSpace.const_get("#{platform.to_s.capitalize}RenderAdapter").new *args
11
- end
10
+ def renderer_for(platform,*args)
11
+ require "#{platform}_render_adapter"
12
+ Rubygoo.const_get("#{platform.to_s.capitalize}RenderAdapter").new *args
13
+ end
12
14
 
13
15
 
16
+ end
14
17
  end
@@ -1,11 +1,510 @@
1
+ include Gosu
2
+ module Rubygoo
3
+
4
+ enum = 0
5
+ MOUSE_LEFT = enum += 1
6
+ MOUSE_MIDDLE = enum += 1
7
+ MOUSE_RIGHT = enum += 1
8
+ MOUSE_LMASK = enum += 1
9
+ MOUSE_MMASK = enum += 1
10
+ MOUSE_RMASK = enum += 1
11
+
12
+ K_UNKNOWN = enum += 1
13
+ K_FIRST = enum += 1
14
+ K_BACKSPACE = KbBackspace
15
+ K_TAB = KbTab
16
+ K_CLEAR = enum += 1
17
+ K_RETURN = KbReturn
18
+ K_PAUSE = enum += 1
19
+ K_ESCAPE = KbEscape
20
+ K_SPACE = KbSpace
21
+ K_EXCLAIM = enum += 1
22
+ K_QUOTEDBL = enum += 1
23
+ K_HASH = enum += 1
24
+ K_DOLLAR = enum += 1
25
+ K_AMPERSAND = enum += 1
26
+ K_QUOTE = enum += 1
27
+ K_LEFTPAREN = enum += 1
28
+ K_RIGHTPAREN = enum += 1
29
+ K_ASTERISK = enum += 1
30
+ K_PLUS = enum += 1
31
+ K_COMMA = enum += 1
32
+ K_MINUS = enum += 1
33
+ K_PERIOD = enum += 1
34
+ K_SLASH = enum += 1
35
+ K_0 = Kb0
36
+ K_1 = Kb1
37
+ K_2 = Kb2
38
+ K_3 = Kb3
39
+ K_4 = Kb4
40
+ K_5 = Kb5
41
+ K_6 = Kb6
42
+ K_7 = Kb7
43
+ K_8 = Kb8
44
+ K_9 = Kb9
45
+ K_COLON = enum += 1
46
+ K_SEMICOLON = enum += 1
47
+ K_LESS = enum += 1
48
+ K_EQUALS = enum += 1
49
+ K_GREATER = enum += 1
50
+ K_QUESTION = enum += 1
51
+ K_AT = enum += 1
52
+ K_LEFTBRACKET = enum += 1
53
+ K_BACKSLASH = enum += 1
54
+ K_RIGHTBRACKET = enum += 1
55
+ K_CARET = enum += 1
56
+ K_UNDERSCORE = enum += 1
57
+ K_BACKQUOTE = enum += 1
58
+ K_A = KbA
59
+ K_B = KbB
60
+ K_C = KbC
61
+ K_D = KbD
62
+ K_E = KbE
63
+ K_F = KbF
64
+ K_G = KbG
65
+ K_H = KbH
66
+ K_I = KbI
67
+ K_J = KbJ
68
+ K_K = KbK
69
+ K_L = KbL
70
+ K_M = KbM
71
+ K_N = KbN
72
+ K_O = KbO
73
+ K_P = KbP
74
+ K_Q = KbQ
75
+ K_R = KbR
76
+ K_S = KbS
77
+ K_T = KbT
78
+ K_U = KbU
79
+ K_V = KbV
80
+ K_W = KbW
81
+ K_X = KbX
82
+ K_Y = KbY
83
+ K_Z = KbZ
84
+ K_DELETE = KbDelete
85
+
86
+ K_WORLD_0 = enum += 1
87
+ K_WORLD_1 = enum += 1
88
+ K_WORLD_2 = enum += 1
89
+ K_WORLD_3 = enum += 1
90
+ K_WORLD_4 = enum += 1
91
+ K_WORLD_5 = enum += 1
92
+ K_WORLD_6 = enum += 1
93
+ K_WORLD_7 = enum += 1
94
+ K_WORLD_8 = enum += 1
95
+ K_WORLD_9 = enum += 1
96
+ K_WORLD_10 = enum += 1
97
+ K_WORLD_11 = enum += 1
98
+ K_WORLD_12 = enum += 1
99
+ K_WORLD_13 = enum += 1
100
+ K_WORLD_14 = enum += 1
101
+ K_WORLD_15 = enum += 1
102
+ K_WORLD_16 = enum += 1
103
+ K_WORLD_17 = enum += 1
104
+ K_WORLD_18 = enum += 1
105
+ K_WORLD_19 = enum += 1
106
+ K_WORLD_20 = enum += 1
107
+ K_WORLD_21 = enum += 1
108
+ K_WORLD_22 = enum += 1
109
+ K_WORLD_23 = enum += 1
110
+ K_WORLD_24 = enum += 1
111
+ K_WORLD_25 = enum += 1
112
+ K_WORLD_26 = enum += 1
113
+ K_WORLD_27 = enum += 1
114
+ K_WORLD_28 = enum += 1
115
+ K_WORLD_29 = enum += 1
116
+ K_WORLD_30 = enum += 1
117
+ K_WORLD_31 = enum += 1
118
+ K_WORLD_32 = enum += 1
119
+ K_WORLD_33 = enum += 1
120
+ K_WORLD_34 = enum += 1
121
+ K_WORLD_35 = enum += 1
122
+ K_WORLD_36 = enum += 1
123
+ K_WORLD_37 = enum += 1
124
+ K_WORLD_38 = enum += 1
125
+ K_WORLD_39 = enum += 1
126
+ K_WORLD_40 = enum += 1
127
+ K_WORLD_41 = enum += 1
128
+ K_WORLD_42 = enum += 1
129
+ K_WORLD_43 = enum += 1
130
+ K_WORLD_44 = enum += 1
131
+ K_WORLD_45 = enum += 1
132
+ K_WORLD_46 = enum += 1
133
+ K_WORLD_47 = enum += 1
134
+ K_WORLD_48 = enum += 1
135
+ K_WORLD_49 = enum += 1
136
+ K_WORLD_50 = enum += 1
137
+ K_WORLD_51 = enum += 1
138
+ K_WORLD_52 = enum += 1
139
+ K_WORLD_53 = enum += 1
140
+ K_WORLD_54 = enum += 1
141
+ K_WORLD_55 = enum += 1
142
+ K_WORLD_56 = enum += 1
143
+ K_WORLD_57 = enum += 1
144
+ K_WORLD_58 = enum += 1
145
+ K_WORLD_59 = enum += 1
146
+ K_WORLD_60 = enum += 1
147
+ K_WORLD_61 = enum += 1
148
+ K_WORLD_62 = enum += 1
149
+ K_WORLD_63 = enum += 1
150
+ K_WORLD_64 = enum += 1
151
+ K_WORLD_65 = enum += 1
152
+ K_WORLD_66 = enum += 1
153
+ K_WORLD_67 = enum += 1
154
+ K_WORLD_68 = enum += 1
155
+ K_WORLD_69 = enum += 1
156
+ K_WORLD_70 = enum += 1
157
+ K_WORLD_71 = enum += 1
158
+ K_WORLD_72 = enum += 1
159
+ K_WORLD_73 = enum += 1
160
+ K_WORLD_74 = enum += 1
161
+ K_WORLD_75 = enum += 1
162
+ K_WORLD_76 = enum += 1
163
+ K_WORLD_77 = enum += 1
164
+ K_WORLD_78 = enum += 1
165
+ K_WORLD_79 = enum += 1
166
+ K_WORLD_80 = enum += 1
167
+ K_WORLD_81 = enum += 1
168
+ K_WORLD_82 = enum += 1
169
+ K_WORLD_83 = enum += 1
170
+ K_WORLD_84 = enum += 1
171
+ K_WORLD_85 = enum += 1
172
+ K_WORLD_86 = enum += 1
173
+ K_WORLD_87 = enum += 1
174
+ K_WORLD_88 = enum += 1
175
+ K_WORLD_89 = enum += 1
176
+ K_WORLD_90 = enum += 1
177
+ K_WORLD_91 = enum += 1
178
+ K_WORLD_92 = enum += 1
179
+ K_WORLD_93 = enum += 1
180
+ K_WORLD_94 = enum += 1
181
+ K_WORLD_95 = enum += 1
182
+
183
+ K_KP0 = enum += 1
184
+ K_KP1 = enum += 1
185
+ K_KP2 = enum += 1
186
+ K_KP3 = enum += 1
187
+ K_KP4 = enum += 1
188
+ K_KP5 = enum += 1
189
+ K_KP6 = enum += 1
190
+ K_KP7 = enum += 1
191
+ K_KP8 = enum += 1
192
+ K_KP9 = enum += 1
193
+ K_KP_PERIOD = enum += 1
194
+ K_KP_DIVIDE = enum += 1
195
+ K_KP_MULTIPLY = enum += 1
196
+ K_KP_MINUS = enum += 1
197
+ K_KP_PLUS = enum += 1
198
+ K_KP_ENTER = enum += 1
199
+ K_KP_EQUALS = enum += 1
200
+
201
+ K_UP = KbUp
202
+ K_DOWN = KbDown
203
+ K_RIGHT = KbRight
204
+ K_LEFT = KbLeft
205
+ K_INSERT = enum += 1
206
+ K_HOME = enum += 1
207
+ K_END = enum += 1
208
+ K_PAGEUP = enum += 1
209
+ K_PAGEDOWN = enum += 1
210
+
211
+ K_F1 = enum += 1
212
+ K_F2 = enum += 1
213
+ K_F3 = enum += 1
214
+ K_F4 = enum += 1
215
+ K_F5 = enum += 1
216
+ K_F6 = enum += 1
217
+ K_F7 = enum += 1
218
+ K_F8 = enum += 1
219
+ K_F9 = enum += 1
220
+ K_F10 = enum += 1
221
+ K_F11 = enum += 1
222
+ K_F12 = enum += 1
223
+ K_F13 = enum += 1
224
+ K_F14 = enum += 1
225
+ K_F15 = enum += 1
226
+
227
+ K_NUMLOCK = enum += 1
228
+ K_CAPSLOCK = enum += 1
229
+ K_SCROLLOCK = enum += 1
230
+ K_RSHIFT = enum += 1
231
+ K_LSHIFT = enum += 1
232
+ K_RCTRL = enum += 1
233
+ K_LCTRL = enum += 1
234
+ K_RALT = enum += 1
235
+ K_LALT = enum += 1
236
+ K_RMETA = enum += 1
237
+ K_LMETA = enum += 1
238
+ K_LSUPER = enum += 1
239
+ K_RSUPER = enum += 1
240
+ K_MODE = enum += 1
241
+
242
+ K_HELP = enum += 1
243
+ K_PRINT = enum += 1
244
+ K_SYSREQ = enum += 1
245
+ K_BREAK = enum += 1
246
+ K_MENU = enum += 1
247
+ K_POWER = enum += 1
248
+ K_EURO = enum += 1
249
+ K_LAST = enum += 1
250
+
251
+ K_MOD_NONE = enum += 1
252
+ K_MOD_LSHIFT = enum += 1
253
+ K_MOD_RSHIFT = enum += 1
254
+ K_MOD_LCTRL = enum += 1
255
+ K_MOD_RCTRL = enum += 1
256
+ K_MOD_LALT = enum += 1
257
+ K_MOD_RALT = enum += 1
258
+ K_MOD_LMETA = enum += 1
259
+ K_MOD_RMETA = enum += 1
260
+ K_MOD_NUM = enum += 1
261
+ K_MOD_CAPS = enum += 1
262
+ K_MOD_MODE = enum += 1
263
+ K_MOD_RESERVED = enum += 1
264
+
265
+ K_MOD_CTRL = enum += 1
266
+ K_MOD_SHIFT = enum += 1
267
+ K_MOD_ALT = enum += 1
268
+ K_MOD_META = enum += 1
269
+
270
+
271
+ # key/mouse event mappings
272
+ module Mouse
273
+ # Hash to translate mouse button sym to string
274
+ MOUSE2STR = {
275
+ MOUSE_LEFT => "left",
276
+ MOUSE_MIDDLE => "middle",
277
+ MOUSE_RIGHT => "right"
278
+ }
279
+ # And to translate the other way...
280
+ STR2MOUSE = MOUSE2STR.invert()
281
+ # And allow numbers too (1 = left, so on)...
282
+ STR2MOUSE[1] = MOUSE_LEFT
283
+ STR2MOUSE[2] = MOUSE_MIDDLE
284
+ STR2MOUSE[3] = MOUSE_RIGHT
285
+ end # module Mouse
286
+
287
+ module Key
288
+ # All the keys which have ASCII print values
289
+ # It is 87 lines from here to the closing }, if you want to skip it...
290
+ KEY2ASCII = {
291
+ K_BACKSPACE => "\b",
292
+ K_TAB => "\t",
293
+ K_RETURN => "\n", #SDL docs: "\r". Win vs *nix? What about Mac?
294
+ K_ESCAPE => "^[",
295
+ K_SPACE => " ",
296
+ K_EXCLAIM => "!",
297
+ K_QUOTEDBL => "\"",
298
+ K_HASH => "#",
299
+ K_DOLLAR => "$",
300
+ K_AMPERSAND => "&",
301
+ K_QUOTE => "\'",
302
+ K_LEFTPAREN => "(",
303
+ K_RIGHTPAREN => ")",
304
+ K_ASTERISK => "*",
305
+ K_PLUS => "+",
306
+ K_COMMA => ",",
307
+ K_MINUS => "-",
308
+ K_PERIOD => ".",
309
+ K_SLASH => "/",
310
+ K_0 => "0",
311
+ K_1 => "1",
312
+ K_2 => "2",
313
+ K_3 => "3",
314
+ K_4 => "4",
315
+ K_5 => "5",
316
+ K_6 => "6",
317
+ K_7 => "7",
318
+ K_8 => "8",
319
+ K_9 => "9",
320
+ K_COLON => ":",
321
+ K_SEMICOLON => ";",
322
+ K_LESS => "<",
323
+ K_EQUALS => "=",
324
+ K_GREATER => ">",
325
+ K_QUESTION => "?",
326
+ K_AT => "@",
327
+ K_LEFTBRACKET => "[",
328
+ K_BACKSLASH => "\\",
329
+ K_RIGHTBRACKET => "]",
330
+ K_CARET => "^",
331
+ K_UNDERSCORE => "_",
332
+ K_BACKQUOTE => "`",
333
+ K_A => "a",
334
+ K_B => "b",
335
+ K_C => "c",
336
+ K_D => "d",
337
+ K_E => "e",
338
+ K_F => "f",
339
+ K_G => "g",
340
+ K_H => "h",
341
+ K_I => "i",
342
+ K_J => "j",
343
+ K_K => "k",
344
+ K_L => "l",
345
+ K_M => "m",
346
+ K_N => "n",
347
+ K_O => "o",
348
+ K_P => "p",
349
+ K_Q => "q",
350
+ K_R => "r",
351
+ K_S => "s",
352
+ K_T => "t",
353
+ K_U => "u",
354
+ K_V => "v",
355
+ K_W => "w",
356
+ K_X => "x",
357
+ K_Y => "y",
358
+ K_Z => "z",
359
+ K_KP0 => "0",
360
+ K_KP1 => "1",
361
+ K_KP2 => "2",
362
+ K_KP3 => "3",
363
+ K_KP4 => "4",
364
+ K_KP5 => "5",
365
+ K_KP6 => "6",
366
+ K_KP7 => "7",
367
+ K_KP8 => "8",
368
+ K_KP9 => "9",
369
+ K_KP_PERIOD => ".",
370
+ K_KP_DIVIDE => "/",
371
+ K_KP_MULTIPLY => "*",
372
+ K_KP_MINUS => "-",
373
+ K_KP_PLUS => "+",
374
+ K_KP_ENTER => "\n", #again, SDL docs say "\r"
375
+ K_KP_EQUALS => "=",
376
+ }
377
+
378
+ # And to translate the other way...
379
+ ASCII2KEY = KEY2ASCII.invert()
380
+ # accept uppercase letters too, return same as lowercase version:
381
+ ("a".."z").each{ |letter| ASCII2KEY[letter.upcase] = ASCII2KEY[letter] }
382
+
383
+ # All the keys that are affected by the Shift key, in lower case
384
+ # 49 lines from here to the end of the hash
385
+ KEY2LOWER = {
386
+ K_QUOTE => "\'",
387
+ K_COMMA => ",",
388
+ K_MINUS => "-",
389
+ K_PERIOD => ".",
390
+ K_SLASH => "/",
391
+ K_0 => "0",
392
+ K_1 => "1",
393
+ K_2 => "2",
394
+ K_3 => "3",
395
+ K_4 => "4",
396
+ K_5 => "5",
397
+ K_6 => "6",
398
+ K_7 => "7",
399
+ K_8 => "8",
400
+ K_9 => "9",
401
+ K_SEMICOLON => ";",
402
+ K_EQUALS => "=",
403
+ K_LEFTBRACKET => "[",
404
+ K_BACKSLASH => "\\",
405
+ K_RIGHTBRACKET => "]",
406
+ K_BACKQUOTE => "`",
407
+ K_A => "a",
408
+ K_B => "b",
409
+ K_C => "c",
410
+ K_D => "d",
411
+ K_E => "e",
412
+ K_F => "f",
413
+ K_G => "g",
414
+ K_H => "h",
415
+ K_I => "i",
416
+ K_J => "j",
417
+ K_K => "k",
418
+ K_L => "l",
419
+ K_M => "m",
420
+ K_N => "n",
421
+ K_O => "o",
422
+ K_P => "p",
423
+ K_Q => "q",
424
+ K_R => "r",
425
+ K_S => "s",
426
+ K_T => "t",
427
+ K_U => "u",
428
+ K_V => "v",
429
+ K_W => "w",
430
+ K_X => "x",
431
+ K_Y => "y",
432
+ K_Z => "z",
433
+ }
434
+
435
+ # All the keys that are affected by the Shift key, in UPPER case
436
+ # 49 lines from here to the end of the hash
437
+ KEY2UPPER = {
438
+ K_QUOTE => "\"",
439
+ K_COMMA => "<",
440
+ K_MINUS => "_",
441
+ K_PERIOD => ">",
442
+ K_SLASH => "?",
443
+ K_0 => ")",
444
+ K_1 => "!",
445
+ K_2 => "@",
446
+ K_3 => "#",
447
+ K_4 => "$",
448
+ K_5 => "%",
449
+ K_6 => "^",
450
+ K_7 => "&",
451
+ K_8 => "*",
452
+ K_9 => "(",
453
+ K_SEMICOLON => ":",
454
+ K_EQUALS => "+",
455
+ K_LEFTBRACKET => "{",
456
+ K_BACKSLASH => "|",
457
+ K_RIGHTBRACKET => "}",
458
+ K_BACKQUOTE => "~",
459
+ K_A => "A",
460
+ K_B => "B",
461
+ K_C => "C",
462
+ K_D => "D",
463
+ K_E => "E",
464
+ K_F => "F",
465
+ K_G => "G",
466
+ K_H => "H",
467
+ K_I => "I",
468
+ K_J => "J",
469
+ K_K => "K",
470
+ K_L => "L",
471
+ K_M => "M",
472
+ K_N => "N",
473
+ K_O => "O",
474
+ K_P => "P",
475
+ K_Q => "Q",
476
+ K_R => "R",
477
+ K_S => "S",
478
+ K_T => "T",
479
+ K_U => "U",
480
+ K_V => "V",
481
+ K_W => "W",
482
+ K_X => "X",
483
+ K_Y => "Y",
484
+ K_Z => "Z",
485
+ }
486
+ end #module Key
487
+
488
+ include Mouse
489
+ include Key
490
+
1
491
  class GosuAppAdapter
2
492
 
3
493
  def initialize(app,main_window)
4
494
  @app = app
5
495
  @main_window = main_window
496
+
497
+ @last_mouse_x = 0
498
+ @last_mouse_y = 0
6
499
  end
7
500
 
8
501
  def update(time)
502
+ x = @main_window.mouse_x
503
+ y = @main_window.mouse_y
504
+ if x != @last_mouse_x or y != @last_mouse_y
505
+ @app.on_event GooEvent.new(:mouse_motion, {
506
+ :x => x, :y => y})
507
+ end
9
508
  @app.update time
10
509
  end
11
510
 
@@ -20,11 +519,6 @@ class GosuAppAdapter
20
519
  @app.on_event GooEvent.new(:mouse_down, {
21
520
  :x => @main_window.mouse_x, :y => @main_window.mouse_y,
22
521
  :button => MOUSE_LEFT})
23
-
24
- # gosu doens't track mouse motion?
25
- when MouseMotionEvent
26
- @app.on_event GooEvent.new(:mouse_motion, {
27
- :x => event.pos[0], :y => event.pos[1]})
28
522
  else
29
523
  # assume it's a key
30
524
  # where do I get the mods? ie shift,alt,ctrl
@@ -37,14 +531,23 @@ class GosuAppAdapter
37
531
  mods << K_LSHIFT if @main_window.button_down? KbLeftShift
38
532
  mods << K_RSHIFT if @main_window.button_down? KbRightShift
39
533
  button_string = @main_window.button_id_to_char(id)
534
+
535
+
536
+ # TODO add caps
537
+ button_string ||= "?"
40
538
  @app.on_event GooEvent.new(:key_pressed, {
41
539
  :key => id, :mods => mods, :string => button_string})
42
540
  end
43
541
  end
44
542
 
45
543
  def button_up(id)
46
- # TODO copy and tweak from above
544
+ case id
545
+ when MsLeft
546
+ @app.on_event GooEvent.new(:mouse_up, {
547
+ :x => @main_window.mouse_x, :y => @main_window.mouse_y,
548
+ :button => MOUSE_LEFT})
549
+ end
47
550
  end
48
-
551
+ end
49
552
 
50
553
  end