イベントを取り扱うためのクラス。module SDL の中にある。
ruby extconf.rb --enable-event2 とすれば使用可能
Object
Event2.poll
現在イベントキュー内で処理待ちしているイベントがないかをしらべ、 ひとつでもあればそのイベントに対応するクラスのインスタンスを返す。 ひとつもなければnilを返す。 返すインスタンスに対応するクラスは以下の通り。
Event2::Active Event2::KeyDown Event2::KeyUp Event2::MouseMotion Event2::MouseButtonDown Event2::MouseButtonUp Event2::JoyAxis Event2::JoyBall Event2::JoyHat Event2::JoyButtonUp Event2::JoyButtonDown Event2::Quit Event2::SysWM Event2::VideoResize
これらのクラスはすべてEvent2のサブクラスである。
Event2.wait
次のイベントが来るまで待ち、来ればそのイベントに対応するクラスの インスタンスを返す。
Event2.push(event)
Event2.new
Event2.poll,Event2.waitはEvent2のサブクラスのインスタンスを返します。 そのクラスは以下の通りであり、以下のメソッドを持っています。 その意味はSDLのマニュアルを見て調べてください(そのうちちゃんと書きます)。
Event2::Active#gain
Event2::Active#state
Event2::KeyDown#press
Event2::KeyDown#sym
Event2::KeyDown#mod
Event2::KeyUp#press
Event2::KeyUp#sym
Event2::KeyUp#mod
Event2::MouseMotion#state
Event2::MouseMotion#x
Event2::MouseMotion#y
Event2::MouseMotion#xrel
Event2::MouseMotion#yrel
Event2::MouseButtonDown#button
Event2::MouseButtonDown#press
Event2::MouseButtonDown#x
Event2::MouseButtonDown#y
Event2::MouseButtonUp#button
Event2::MouseButtonUp#press
Event2::MouseButtonUp#x
Event2::MouseButtonUp#y
Event2::JoyAxis#which
Event2::JoyAxis#axis
Event2::JoyAxis#value
Event2::JoyBall#which
Event2::JoyBall#ball
Event2::JoyBall#xrel
Event2::JoyBall#yrel
Event2::JoyHat#which
Event2::JoyHat#hat
Event2::JoyHat#value
Event2::JoyButtonUp#which
Event2::JoyButtonUp#button
Event2::JoyButtonUp#press
Event2::JoyButtonDown#which
Event2::JoyButtonDown#button
Event2::JoyButtonDown#press
Event2::VideoResize#w
Event2::VideoResize#h