Skip to content

Commit 7882f5f

Browse files
committed
mouse demo
1 parent adfcb83 commit 7882f5f

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed
Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
class MouseThing < LibraryProxy
2+
attr_reader :app, :count
3+
def initialize(app)
4+
@app = app
5+
@count = 0
6+
end
7+
28
def draw
39
end
410

511
def mouseEvent(event)
612
case event.action
713
when MouseEvent::CLICK
8-
puts 'CLICK'
14+
# puts 'CLICK'
15+
app.send :puts, event.toString
916
when MouseEvent::DRAG
1017
puts 'DRAG'
18+
when MouseEvent::WHEEL
19+
@count += event.getCount
20+
puts count
1121
end
1222
end
1323
end

processing_app/library/library_proxy/mouse_event_demo.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
load_libraries :library_proxy, :mouse_thing
22

3-
attr_reader :mouseThing
3+
attr_reader :mouse_proxy
44

55
def settings
66
size(800, 600)
77
end
88

99
def setup
1010
sketch_title 'Mouse Event'
11-
frameRate(1)
11+
frame_rate(1)
1212
MouseThing.new(self)
1313
end
1414

0 commit comments

Comments
 (0)