Skip to content

Commit 30dcffe

Browse files
committed
mouse demo
1 parent 65bc0ed commit 30dcffe

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33

44
class MouseEventDemo < Propane::App
55
load_libraries :library_proxy, :mouse_thing
6+
attr_reader :thing
67

78
def settings
89
size(800, 600)
910
end
1011

1112
def setup
1213
sketch_title 'Mouse Event Demo'
13-
MouseThing.new(self)
14+
@thing = MouseThing.new(self)
1415
end
1516

1617
def draw

0 commit comments

Comments
 (0)