LoginSignup
2
2

More than 5 years have passed since last update.

Haskell/Graphics.Glossでマウス座標を取得する

Last updated at Posted at 2012-09-25

何故かhackageに一切説明がなかったので一応ここに投稿しておきます

handleInput以外の部分はHaskell/Graphics.Glossと全く同じなので省略します

Main.hs

handleInput :: Event -> World -> World
handleInput (EventKey k ks a b) s = s
-- a :: Modifiers, b :: (Float, Float)
-- aがmodifiersを表し、bがマウス座標を表します
-- 例:a : Modifiers {shift = Up, ctrl = Up, alt = Up}
--   b : (311.0,75.0)

handleInput (EventMotion a) s = s
-- ついでにこちらも
-- aはマウス座標を表します
-- 上の函数はイベント発生時のみ呼ばれますがこちらはマウスが動くたびに呼ばれます
-- a :: (Float, Float)
-- 例:a : (311.0,75.0)
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2