munfall

package module
v0.0.0-...-7483609 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2017 License: MIT Imports: 7 Imported by: 0

README

graphics

A WIP Graphics library using OpenGL

Documentation

Overview

Package munfall debug.go Defines our logging.

Package munfall Defines methods used to run the engine.

Package munfall interfaces.go Defines interfaces used to prevent circle imports.

Package munfall Defines primitives that will be used all around the engine, they are here to prevent circle imports.

Index

Constants

This section is empty.

Variables

View Source
var Logger = logging.MustGetLogger("graphics")

Logger used to log information.

View Source
var Mainfunc = make(chan func())

Mainfunc channel used internally to run the main thread on.

Functions

func CheckGLError

func CheckGLError()

CheckGLError used to check and log any errors that happen in opengl calls.

func Do

func Do(f func())

Do runs a given function on the main thread when there is time.

func IsNil

func IsNil(a interface{}) bool

IsNil checks if the given interface is nil, also works on nil interface pointers.

func Loop

func Loop()

Loop used by opengl to do its calls, needs to be called by the main thread.

Types

type Actor

type Actor interface {
	ActorID() uint
	Kill()
	IsDead() bool
	IsInWorld() bool
	Pos() *WPos
	SetPos(pos *WPos)
	World() World
}

Actor defines the interface for the actor struct.

type Cell

type Cell interface {
	AdjacentCells() []Cell
	Space() []Space
}

Cell is the building block of the world map.

type MPos

type MPos struct {
	X, Y uint
}

MPos map position.

type Mesh

type Mesh struct {
	Points    []float32
	Triangles []uint32
}

Mesh type used to hold rendering data.

type Order

type Order struct {
	Order    string
	Value    interface{}
	IsGlobal bool
}

Order wraps an order that gets passed around by the order generator.

type Path

type Path interface {
	Cell() Cell
	MPos() *MPos
	WPos(percent float32) *WPos

	IsEnd() bool
	Next() Path

	First() Path
	Last() Path
}

Path is an iterator that defines a path through the world map.

type Renderable

type Renderable interface {
	Mesh() *Mesh
	Pos() *WPos
	Color() uint32
}

Renderable interface used to pass data to a renderer.

type Space

type Space interface {
	Trait() Trait
	Initialize(Trait)
	Offset() *WPos
	Intersects(Space, *WPos) bool
}

Space defines a space that can be used to

type Trait

type Trait interface {
	Initialize(World, Actor, map[string]interface{})
	Owner() Actor
}

Trait defines the interface used by every Trait that lives on an Actor.

type Vector2f

type Vector2f struct {
	X, Y float32
}

Vector2f holds 2 float values.

type WPos

type WPos struct {
	X, Y, Z float32
}

WPos world position.

func (*WPos) Add

func (w *WPos) Add(other *WPos) *WPos

Add returns a WPos that is the sum of the 2 given WPos.

func (*WPos) Clamp

func (w *WPos) Clamp(low, high *WPos) *WPos

Clamp clamps the WPos to the given vector values.

func (*WPos) Subtract

func (w *WPos) Subtract(other *WPos) *WPos

Subtract returns a WPos that is the difference of the 2 given WPos.

type World

type World interface {
	AddFrameEndTask(f func())
	Tick(deltaUnit float32)

	GetTrait(a Actor, i interface{}) Trait
	GetTraitsImplementing(a Actor, i interface{}) []Trait
	GetAllTraitsImplementing(i interface{}) []Trait

	AddToWorld(a Actor)
	RemoveFromWorld(a Actor)

	IssueGlobalOrder(order *Order)
	IssueOrder(a Actor, order *Order)

	WorldMap() WorldMap
}

World defines the interface for the world struct.

type WorldMap

type WorldMap interface {
	Initialize(World)

	Width() float32
	Height() float32

	InsideMapWPos(pos *WPos) bool
	InsideMapMPos(pos *MPos) bool

	CellAt(*MPos) Cell
	GetPath(a Actor, p1, p2 *WPos) Path

	ConvertToWPos(*MPos) *WPos
	ConvertToMPos(*WPos) *MPos

	Register(Actor)
	Move(Actor, Path, float32)
	Deregister(Actor)
}

WorldMap is the interface for the world map.

Directories

Path Synopsis
Package game game.go Defines the struct used to connect all the engine components together.
Package game game.go Defines the struct used to connect all the engine components together.
Package graphics Defines a Window type used to create and control a glfw window with an opengl context.
Package graphics Defines a Window type used to create and control a glfw window with an opengl context.
render
Package render camera.go Defines a camera type used to control the opengl viewport.
Package render camera.go Defines a camera type used to control the opengl viewport.
shader
Package shader shaderprogram.go Defines a shader type that will be used by opengl.
Package shader shaderprogram.go Defines a shader type that will be used by opengl.
Package gridworldmap worldmap.go Defines the map that actors live and move on.
Package gridworldmap worldmap.go Defines the map that actors live and move on.
Package input input.go Defines the callbacks needed for the whole input package to work.
Package input input.go Defines the callbacks needed for the whole input package to work.
Package logic actor.go Defines something Package logic actorregistry.go Defines a container for actor definitions so they can be easily added to the world.
Package logic actor.go Defines something Package logic actorregistry.go Defines a container for actor definitions so they can be easily added to the world.
Package traits base.go Defines interfaces that define traits.
Package traits base.go Defines interfaces that define traits.

Jump to

Keyboard shortcuts

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