diff --git a/cmd/game/main.go b/cmd/game/main.go index 2470fb6..0f2d9da 100644 --- a/cmd/game/main.go +++ b/cmd/game/main.go @@ -89,6 +89,7 @@ func main() { } escDown := false + // game loop for core.Running() { if core.KeyStates()[sdl.SCANCODE_ESCAPE] != 0 { diff --git a/engine/level/level.go b/engine/level/level.go index dabf591..e3f0e07 100644 --- a/engine/level/level.go +++ b/engine/level/level.go @@ -38,12 +38,14 @@ var ( } ) +// Set sets the current level. func Set(level *Level) { currentLevel = level currentLevelWidth = int(level.Width) currentLevelHeight = int(level.Height) } +// Load reads a level from the given path. func Load(path string) (*Level, error) { b, err := os.ReadFile(path) if err != nil { diff --git a/engine/textures/register.go b/engine/textures/register.go index debba6b..b4117a8 100644 --- a/engine/textures/register.go +++ b/engine/textures/register.go @@ -33,6 +33,7 @@ var ( colorTextures = make([]*sdl.Texture, 0xffffff) ) +// Register adds a texture to the registry to be used later. func Register(texturepath string, key Key) *Texture { t := unregistered(texturepath)