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