37 lines
992 B
Haskell
37 lines
992 B
Haskell
-- Allows to play a game using RPGEngine.
|
|
-- Includes all logic and rendering.
|
|
|
|
module RPGEngine
|
|
( playRPGEngine
|
|
) where
|
|
|
|
import RPGEngine.Internals.Data.Game
|
|
import RPGEngine.Render
|
|
import RPGEngine.Input
|
|
|
|
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)
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
-- 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? Check health etc.
|
|
handleInputs = handleAllInput
|