primen

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2020 License: MIT Imports: 14 Imported by: 0

README

Primen

Primen is a 2D game engine written in Go following the Entity Component System paradigm. Primen is powered by the Ebiten game library.

WIP

I'm developing this project along with a game, so the features are being added according with my game's priorities.

Planned Integrations

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColorFromHex added in v0.3.0

func ColorFromHex(hexv string) color.RGBA

ColorFromHex parses a RRGGBBAA (or RRGGBB) hexadecimal color into color.RGBA

Returns color.Transparent on invalid hex inputs.

Types

type AnimatedSpriteNode added in v0.5.0

type AnimatedSpriteNode struct {
	*SpriteNode
	// contains filtered or unexported fields
}

func NewChildAnimatedSpriteNode added in v0.5.0

func NewChildAnimatedSpriteNode(parent ObjectContainer, layer Layer, fps float64, anim core.Animation) *AnimatedSpriteNode

func NewRootAnimatedSpriteNode added in v0.5.0

func NewRootAnimatedSpriteNode(w World, layer Layer, fps float64, anim core.Animation) *AnimatedSpriteNode

func (AnimatedSpriteNode) AddChild added in v0.5.0

func (o AnimatedSpriteNode) AddChild(child Object)

func (AnimatedSpriteNode) Children added in v0.5.0

func (o AnimatedSpriteNode) Children() []Object

func (AnimatedSpriteNode) RemoveChild added in v0.5.0

func (o AnimatedSpriteNode) RemoveChild(child Object)

func (*AnimatedSpriteNode) SpriteAnim added in v0.5.0

func (n *AnimatedSpriteNode) SpriteAnim() *core.SpriteAnimation

type Animation added in v0.3.0

type Animation = core.Animation

type Dict

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

Dict is a concurrency-safe map.

func (*Dict) Exists

func (d *Dict) Exists(key string) bool

Exists checks if the item exists

func (*Dict) Get

func (d *Dict) Get(key string) interface{}

Get an item

func (*Dict) Set

func (d *Dict) Set(key string, value interface{})

Set an item

type Engine

type Engine = core.Engine

func NewEngine

func NewEngine(v *NewEngineInput) Engine

NewEngine returns a new Engine

type EngineOptions

type EngineOptions struct {
	Width               int
	Height              int
	Scale               float64
	Title               string
	IsFullscreen        bool
	IsResizable         bool
	IsMaxResolution     bool
	IsTransparentScreen bool
	IsFloating          bool
	IsMaximized         bool
	IsFixedResolution   bool
}

EngineOptions is used to setup Ebiten @ Engine.boot

type FnNode added in v0.5.0

type FnNode struct {
	*Node
	// contains filtered or unexported fields
}

func NewRootFnNode added in v0.5.0

func NewRootFnNode(w World) *FnNode

func (FnNode) AddChild added in v0.5.0

func (o FnNode) AddChild(child Object)

func (FnNode) Children added in v0.5.0

func (o FnNode) Children() []Object

func (*FnNode) Function added in v0.5.0

func (n *FnNode) Function() *core.Function

Function retrieves the function component data

func (FnNode) RemoveChild added in v0.5.0

func (o FnNode) RemoveChild(child Object)

type LabelNode added in v0.5.0

type LabelNode struct {
	*Node
	// contains filtered or unexported fields
}

func NewChildLabelNode added in v0.5.0

func NewChildLabelNode(parent ObjectContainer, layer Layer) *LabelNode

func NewRootLabelNode added in v0.5.0

func NewRootLabelNode(w World, layer Layer) *LabelNode

func (LabelNode) AddChild added in v0.5.0

func (o LabelNode) AddChild(child Object)

func (LabelNode) Children added in v0.5.0

func (o LabelNode) Children() []Object

func (*LabelNode) Label added in v0.5.0

func (n *LabelNode) Label() *core.Label

func (*LabelNode) Layer added in v0.5.0

func (n *LabelNode) Layer() Layer

func (LabelNode) RemoveChild added in v0.5.0

func (o LabelNode) RemoveChild(child Object)

func (*LabelNode) SetLayer added in v0.5.0

func (n *LabelNode) SetLayer(l Layer)

func (*LabelNode) SetZIndex added in v0.5.0

func (n *LabelNode) SetZIndex(index int64)

func (*LabelNode) ZIndex added in v0.5.0

func (n *LabelNode) ZIndex() int64

type Layer added in v0.3.0

type Layer = core.LayerIndex

Layer index type

const (
	Layer0  Layer = 0
	Layer1  Layer = 1
	Layer2  Layer = 2
	Layer3  Layer = 3
	Layer4  Layer = 4
	Layer5  Layer = 5
	Layer6  Layer = 6
	Layer7  Layer = 7
	Layer8  Layer = 8
	Layer9  Layer = 9
	Layer10 Layer = 10
	Layer11 Layer = 11
	Layer12 Layer = 12
	Layer13 Layer = 13
	Layer14 Layer = 14
	Layer15 Layer = 15
)

LAYERS

type NewEngineInput

type NewEngineInput struct {
	Width             int            // main window width
	Height            int            // main window height
	Scale             float64        // pixel scale (default: 1)
	TransparentScreen bool           // transparent screen
	Maximized         bool           // start window maximized
	Floating          bool           // always on top of all windows
	Fullscreen        bool           // start in fullscreen
	Resizable         bool           // is window resizable?
	FixedResolution   bool           // fixed logical screen resolution
	FixedWidth        int            // fixed logical screen resolution
	FixedHeight       int            // fixed logical screen resolution
	MaxResolution     bool           // set width/height to max resolution
	Title             string         // window title
	FS                io.Filesystem  // TODO: drop this
	OnReady           func(e Engine) // function to run once the window is opened
}

NewEngineInput is the input data of NewEngine

func (*NewEngineInput) Options

func (i *NewEngineInput) Options() EngineOptions

Options will create a EngineOptions struct to be used in an *Engine

type Node added in v0.5.0

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

func NewChildNode added in v0.5.0

func NewChildNode(parent ObjectContainer) *Node

func NewRootNode added in v0.5.0

func NewRootNode(w World) *Node

func (Node) AddChild added in v0.5.0

func (o Node) AddChild(child Object)

func (Node) Children added in v0.5.0

func (o Node) Children() []Object

func (*Node) Destroy added in v0.5.0

func (t *Node) Destroy()

func (Node) RemoveChild added in v0.5.0

func (o Node) RemoveChild(child Object)

func (*Node) SetParent added in v0.5.0

func (t *Node) SetParent(parent ObjectContainer)

func (*Node) Transform added in v0.5.0

func (t *Node) Transform() *core.Transform

type Object added in v0.3.0

type Object interface {
	Entity() ecs.Entity
	World() World
	Destroy()
	SetParent(parent ObjectContainer)
}

Object is the base of any Primen base ECS object

type ObjectContainer added in v0.3.0

type ObjectContainer interface {
	Object
	Children() []Object
	AddChild(child Object)
	RemoveChild(child Object)
}

ObjectContainer is an object that contains other objects

type SpriteNode added in v0.5.0

type SpriteNode struct {
	*Node
	// contains filtered or unexported fields
}

func NewChildSpriteNode added in v0.5.0

func NewChildSpriteNode(parent ObjectContainer, layer Layer) *SpriteNode

func NewRootSpriteNode added in v0.5.0

func NewRootSpriteNode(w World, layer Layer) *SpriteNode

func (SpriteNode) AddChild added in v0.5.0

func (o SpriteNode) AddChild(child Object)

func (SpriteNode) Children added in v0.5.0

func (o SpriteNode) Children() []Object

func (*SpriteNode) Layer added in v0.5.0

func (n *SpriteNode) Layer() Layer

func (SpriteNode) RemoveChild added in v0.5.0

func (o SpriteNode) RemoveChild(child Object)

func (*SpriteNode) SetLayer added in v0.5.0

func (n *SpriteNode) SetLayer(l Layer)

func (*SpriteNode) SetZIndex added in v0.5.0

func (n *SpriteNode) SetZIndex(index int64)

func (*SpriteNode) Sprite added in v0.5.0

func (n *SpriteNode) Sprite() *core.Sprite

func (*SpriteNode) ZIndex added in v0.5.0

func (n *SpriteNode) ZIndex() int64

type StepInfo

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

func (*StepInfo) Get

func (i *StepInfo) Get() (lt time.Time, frame int64)

func (*StepInfo) GetFrame

func (i *StepInfo) GetFrame() (frame int64)

func (*StepInfo) Set

func (i *StepInfo) Set(lt time.Time, frame int64)

type TileSetNode added in v0.5.0

type TileSetNode struct {
	*Node
	// contains filtered or unexported fields
}

func NewChildTileSetNode added in v0.5.0

func NewChildTileSetNode(parent ObjectContainer, layer Layer, db []*ebiten.Image, rows, cols int, cellwidthpx, cellheightpx float64, cells []int) *TileSetNode

func NewRootTileSetNode added in v0.5.0

func NewRootTileSetNode(w World, layer Layer, db []*ebiten.Image, rows, cols int, cellwidthpx, cellheightpx float64, cells []int) *TileSetNode

func (TileSetNode) AddChild added in v0.5.0

func (o TileSetNode) AddChild(child Object)

func (TileSetNode) Children added in v0.5.0

func (o TileSetNode) Children() []Object

func (*TileSetNode) Layer added in v0.5.0

func (n *TileSetNode) Layer() Layer

func (TileSetNode) RemoveChild added in v0.5.0

func (o TileSetNode) RemoveChild(child Object)

func (*TileSetNode) SetLayer added in v0.5.0

func (n *TileSetNode) SetLayer(l Layer)

func (*TileSetNode) SetZIndex added in v0.5.0

func (n *TileSetNode) SetZIndex(index int64)

func (*TileSetNode) TileSet added in v0.5.0

func (n *TileSetNode) TileSet() *core.TileSet

func (*TileSetNode) ZIndex added in v0.5.0

func (n *TileSetNode) ZIndex() int64

type TransformGetter added in v0.3.0

type TransformGetter interface {
	Entity() ecs.Entity
	Transform() *core.Transform
}

type World added in v0.5.0

type World = core.World

Directories

Path Synopsis
cmd
Package core contains lower level component systems.
Package core contains lower level component systems.
examples
layers/res
Code generated by broccoli at 2020-06-24T17:37:10-03:00.
Code generated by broccoli at 2020-06-24T17:37:10-03:00.
internal
io
os
pb
Package rx holds default resources for Primen
Package rx holds default resources for Primen

Jump to

Keyboard shortcuts

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