Processing::Appからのkey, mouseイベントのフック
下記記事には大きな問題が有りまして
こちらに修正記事を書きましたのデスw<
module Page def keyPressed event # hooked keyPress p "hook key" super event end def mousePressed event # hooked mousePress p "hook mouse" super event end end include Page def setup size 800,600 frame_rate 1 end def draw #none end def keyPressed p "key" end def mousePressed p "mouse" end
以下、実行結果。キチンとフック出来てる^^
"hook mouse" #<=mouse clicked "mouse" "hook key" #<=key pressed "key"
ただ、問題も。
フックするkeyPressed等が未定義だとエラー吐く><
module Page def keyPressed event # hooked keyPress p "hook key" super event end def mousePressed event # hooked mousePress p "hook mouse" super event end end include Page def setup size 800,600 frame_rate 1 end def draw #none end #def keyPressed # p "key" #end # #def mousePressed # p "mouse" #end
こんな感じにw;どうしようかな。
"hook mouse" Exception in thread "Animation Thread" :1:in `mousePressed': wrong # of argument s(0 for 1) (ArgumentError) from :1 ...internal jruby stack elided... from Sketch::Page.mousePressed(:1) from (unknown).(unknown)(:1)