Gin

About
Gin (Game engine In Nim) is a game engine written in Nim, but the more I look back at it, the more I realize it was just a graphics & sound library. Yes it managed the game loop but it didn't manage anything else, resulting in the user essentially writing a whole engine on top of gin.
Install
$ nimble install http://github.com/bob16795/gin
Usage
Gin introduces a template, called "Game" which can be used as a game loop.
Example
import gin
import gin/graphics

Game:
  var
    background: Color # the background color

  template Initialize() =
    # get the game ready to load
    setWindowName("Minimal gin game") # set the window title
    setAppName("Minimal") # set the save folder name
    setWindowSize(Point(X: 1024, Y: 600)) # set the window size
    setDt(16) # set the frame rate to 60 fps
    background = initColor(255, 255, 255) #ffffff

  template drawLoading(pc: float, status: string): untyped =
    # renders the loading screen
    clearBuffer(background) # clear the screen

  template Setup(): untyped =
    # load resources
    discard

  template Update(dt: cuint) =
    # main update function in loop
    discard

  template Draw(dt: cuint, ctx: GraphicsContext) =
    # render the next frame
    clearBuffer(background) # clear the screen

  template Close() =
    # ran when the game is closed
    discard

Links

Last Modified 2022 08/23