diff --git a/game-in-haskell-book.cabal b/game-in-haskell-book.cabal index 878f1af..52e8432 100644 --- a/game-in-haskell-book.cabal +++ b/game-in-haskell-book.cabal @@ -27,6 +27,7 @@ executable shapes-demo , bytestring , gloss == 1.9.2.1 , gloss-rendering == 1.9.2.1 + , GLUT == 2.5.1.1 hs-source-dirs: src default-language: Haskell2010 @@ -39,6 +40,7 @@ executable state-demo , GLFW-b == 1.4.6 , gloss == 1.9.2.1 , gloss-rendering == 1.9.2.1 + , GLUT == 2.5.1.1 hs-source-dirs: src default-language: Haskell2010 @@ -53,6 +55,7 @@ executable frp-demo , gloss-rendering == 1.9.2.1 , elerea == 2.8.0 , random == 1.1 + , GLUT == 2.5.1.1 hs-source-dirs: src default-language: Haskell2010 @@ -67,6 +70,7 @@ executable animated , gloss-rendering == 1.9.2.1 , elerea == 2.8.0 , random == 1.1 + , GLUT == 2.5.1.1 hs-source-dirs: src default-language: Haskell2010 @@ -82,6 +86,7 @@ executable music , elerea == 2.8.0 , random == 1.1 , ALUT == 2.3.0.2 + , GLUT == 2.5.1.1 hs-source-dirs: src default-language: Haskell2010 @@ -101,6 +106,7 @@ executable extended , random == 1.1 , ALUT == 2.3.0.2 , containers + , GLUT == 2.5.1.1 hs-source-dirs: src default-language: Haskell2010 @@ -123,6 +129,7 @@ library , random == 1.1 , ALUT == 2.3.0.2 , containers + , GLUT == 2.5.1.1 , bytestring , aeson == 0.8.0.2 , time diff --git a/src/Animated.hs b/src/Animated.hs index 1bab1d5..01ffbf4 100644 --- a/src/Animated.hs +++ b/src/Animated.hs @@ -12,6 +12,8 @@ import Control.Applicative ((<*>), (<$>)) import FRP.Elerea.Simple import System.Random +import qualified Graphics.UI.GLUT as GLUT + type Pos = Point data Player = Player { position :: Pos, movement :: Maybe PlayerMovement } deriving Show @@ -78,6 +80,7 @@ monsterSpeed = 5 main :: IO () main = do + (_,_) <- GLUT.getArgsAndInitialize (directionKey, directionKeySink) <- external (False, False, False, False) randomGenerator <- newStdGen glossState <- initState diff --git a/src/Hunted/Main.hs b/src/Hunted/Main.hs index 53a1e3b..7134b59 100644 --- a/src/Hunted/Main.hs +++ b/src/Hunted/Main.hs @@ -10,6 +10,8 @@ import Control.Monad (unless, join) import Control.Monad.Fix (fix) import FRP.Elerea.Simple as Elerea +import qualified Graphics.UI.GLUT as GLUT + width :: Int width = 640 @@ -18,6 +20,7 @@ height = 480 main :: IO () main = do + (_,_) <- GLUT.getArgsAndInitialize (directionKey, directionKeySink) <- external (False, False, False, False) (shootKey, shootKeySink) <- external (False, False, False, False) (windowSize,windowSizeSink) <- external (fromIntegral width, fromIntegral height) diff --git a/src/Music.hs b/src/Music.hs index 33fcfbd..fea68e2 100644 --- a/src/Music.hs +++ b/src/Music.hs @@ -15,6 +15,8 @@ import Sound.ALUT hiding (Static, direction) import System.IO ( hPutStrLn, stderr ) import Data.List (intersperse) +import qualified Graphics.UI.GLUT as GLUT + type Pos = Point data Player = Player { position :: Pos, movement :: Maybe PlayerMovement } deriving Show @@ -89,6 +91,7 @@ monsterSpeed = 5 main :: IO () main = do + (_,_) <- GLUT.getArgsAndInitialize (directionKey, directionKeySink) <- external (False, False, False, False) randomGenerator <- newStdGen glossState <- initState diff --git a/src/Shapes.hs b/src/Shapes.hs index 30cd069..8c61842 100644 --- a/src/Shapes.hs +++ b/src/Shapes.hs @@ -7,12 +7,15 @@ import System.Exit ( exitSuccess ) import Control.Concurrent (threadDelay) import Control.Monad (when, unless) +import qualified Graphics.UI.GLUT as GLUT + windowWidth, windowHeight :: Int windowWidth = 640 windowHeight = 480 main :: IO () main = do + (_,_) <- GLUT.getArgsAndInitialize glossState <- initState withWindow windowWidth windowHeight "Game-Demo" $ \win -> do loop glossState win diff --git a/src/StateFRP.hs b/src/StateFRP.hs index 9217c30..3405f4f 100644 --- a/src/StateFRP.hs +++ b/src/StateFRP.hs @@ -1,5 +1,6 @@ {-# LANGUAGE PackageImports, RecursiveDo #-} import "GLFW-b" Graphics.UI.GLFW as GLFW +import qualified Graphics.UI.GLUT as GLUT import Graphics.Gloss import Graphics.Gloss.Rendering import System.Exit ( exitSuccess ) @@ -38,6 +39,7 @@ monsterSpeed = 5 main :: IO () main = do + (_,_) <- GLUT.getArgsAndInitialize (directionKey, directionKeySink) <- external (False, False, False, False) randomGenerator <- newStdGen glossState <- initState