Skip to content
Browse files

- Screen now takes color depth.

- Another viewConfig function (using liftM3).
  • Loading branch information...
1 parent 430a3e4 commit 63364a1742d0754a19da3619b9ca5619e1e6a250 @graninas committed Jan 30, 2014
View
4 Amoeba.cabal
@@ -50,7 +50,6 @@ library
GameLogic.Runtime.World,
Middleware.Config.Config,
Middleware.Config.Facade,
- Middleware.Config.Language,
Middleware.Config.Scheme,
View.Color,
View.Config,
@@ -78,5 +77,4 @@ executable Amoeba
Middleware.Config.Scheme,
Middleware.Config.Facade,
View.View,
- View.Config,
- Middleware.Config.Language
+ View.Config
View
4 Amoeba/Application/Boot.hs
@@ -1,11 +1,11 @@
module Application.Boot where
import View.Config
-
import Middleware.Config.Facade
boot cfg = do
- viewCfg <- getConfig cfg viewConfig
+ viewCfg <- getConfig cfg viewConfig'
+
print viewCfg
View
8 Amoeba/Application/Environment.hs
@@ -5,15 +5,7 @@ import qualified Graphics.UI.SDL.TTF.General as TTF
import Control.Exception (bracket_, bracket)
-import View.Config
-
withTtf = bracket_ TTF.init TTF.quit
withEnvironment action = withTtf (SDL.withInit [SDL.InitEverything] action)
-setupScreen :: (Screen, Int) -> String -> IO View
-setupScreen (scr@(Screen scrWidth scrHeight), scrBpp) caption = do
- surface <- SDL.setVideoMode scrWidth scrHeight scrBpp [SDL.SWSurface]
- SDL.setCaption caption []
- SDL.flip surface
- return $ View surface scr
View
6 Amoeba/Middleware/Config/Language.hs
@@ -1,6 +0,0 @@
-module Middleware.Config.Language where
-
-module Middleware.Config.Config
-
-
-option =
View
3 Amoeba/Middleware/Config/Scheme.hs
@@ -8,4 +8,5 @@ appName = deflt <| opt "applicationName"
video = sect "VIDEO"
screenWidth = video <| opt "screenWidth"
-screenHeight = video <| opt "screenHeight"
+screenHeight = video <| opt "screenHeight"
+colorDepth = video <| opt "colorDepth"
View
8 Amoeba/View/Config.hs
@@ -1,16 +1,20 @@
module View.Config where
import Middleware.Config.Facade
+import Control.Monad
data Screen = Screen { width :: Int
, height :: Int
+ , depth :: Int
}
deriving (Show, Read, Eq)
viewConfig = do
sw <- intOption screenWidth
sh <- intOption screenHeight
- return $ Screen sw sh
-
+ cd <- intOption colorDepth
+ return $ Screen sw sh cd
+i = intOption
+viewConfig' = liftM3 Screen (i screenWidth) (i screenHeight) (i colorDepth)
View
10 Amoeba/View/View.hs
@@ -13,4 +13,12 @@ getView = do
vInfo <- SDL.getVideoInfo
let w = SDL.videoInfoWidth vInfo
let h = SDL.videoInfoHeight vInfo
- return $ View surface (Screen w h)
+ return $ View surface (Screen w h)
+
+
+setupScreen :: (Screen, Int) -> String -> IO View
+setupScreen (scr@(Screen scrWidth scrHeight), scrBpp) caption = do
+ surface <- SDL.setVideoMode scrWidth scrHeight scrBpp [SDL.SWSurface]
+ SDL.setCaption caption []
+ SDL.flip surface
+ return $ View surface scr
View
BIN Game/Amoeba
Binary file not shown.
View
1 Game/Data/Options.cfg
@@ -5,3 +5,4 @@ logFile: ./Logs/log.txt
[VIDEO]
screenWidth: 640
screenHeight: 480
+colorDepth: 32
View
2 Game/Data/Options.cfg~
@@ -1,4 +1,4 @@
-[DEFAULT
+[DEFAULT]
applicationName: The Amoeba World
logFile: ./Logs/log.txt

0 comments on commit 63364a1

Please sign in to comment.
Something went wrong with that request. Please try again.