在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:I3ck/HGE2D开源软件地址:https://github.com/I3ck/HGE2D开源编程语言:Haskell 100.0%开源软件介绍:HGE2DA 2D game engine written in and for Haskell Version 0.1.10.2Installget it via UsageYou have the state of your game. It should keep all the data you need to store
for interactions with your game and rendering it. data GameState = GameState
{ gsSize :: (Double, Double) -- size of the window
, time :: Millisecond -- current time of your game's state
, player :: Player -- your definition for a player
, world :: World -- your definition for the world
} Note that none of these parameters are actually required. Just use what you'll need later on. A game which isn't dynamic won't have to store a time etc. es = EngineState
{ getTitle = myGetTitle
, getW = myGetW
, getH = myGetH
, getTime = myGetTime
, setTime = mySetTime
, moveTime = myMoveTime
, click = myClick
, hover = myHover
, drag = myDrag
, resize = myResize
, getSize = myGetSize
, toGlInstr = myToGlInstr
} :: EngineState GameState
data EngineState a = EngineState
{ click :: PosX -> PosY -> a -> a -- how your game should change when clicked
, hover :: PosX -> PosY -> a -> a -- how your game should change when hovered
, drag :: PosX -> PosY -> a -> a -- how your game should change when dragged
, resize :: (Width, Height) -> a -> a -- how to resize your game
, getSize :: a -> (Width, Height) -- how to get the size of your game
, moveTime :: Millisecond -> a -> a -- how your game should change over time
, getTime :: a -> Millisecond -- how to get the current time of your game
, setTime :: Millisecond -> a -> a -- how to set the time of your game
, getTitle :: a -> String -- how to get the title of your game
, toGlInstr :: a -> RenderInstruction -- how to receive a render instruction to display your game
} toGlInstrTo actually render your game, data RenderInstruction = RenderNothing
| RenderWithCamera GlPosX GlPosY GlScaleX GlScaleY RenderInstruction
| RenderText String
| RenderLineStrip GlShape GL.GLfloat
| RenderTriangle GlShape
| RenderLineLoop GlShape GL.GLfloat
| RenderScale GlScaleX GlScaleY
| RenderTranslate GlPosX GlPosY
| RenderRotate Double
| RenderColorize GlColorRGB
| RenderColorizeAlpha GlColorRGBA
| RenderPreserve RenderInstruction
| RenderMany [RenderInstruction]
ExamplesSimple "Hello world", showing draw methods and how to setup the state Example showing how to add dynamic motions dependend on the time Example showing how to nest several RenderInstructions to create a single instruction by combination ContributeFeel free to open an issue whenever you find a bug or are missing a feature. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论