Restructuring, #9

This commit is contained in:
Tibo De Peuter 2022-12-21 23:30:59 +01:00
parent 2055ef234e
commit dab6fadad4
41 changed files with 941 additions and 680 deletions

View file

@ -5,33 +5,18 @@ module RPGEngine
( playRPGEngine
) where
import RPGEngine.Data.Defaults
import RPGEngine.Render
import RPGEngine.Input
import RPGEngine.Config ( bgColor, winDimensions, winOffsets )
import RPGEngine.Render ( initWindow, render, initGame )
import RPGEngine.Input ( handleAllInput )
import Graphics.Gloss (
Color(..)
, white
, play
)
----------------------------- Constants ------------------------------
-- Dimensions for main window
winDimensions :: (Int, Int)
winDimensions = (1280, 720)
-- Offsets for main window
winOffsets :: (Int, Int)
winOffsets = (0, 0)
import Graphics.Gloss ( play )
----------------------------------------------------------------------
-- This is the gameloop.
-- This is the game loop.
-- It can receive input and update itself. It is rendered by a renderer.
playRPGEngine :: String -> Int -> IO()
playRPGEngine title fps = do
play window bgColor fps initGame render handleInputs step
playRPGEngine title fps = do
play window bgColor fps initGame render handleAllInput step
where window = initWindow title winDimensions winOffsets
step _ g = g -- TODO Do something with step? Check health etc.
handleInputs = handleAllInput
step _ g = g -- TODO Do something with step? Check health etc.