mirror of
https://github.com/dpiponi/Stellarator.git
synced 2024-05-16 19:10:42 -04:00
Refactored init
This commit is contained in:
parent
ac1764c923
commit
a57a64ba06
|
@ -1,6 +1,5 @@
|
|||
Options {
|
||||
screenScaleX = 5,
|
||||
screenScaleY = 3,
|
||||
screenScale = (5, 3),
|
||||
topOverscan = 10,
|
||||
bottomOverscan = 10,
|
||||
motionBlurAlpha = 1.0,
|
||||
|
|
13
app/Main.hs
13
app/Main.hs
|
@ -120,6 +120,7 @@ delayList = [
|
|||
#endif
|
||||
]
|
||||
|
||||
loopEmulation :: AtariKeys -> IORef (BankersDequeue UIKey) -> MonadAtari b
|
||||
loopEmulation atariKeys queueRef = do
|
||||
liftIO pollEvents
|
||||
queue <- liftIO $ readIORef queueRef
|
||||
|
@ -150,10 +151,9 @@ startingState args' options' window = do
|
|||
|
||||
let initBankState = initialBankState bankStyle'
|
||||
print $ "Initial bank state = " ++ show initBankState
|
||||
let screenScaleX' = screenScaleX options'
|
||||
let screenScaleY' = screenScaleY options'
|
||||
initState screenScaleX' screenScaleY'
|
||||
(screenWidth*screenScaleX') (screenHeight*screenScaleY')
|
||||
let screenScale' = screenScale options'
|
||||
initState screenScale'
|
||||
(screenWidth*fst screenScale') (screenHeight*snd screenScale')
|
||||
ramArray
|
||||
#if TRACE
|
||||
recordArray
|
||||
|
@ -173,15 +173,14 @@ main = do
|
|||
optionsString <- readFile optionsFile
|
||||
let options' = read optionsString :: Options
|
||||
print options'
|
||||
let screenScaleX' = screenScaleX options'
|
||||
let screenScaleY' = screenScaleY options'
|
||||
let screenScale' = screenScale options'
|
||||
-- XXX Make list of default keys
|
||||
let Just atariKeys = keysFromOptions options'
|
||||
|
||||
rc <- init -- init video
|
||||
when (not rc) $ die "Couldn't init graphics"
|
||||
queueRef <- newIORef empty
|
||||
window <- makeMainWindow screenScaleX' screenScaleY' queueRef
|
||||
window <- makeMainWindow screenScale' queueRef
|
||||
|
||||
state <- startingState args' options' window
|
||||
|
||||
|
|
|
@ -202,8 +202,8 @@ vertices = V.fromList [ -1.0, -1.0
|
|||
, -1.0, 1.0
|
||||
]
|
||||
|
||||
makeMainWindow :: Int -> Int -> IORef (BankersDequeue UIKey) -> IO Window
|
||||
makeMainWindow screenScaleX' screenScaleY' queue = do
|
||||
makeMainWindow :: (Int, Int) -> IORef (BankersDequeue UIKey) -> IO Window
|
||||
makeMainWindow (screenScaleX', screenScaleY') queue = do
|
||||
|
||||
windowHint (WindowHint'OpenGLProfile OpenGLProfile'Any)
|
||||
windowHint (WindowHint'DoubleBuffer True)
|
||||
|
|
|
@ -651,7 +651,7 @@ makeDelayArray delayList = do
|
|||
forM_ delayList $ \(addr, d) -> writeArray delayArray addr d
|
||||
return delayArray
|
||||
|
||||
initState :: Int -> Int -> Int -> Int ->
|
||||
initState :: (Int, Int) -> Int -> Int ->
|
||||
IOUArray Int Word8 ->
|
||||
#if TRACE
|
||||
StorableArray Int Word8 ->
|
||||
|
@ -669,7 +669,7 @@ initState :: Int -> Int -> Int -> Int ->
|
|||
[(Word16, Int)] ->
|
||||
Controllers ->
|
||||
IO Atari2600
|
||||
initState xscale' yscale' width height ram'
|
||||
initState (xscale', yscale') width height ram'
|
||||
#if TRACE
|
||||
record'
|
||||
#endif
|
||||
|
|
|
@ -182,8 +182,7 @@ scancodeFromString :: String -> Maybe Key
|
|||
scancodeFromString name = lookup name keyNames
|
||||
|
||||
data Options = Options {
|
||||
screenScaleX :: Int,
|
||||
screenScaleY :: Int,
|
||||
screenScale :: (Int, Int),
|
||||
topOverscan :: Int,
|
||||
bottomOverscan :: Int,
|
||||
motionBlurAlpha :: Float,
|
||||
|
@ -240,8 +239,7 @@ data Options = Options {
|
|||
|
||||
defaultOptions :: Options
|
||||
defaultOptions = Options {
|
||||
screenScaleX = 5,
|
||||
screenScaleY = 3,
|
||||
screenScale = (5, 3),
|
||||
topOverscan = 10,
|
||||
bottomOverscan = 10,
|
||||
motionBlurAlpha = 1.0,
|
||||
|
|
Loading…
Reference in a new issue