/grout

2D Game Engine using Go and SFML

Primary LanguageGoGNU General Public License v2.0GPL-2.0

Grout

2D Game Engine using Go and SFML


Requires

Tiled and the darkFunction Editor aren't necessarily required, they just happened to be what I used when created the assets and thus used their formats for reading stuff in. Anything using the same formats will work.


It is a task-based game engine that I'm now adding entity/component architecture for handling game objects.


A basic main using the engine would be:

func main() {
  tm := grout.GetTaskManager()
  initalState := InitialGameStateObject{}
  grout.InitialGameState(&initialState)
  tm.Execute()
}

Where the InitialGameStateObject has the following functions defined on it

  • OnPause() when the state is pushed down on the stack
  • OnResume(w *sf.RenderWindow) when the state is put back on top of the stack, given the render window for any setup
  • Init(w *sf.RenderWindow) when the engine first puts the state on the stack, this is called
  • Update() (grout.GameState, bool) called once per frame for updating state, return a new gamestate to push onto the stack or nil, return bool to say whether this current state should be popped off
  • Draw(w *sf.RenderWindow) called once per frame to draw whatever is needed by the state