ein

package
v0.0.0-...-091cbb9 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2015 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadFont

func LoadFont(name string, size int) *ttf.Font

Types

type Drawable

type Drawable interface {
	//Tick(Event)         // Method for processing events, e.g. input
	Draw(*sdl.Renderer) // Method for drawing to the screen
}

Drawable represents something that can be drawn, and placed in a Level.

type DynamicPhysical

type DynamicPhysical interface {
	Position() (int32, int32) // Return position, x and y
	Size() (int32, int32)     // Return width and height
	Collide(Physical)         // Handle collisions with another Physical
}

DynamicPhysical represents something that can process its own collisions. Implementing this is an optional addition to Drawable.

type Engine

type Engine struct {
	Window   *sdl.Window
	Renderer *sdl.Renderer
	Running  bool

	Event *sdl.Keycode
	// contains filtered or unexported fields
}

func Init

func Init(width, height int32) *Engine

func (*Engine) AddEntities

func (g *Engine) AddEntities(d ...Drawable)

func (*Engine) Destroy

func (g *Engine) Destroy()

func (*Engine) Draw

func (g *Engine) Draw()

func (*Engine) NewTexture

func (g *Engine) NewTexture(filename string, x, y int32) *Texture

func (*Engine) Update

func (g *Engine) Update()

type Event

type Event struct {
	KeyCode *sdl.Keycode
}

Provides an event, for input

type Label

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

func NewLabel

func NewLabel(text string, x, y int32, font *ttf.Font) *Label

func (*Label) Draw

func (t *Label) Draw(renderer *sdl.Renderer)

func (*Label) Position

func (t *Label) Position() (int32, int32)

func (*Label) SetText

func (t *Label) SetText(text string)

func (*Label) Size

func (t *Label) Size() (int32, int32)

type Physical

type Physical interface {
	Position() (int32, int32) // Return position, x and y
	Size() (int32, int32)     // Return width and height
}

Physical represents something that can collide with another Physical, but cannot process its own collisions. Optional addition to Drawable.

type Rect

type Rect struct {
	*sdl.Rect
	// contains filtered or unexported fields
}

func NewRect

func NewRect(x, y, w, h int32) *Rect

func (*Rect) Draw

func (t *Rect) Draw(renderer *sdl.Renderer)

func (*Rect) Position

func (t *Rect) Position() (int32, int32)

func (*Rect) SetColor

func (t *Rect) SetColor(r, g, b, a uint8)

func (*Rect) Size

func (t *Rect) Size() (int32, int32)

type Texture

type Texture struct {
	Dest *sdl.Rect

	Angle float64
	// contains filtered or unexported fields
}

func (*Texture) Draw

func (t *Texture) Draw(renderer *sdl.Renderer)

func (*Texture) Position

func (t *Texture) Position() (int32, int32)

func (*Texture) Size

func (t *Texture) Size() (int32, int32)

Jump to

Keyboard shortcuts

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