This repository has been archived on 2023-06-24. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
2022FuncProg-project3-RPGEn.../lib/RPGEngine.hs
2022-12-13 23:21:51 +01:00

39 lines
1,009 B
Haskell

-- Allows to play a game using RPGEngine.
-- Includes all logic and rendering.
module RPGEngine
( playRPGEngine
) where
import Game
import RenderGame
import Graphics.Gloss (
Color(..)
, black
, play
)
----------------------------- Constants ------------------------------
-- Dimensions for main window
winDimensions :: (Int, Int)
winDimensions = (1280, 720)
-- Offsets for main window
winOffsets :: (Int, Int)
winOffsets = (0, 0)
-- Game background color
bgColor :: Color
bgColor = black
----------------------------------------------------------------------
-- This is the gameloop.
-- 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
where window = initWindow title winDimensions winOffsets
step _ g = g -- TODO Do something with step?
handleInputs _ g = g -- TODO Implement inputHanlders