2010-11-03から1日間の記事一覧

継承したクラスのオープンクラス動作の確認

まあ、当たり前か>< module M class B def bb p :bb end end class C < B def cc p :cc end end end module M class C def test bb cc end end end p M::C.ancestors #=>[M::C, M::B, Object, Kernel] M::C.new.test #=> :bb # :cc

継承順序の確認

メソッドのフックしたかったので、オーバーライドの順序調べてみる>< class C NAME = self.to_s def hook p NAME end end module M1 NAME = self.to_s def hook p NAME super end end module M2 NAME = self.to_s def hook p NAME super end end class S <…

Processing::Appからのkey, mouseイベントのフック

下記記事には大きな問題が有りまして こちらに修正記事を書きましたのデスw< keyCode \ Language (API) \ Processing 3+ http://java.sun.com/j2se/1.4.2/docs/api/java/awt/event/KeyEvent.html module Page def keyPressed event # hooked keyPress p "h…

キー入力による別画像の連続表示

def setup size 800,600 frame_rate 10 @ary = %w[1_h 2_h 1_v 2_v] end def draw if key_pressed? if key == CODED and key_code == UP @map = load_image "img#{@ary.pop}.jpg" background 255 image @map,((width/2)-(@map.width/2)),(height/2)-(@map.he…