Skip to content

Commit

Permalink
Renaming for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
smparsons committed Aug 26, 2018
1 parent f065cbe commit fc7743b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,24 @@ startEmulator :: String -> IO ()
startEmulator filepath = do
chip8 <- initializeChip8
chip8WithGame <- loadGameByFilePath filepath chip8
renderer <- setupChip8Graphics
appLoop renderer
renderer <- setupEmulatorGraphics
emulatorLoop renderer

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

appLoop :: Renderer -> IO ()
appLoop renderer = do
emulatorLoop :: Renderer -> IO ()
emulatorLoop renderer = do
events <- pollEvents
let userHasQuit = any isQuitEvent events
rendererDrawColor renderer $= V4 0 0 0 0
clear renderer
present renderer
unless userHasQuit (appLoop renderer)
unless userHasQuit (emulatorLoop renderer)

isQuitEvent :: Event -> Bool
isQuitEvent event = eventPayload event == QuitEvent

0 comments on commit fc7743b

Please sign in to comment.