lbricks

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

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

Go to latest
Published: Nov 12, 2015 License: MIT Imports: 3 Imported by: 2

README

lbricks

Engine 2D para juegos realizado en Go, con el paradigma Flow Based Programing

Documentation

Index

Constants

View Source
const (
	Up      = Direction(0)
	Down    = Direction(1)
	Left    = Direction(2)
	Right   = Direction(3)
	Inward  = Direction(4)
	Outward = Direction(5)
)
View Source
const (
	PRESS   = KeyAction(0)
	RELEASE = KeyAction(1)
	SHIFT   = Modifier(0x0001)
	CONTROL = Modifier(0x0002)
	ALT     = Modifier(0x0004)
	SUPER   = Modifier(0x0008)
)
View Source
const (
	MOVEMENT           = MouseAction(0)
	WHEEL_DOWN         = MouseAction(1)
	WHEEL_UP           = MouseAction(2)
	RIGHT_BUTTON_DOWN  = MouseAction(3)
	RIGHT_BUTTON_UP    = MouseAction(4)
	LEFT_BUTTON_DOWN   = MouseAction(5)
	LEFT_BUTTON_UP     = MouseAction(6)
	MIDDLE_BUTTON_DOWN = MouseAction(7)
	MIDDLE_BUTTON_UP   = MouseAction(8)
)

Variables

View Source
var (
	Rect   = Shape{0.0, 0.0}
	Oval   = Shape{0, 0}
	Square = Shape{0}
	Circle = Shape{0}
)
View Source
var (
	Dash         = Key(189)
	Apostrophe   = Key(222)
	Semicolon    = Key(186)
	Equals       = Key(187)
	Comma        = Key(188)
	Period       = Key(190)
	Slash        = Key(191)
	Backslash    = Key(220)
	Backspace    = Key(8)
	Tab          = Key(9)
	CapsLock     = Key(20)
	Space        = Key(32)
	Enter        = Key(13)
	Escape       = Key(27)
	Insert       = Key(45)
	PrintScreen  = Key(42)
	Delete       = Key(46)
	PageUp       = Key(33)
	PageDown     = Key(34)
	Home         = Key(36)
	End          = Key(35)
	Pause        = Key(19)
	ScrollLock   = Key(145)
	ArrowLeft    = Key(37)
	ArrowRight   = Key(39)
	ArrowDown    = Key(40)
	ArrowUp      = Key(38)
	LeftBracket  = Key(219)
	LeftShift    = Key(16)
	LeftControl  = Key(17)
	LeftSuper    = Key(73)
	LeftAlt      = Key(18)
	RightBracket = Key(221)
	RightShift   = Key(16)
	RightControl = Key(17)
	RightSuper   = Key(73)
	RightAlt     = Key(18)
	Zero         = Key(48)
	One          = Key(49)
	Two          = Key(50)
	Three        = Key(51)
	Four         = Key(52)
	Five         = Key(53)
	Six          = Key(54)
	Seven        = Key(55)
	Eight        = Key(56)
	Nine         = Key(57)
	F1           = Key(112)
	F2           = Key(113)
	F3           = Key(114)
	F4           = Key(115)
	F5           = Key(116)
	F6           = Key(117)
	F7           = Key(118)
	F8           = Key(119)
	F9           = Key(120)
	F10          = Key(121)
	F11          = Key(122)
	F12          = Key(123)
	A            = Key(65)
	B            = Key(66)
	C            = Key(67)
	D            = Key(68)
	E            = Key(69)
	F            = Key(70)
	G            = Key(71)
	H            = Key(72)
	I            = Key(73)
	J            = Key(74)
	K            = Key(75)
	L            = Key(76)
	M            = Key(77)
	N            = Key(78)
	O            = Key(79)
	P            = Key(80)
	Q            = Key(81)
	R            = Key(82)
	S            = Key(83)
	T            = Key(84)
	U            = Key(85)
	V            = Key(86)
	W            = Key(87)
	X            = Key(88)
	Y            = Key(89)
	Z            = Key(90)
	NumLock      = Key(144)
	NumMultiply  = Key(106)
	NumDivide    = Key(111)
	NumAdd       = Key(107)
	NumSubtract  = Key(109)
	NumZero      = Key(96)
	NumOne       = Key(97)
	NumTwo       = Key(98)
	NumThree     = Key(99)
	NumFour      = Key(100)
	NumFive      = Key(101)
	NumSix       = Key(102)
	NumSeven     = Key(103)
	NumEight     = Key(104)
	NumNine      = Key(105)
	NumDecimal   = Key(110)
	NumEnter     = Key(13)
)

Functions

This section is empty.

Types

type Batch

type Batch interface {
	Begin()
	Draw(r Drawable, x, y, originX, originY, scaleX, scaleY, rotation float32, color uint32, transparency float32)
	End()
	SetProjection(width, height float32)
}

type CloseEvent

type CloseEvent struct{}

type Color

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

Color Component

func (*Color) Alpha

func (c *Color) Alpha() float32

func (*Color) RGB

func (c *Color) RGB() uint32

type Colorize

type Colorize interface {
	RGB() uint32
	Alpha() float32
}

type Direction

type Direction uint

type Displayable

type Displayable interface {
	Visible() bool
}

type Disposable

type Disposable interface {
	Dispose()
}

type Drawable

type Drawable interface {
	Texture() uint
	Width() float32
	Height() float32
	View() (float32, float32, float32, float32)
}

type Element

type Element interface {
	Colorize
	Drawable
	Shape() Shape
	Anchor() [2]float32
}

type Entity

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

Entity

func NewEntity

func NewEntity() *Entity

func (*Entity) Id

func (e *Entity) Id() EntityID

type EntityID

type EntityID uint

type EntityPool

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

EntityPool

func CreateEntityPool

func CreateEntityPool() *EntityPool

func (*EntityPool) AddProvider

func (ep *EntityPool) AddProvider(name string, provider EntityProvider)

func (*EntityPool) CreateEntity

func (ep *EntityPool) CreateEntity(name string) *Entity

func (*EntityPool) Entities

func (ep *EntityPool) Entities() map[EntityID]*Entity

func (*EntityPool) Entity

func (ep *EntityPool) Entity(id EntityID) (*Entity, bool)

type EntityProvider

type EntityProvider func() *Entity

type Event

type Event chan interface{}

type EventSystem

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

func CreateEventSystem

func CreateEventSystem(capacity int) *EventSystem

func (*EventSystem) EventPorts

func (es *EventSystem) EventPorts(eventType string) []func(interface{})

func (*EventSystem) FromEvent

func (es *EventSystem) FromEvent(eventType string) Signal

type GameContext

type GameContext struct {
	Pool           EntityPool
	EventSystem    EventSystem
	StageProviders map[string]StageProvider
	RenderSystem   RenderSystem
}

type Identificable

type Identificable interface {
	Id() uint
}

type Identity

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

Identity Component

func (*Identity) Id

func (i *Identity) Id() uint

func (*Identity) Name

func (i *Identity) Name() string

func (*Identity) Tags

func (i *Identity) Tags() []string

type Key

type Key int

type KeyAction

type KeyAction int

type KeyEvent

type KeyEvent struct {
	Key      Key
	Modifier Modifier
	Action   KeyAction
}

KeyboardEvent

type Layout

type Layout interface {
	Direction() Direction
}

type Mapper

type Mapper func(interface{}) interface{}

type Modifier

type Modifier int

type MouseAction

type MouseAction int

type MouseEvent

type MouseEvent struct {
	PosX, PosY float32
	Action     MouseAction
}

MouseEvent

type MultiMapper

type MultiMapper func(...interface{}) interface{}

type Nombrable

type Nombrable interface {
	Name() string
}

type Poolable

type Poolable interface {
	Reset()
}

type Positionable

type Positionable interface {
	Position() *vec2.T
}

type Predicate

type Predicate func(interface{}) bool

type PreloadEvent

type PreloadEvent struct{}

type Recognizable

type Recognizable interface {
	Identificable
	Nombrable
	Tagger
}

type Reducer

type Reducer func(memo interface{}, element interface{}) interface{}

type RenderEvent

type RenderEvent struct{}

type RenderSystem

type RenderSystem struct {
	*System
	// contains filtered or unexported fields
}

func NewRenderSystem

func NewRenderSystem(maxlen int, width, height float32, batch Batch, es EventSystem) *RenderSystem

func (*RenderSystem) AddView

func (rs *RenderSystem) AddView(view Renderable)

func (*RenderSystem) Render

func (rs *RenderSystem) Render()

type Renderable

type Renderable interface {
	Render(Batch)
}

type ResizeEvent

type ResizeEvent struct {
	Width, Height int
}

type Rotable

type Rotable interface {
	Rotation() float32
}

type Scalable

type Scalable interface {
	Scale() *vec2.T
}

type ScrollEvent

type ScrollEvent struct {
	AmountScroll float32
	Action       MouseAction
}

type SetupEvent

type SetupEvent struct{}

type Shape

type Shape []float32

type Signal

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

func FromValues

func FromValues(els ...interface{}) Signal

func (Signal) Filter

func (s Signal) Filter(pred Predicate) Signal

func (Signal) Map

func (s Signal) Map(fn Mapper) Signal

func (Signal) Reduce

func (s Signal) Reduce(red Reducer, memo interface{}) interface{}

func (Signal) Subscribe

func (s Signal) Subscribe(fn Subscriber)

type Sprite

type Sprite struct {
	Identity
	Transform
	Color
	Shape

	Anchor [2]float32
	// contains filtered or unexported fields
}

func (*Sprite) Height

func (s *Sprite) Height() float32

func (*Sprite) Render

func (v *Sprite) Render(batch Batch)

func (*Sprite) Width

func (s *Sprite) Width() float32

type Stage

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

type StageId

type StageId uint

type StageProvider

type StageProvider func(game GameContext) *Stage

type StepEvent

type StepEvent struct {
	Step    float64
	NumStep uint32
}

StepEvent

type Subscriber

type Subscriber func(interface{})

type System

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

func (System) Name

func (s System) Name() string

func (System) Priority

func (s System) Priority() int

type Systemer

type Systemer interface {
	Name() string
	Priority() int
	Dispose()
}

type Tagger

type Tagger interface {
	Tags() []string
}

type Transform

type Transform struct {
	Action <-chan string // input port
	// contains filtered or unexported fields
}

Transform Component

func (*Transform) OnAction

func (t *Transform) OnAction(action string)

func (*Transform) Position

func (t *Transform) Position() *vec2.T

func (*Transform) Rotation

func (t *Transform) Rotation() float32

func (*Transform) Scale

func (t *Transform) Scale() *vec2.T

type Transformer

type Transformer interface {
	Positionable
	Scalable
	Rotable
}

type Typable

type Typable interface {
	Type()
}

type TypeKeyEvent

type TypeKeyEvent struct {
	Char rune
}

type UpdateEvent

type UpdateEvent struct {
	DeltaTime float32
}

type View

type View interface {
	Transformer
	Element
	Layer() uint
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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