Permalink
Browse files

...

  • Loading branch information...
1 parent a592990 commit 48feba36330271d427d918e94aec6d91db96081e Nik Nyby committed Apr 27, 2010
Showing with 10 additions and 19 deletions.
  1. +9 −4 Bindings.hs
  2. +1 −15 Menu.hs
View
@@ -60,7 +60,7 @@ animatorAction e (MouseButton LeftButton) Down =
-- TODO: just look at this mess!
--
e { sprites = (updateSelected . updateDragged) (sprites e),
- vars = (vars e) { menu = buttonMap updateButton (menu$vars$e) }
+ vars = (vars e) { menu = buttonMap buttonSweep (menu$vars$e) }
}
where
updateSelected :: [Sprite] -> [Sprite]
@@ -74,10 +74,15 @@ animatorAction e (MouseButton LeftButton) Down =
spriteUnder :: [Sprite] -> [Sprite]
spriteUnder ss = oneOrNone $ filter ((within mp) . rectangle) ss
+ buttonSweep :: MmaButton -> MmaButton
+ buttonSweep b = if within mp (buttonRect b)
+ then updateButton b
+ else b
+
updateButton :: MmaButton -> MmaButton
- updateButton b = b { buttonState = if within mp (buttonRect b)
- then not $ buttonState b
- else buttonState b }
+ updateButton b = b { buttonState = not (buttonState b) }
+-- updateButton b = case b of
+-- nextSprtButton ->
updateWindow :: MmaWindow -> MmaWindow
updateWindow w = w
View
@@ -71,25 +71,11 @@ buttonMap f m = m {
mkMenu :: GLdouble -> GLdouble -> GLdouble -> [GLdouble]
mkMenu wwd bwd sp = [sp, (sp*2)+bwd .. wwd]
- {-
-instance Functor MmaMenu where
- fmap f m = m {
- playButton = f (playButton m),
- nextSprtButton = f (nextSprtButton m),
- prevSprtButton = f (prevSprtButton m),
- nextBgButton = f (nextBgButton m),
- prevBgButton = f (prevBgButton m),
- nextFrameButton = f (nextFrameButton m),
- prevFrameButton = f (prevFrameButton m),
- saveButton = f (saveButton m)
- }
- -}
-
data MmaButton = MmaButton
{
buttonRect :: Rectangle,
- --buttonTex :: MmaTexture,
+ --buttonTex :: MmaTexture,
buttonState :: Bool
} deriving Show

0 comments on commit 48feba3

Please sign in to comment.