goalengine

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2020 License: MIT Imports: 3 Imported by: 0

README

goalengine

Game framework written in Go.

Documentation

Index

Constants

View Source
const (
	// LogTypeDebug is debug log message type.
	LogTypeDebug = iota
	// LogTypeError is error log message type.
	LogTypeError = iota
)

Variables

This section is empty.

Functions

func Log

func Log(logType int, message string)

Log prints out text with some additions.

func RenderSystem

func RenderSystem(entities *[]*Entity, renderer *sdl.Renderer)

RenderSystem is an ECS system that renders SpriteComponents.

Types

type Entity

type Entity struct {
	SpriteComponent *SpriteComponent
}

Entity is simply a collection of ECS components.

func NewEntity

func NewEntity(x int32, y int32, spriteComponent *SpriteComponent) *Entity

NewEntity makes new instance of Entity

type EntityBuilder

type EntityBuilder struct {
	// contains filtered or unexported fields
}

EntityBuilder is a helper struct that builds entities

func NewEntityBuilder

func NewEntityBuilder() *EntityBuilder

NewEntityBuilder makes a new instance of EntityBuilder.

func (EntityBuilder) AddSprite

func (entityBuilder EntityBuilder) AddSprite(renderer *sdl.Renderer, file string) EntityBuilder

AddSprite adds sprite to building entity.

func (EntityBuilder) Build

func (entityBuilder EntityBuilder) Build() *Entity

Build is a final method to call and it returns built entity.

func (EntityBuilder) SetLocation

func (entityBuilder EntityBuilder) SetLocation(x int32, y int32) EntityBuilder

SetLocation sets location of the sprite using x and y coordinates.

type EntityManager

type EntityManager struct {
	// contains filtered or unexported fields
}

EntityManager is a helper struct that manages all entities.

func NewEntityManager

func NewEntityManager() *EntityManager

NewEntityManager makes a new instance of EntityManager.

func (*EntityManager) AddEntity

func (entityManager *EntityManager) AddEntity(entity *Entity)

AddEntity adds entity into the list.

func (*EntityManager) GetEntities

func (entityManager *EntityManager) GetEntities() *[]*Entity

GetEntities retrieves entities from EntityManager.

type SpriteComponent

type SpriteComponent struct {
	Texture *sdl.Texture
	Rect    *sdl.Rect
}

SpriteComponent is an ECS component that stores texture.

func NewSpriteComponent

func NewSpriteComponent(renderer *sdl.Renderer, file string) (*SpriteComponent, error)

NewSpriteComponent makes a new instance of SpriteComponent by reading the BMP file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL