]> Git — Sourcephile - tmp/julm/arpeggigon.git/blob - RMCA/GUI/Board.hs
RMCA/GUI/Board.hs
[tmp/julm/arpeggigon.git] / RMCA / GUI / Board.hs
1 module RMCA.GUI.Board where
2
3 import Game.Board.BasicTurnGame
4
5 instance PlayableGame Board Int BoardTile () Cell where
6 -- Only one player
7 curPlayer _ = ()
8 allPos = (\((x,y),z) -> (x,y,z)) . assoc
9
10
11 pixbufFrom :: (Int, Int) -> Cell -> IO Pixbuf
12 pixbufFrom (hexW,hexH) (a,_) = do
13 let pixbufScaleSimple' p = pixbufScaleSimple p hexW hexH InterpBilinear
14 actionToFile = case a of
15 Inert -> "img/hexOff.png"
16 Absorb -> "img/stop.svg"
17 Stop _ -> "img/stop.svg"
18 ChDir True _ _ -> "img/start.svg"
19 ChDir False _ _ -> "img/ric.svg"
20 Split _ -> "img/split.svg"
21 pixbufComposeAct p pa =
22 pixbufComposite p pa 0 0 hexW hexH 0 0 1 1 InterpBilinear 255
23 pixbufOn <- pixbufScaleSimple' =<< pixbufNewFromFile "img/hexOff.png"
24 pixbufAct <- pixbufScaleSimple' =<< pixbufNewFromFile actionToFile
25 pixbufComposeAct pixbufOn pixbufAct
26 return pixbufAct