Skip to content

Commit

Permalink
Restructuring some of the graphics code
Browse files Browse the repository at this point in the history
  • Loading branch information
smparsons committed Aug 26, 2018
1 parent cbcedc7 commit f065cbe
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,21 @@ main = do
let filepath = head args
if null args
then putStrLn "Please provide a filepath to the chip8 game."
else startChip8Game filepath
else startEmulator filepath

startChip8Game :: String -> IO ()
startChip8Game filepath = do
startEmulator :: String -> IO ()
startEmulator filepath = do
chip8 <- initializeChip8
chip8WithGame <- loadGameByFilePath filepath chip8
setupChip8GameWindow
renderer <- setupChip8Graphics
appLoop renderer

setupChip8GameWindow :: IO ()
setupChip8GameWindow = do
setupChip8Graphics :: IO Renderer
setupChip8Graphics = do
initializeAll
window <- createWindow "Chip-8 Emulator" defaultWindow { windowInitialSize = V2 512 256 }
renderer <- createRenderer window (-1) defaultRenderer
appLoop renderer
return renderer

appLoop :: Renderer -> IO ()
appLoop renderer = do
Expand Down

0 comments on commit f065cbe

Please sign in to comment.