game

package
v0.0.0-...-71cf451 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WindowWidth  = 1920
	WindowHeight = 1080
	TPS          = 60
)

Variables

This section is empty.

Functions

func DefaultHitboxOverlaps

func DefaultHitboxOverlaps(mine HasHitbox, other []image.Rectangle) bool

Types

type Body

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

func NewBody

func NewBody(game *Game, id int) *Body

func (Body) DrawAt

func (b Body) DrawAt(screen *ebiten.Image, point image.Point)

func (*Body) GetHitbox

func (b *Body) GetHitbox() []image.Rectangle

func (*Body) Origin

func (b *Body) Origin() image.Point

func (*Body) Overlaps

func (b *Body) Overlaps(o []image.Rectangle) bool

func (*Body) Size

func (b *Body) Size() image.Point

type Drawable

type Drawable interface {
	HasHitbox

	DrawAt(*ebiten.Image, image.Point)
}

type Game

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

func NewGame

func NewGame() *Game

func (Game) Draw

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

func (Game) Layout

func (g Game) Layout(actualWidth, actualHeight int) (screenWidth, screenHeight int)

func (*Game) Run

func (g *Game) Run() error

func (*Game) Update

func (g *Game) Update() (err error)

type HasHitbox

type HasHitbox interface {
	// Most objects run a direct call to DefaultHitboxOverlaps.
	// This is basically here incase of non-rectangle hitboxes
	// like circles
	Overlaps([]image.Rectangle) bool
	Origin() image.Point
	Size() image.Point
	GetHitbox() []image.Rectangle
}

type Viewport

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

func NewViewport

func NewViewport() Viewport

func (Viewport) DrawToScreen

func (v Viewport) DrawToScreen(screen *ebiten.Image, drawable Drawable)

func (Viewport) GetHitbox

func (v Viewport) GetHitbox() []image.Rectangle

func (Viewport) Origin

func (v Viewport) Origin() image.Point

func (Viewport) Overlaps

func (v Viewport) Overlaps(other []image.Rectangle) bool

func (Viewport) Size

func (v Viewport) Size() image.Point

Jump to

Keyboard shortcuts

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