game

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DrawOptions

type DrawOptions struct {
	FlipX             bool
	Transparency      float32
	CenterRotationDeg float32
}

type Game

type Game interface {
	Frame([]InputEvent)
	SetScreenSize(width, height int)
}

func New

func New(resources Resources) Game

type Image

type Image interface {
	DrawAt(x, y int)
	DrawAtEx(x, y int, options DrawOptions)
	DrawRectAt(x, y int, source Rectangle)
	Size() (width, height int)
}

type Info

type Info struct {
	CavemanHitBox Rectangle
	RockHitBox    Rectangle
	LevelCount    int
}

type InputEvent

type InputEvent struct {
	Down bool
	Key  Key
}

type Key

type Key int
const (
	KeyLeft Key = 1 + iota
	KeyRight
	KeyUp
	KeyRestart
)

type Rectangle

type Rectangle struct {
	X, Y, W, H int
}

type Resources

type Resources interface {
	LoadImage(id string) Image
	LoadSound(id string) Sound
	LoadFile(id string) []byte
}

type Sound

type Sound interface {
	Play()
	PlayLooping()
}

Jump to

Keyboard shortcuts

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