Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apparently working GLUT hack for running examples in Linux #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions game-in-haskell-book.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/Animated.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -78,6 +80,7 @@ monsterSpeed = 5

main :: IO ()
main = do
(_,_) <- GLUT.getArgsAndInitialize
(directionKey, directionKeySink) <- external (False, False, False, False)
randomGenerator <- newStdGen
glossState <- initState
Expand Down
3 changes: 3 additions & 0 deletions src/Hunted/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions src/Music.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -89,6 +91,7 @@ monsterSpeed = 5

main :: IO ()
main = do
(_,_) <- GLUT.getArgsAndInitialize
(directionKey, directionKeySink) <- external (False, False, False, False)
randomGenerator <- newStdGen
glossState <- initState
Expand Down
3 changes: 3 additions & 0 deletions src/Shapes.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/StateFRP.hs
Original file line number Diff line number Diff line change
@@ -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 )
Expand Down Expand Up @@ -38,6 +39,7 @@ monsterSpeed = 5

main :: IO ()
main = do
(_,_) <- GLUT.getArgsAndInitialize
(directionKey, directionKeySink) <- external (False, False, False, False)
randomGenerator <- newStdGen
glossState <- initState
Expand Down