game

package
v0.0.0-...-1ebc2e8 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2023 License: LGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DEFAULT_COLOR = lib.Color{255, 255, 255, 255} // white
	MUTED_COLOR   = lib.Color{128, 128, 128, 128} // gray
)

Functions

func FPSCounter

func FPSCounter(fps *ecs.Entity, width int)

func NewAmbientLight

func NewAmbientLight(e *ecs.Entity)

func NewBarricade

func NewBarricade(e *ecs.Entity, x, y float64)

func NewBigTank

func NewBigTank(tank *ecs.Entity, x float64, y float64)

func NewBullet

func NewBullet(e *ecs.Entity, x, y float64)

func NewCircleLight

func NewCircleLight(e *ecs.Entity, x, y float64)

func NewCircleLightWithColor

func NewCircleLightWithColor(e *ecs.Entity, x, y float64, clr lib.Color)

func NewCrate

func NewCrate(e *ecs.Entity, x, y float64)

func NewCrateMetal

func NewCrateMetal(e *ecs.Entity, x, y float64)

func NewDrum

func NewDrum(e *ecs.Entity, x, y float64)

func NewExplosion

func NewExplosion(e *ecs.Entity, s resource.SpriteSheet, l resource.SpriteSheet, x, y int) *ecs.Entity

func NewLightSpritesheet

func NewLightSpritesheet() resource.SpriteSheet

func NewMap

func NewMap(e *ecs.Entity, tilemap Tilemap, w int, h int)

func NewOilSpill

func NewOilSpill(e *ecs.Entity, x, y float64)

func NewPointLight

func NewPointLight(e *ecs.Entity, x, y float64)

func NewTank

func NewTank(tank *ecs.Entity)

func NewTankWithPosition

func NewTankWithPosition(tank *ecs.Entity, x, y float64)

func NewTree

func NewTree(e *ecs.Entity, x, y float64)

Types

type Game

type Game struct {
	Resources  resources.ResourceManager
	SoundMixer sound.Mixer

	ScreenWidth  int
	ScreenHeight int
	// contains filtered or unexported fields
}

Game is the shell of a game and is a meant to be used as a container for scenes

func NewGame

func NewGame() *Game

func (*Game) AddScene

func (g *Game) AddScene(sceneKey string, scene Scene)

scene stuff

func (*Game) Draw

func (g *Game) Draw(screen *ebiten.Image)

ebiten stuff

func (*Game) Exit

func (g *Game) Exit()

func (*Game) Layout

func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int)

func (*Game) SetScene

func (g *Game) SetScene(handle string)

func (*Game) Update

func (g *Game) Update() error

func (*Game) WindowSize

func (g *Game) WindowSize() (int, int)

type GameScene

type GameScene struct {
	Systems       []ecs.System
	EntityManager ecs.EntityManager
}

func (*GameScene) Draw

func (s *GameScene) Draw(screen *ebiten.Image)

func (*GameScene) HandleInput

func (s *GameScene) HandleInput()

func (*GameScene) Init

func (s *GameScene) Init() error

func (*GameScene) Update

func (s *GameScene) Update() error

type GameSceneWithCamera

type GameSceneWithCamera struct {
	Systems       []ecs.System
	EntityManager ecs.EntityManager
	Camera        camera.Camera
	// contains filtered or unexported fields
}

func (*GameSceneWithCamera) Draw

func (s *GameSceneWithCamera) Draw(screen *ebiten.Image)

func (*GameSceneWithCamera) HandleInput

func (s *GameSceneWithCamera) HandleInput()

func (*GameSceneWithCamera) Init

func (s *GameSceneWithCamera) Init() error

func (*GameSceneWithCamera) Update

func (s *GameSceneWithCamera) Update() error

type Scene

type Scene interface {
	Init() error
	Draw(image *ebiten.Image)
	HandleInput()
	Update() error
}

type State

type State struct {
	Name       string
	ModifiedAt time.Time
	Entities   []ecs.Entity
}

func NewState

func NewState(data []byte) (State, error)

func (*State) Save

func (s *State) Save(name string) ([]byte, error)

type Tilemap

type Tilemap [][]string

Directories

Path Synopsis
ecs

Jump to

Keyboard shortcuts

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