gameModule

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

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

Go to latest
Published: Jun 19, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScreenWidth  = 1280
	ScreenHeight = 720
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Game

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

func (*Game) Draw

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

func (*Game) Layout

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

func (*Game) Update

func (g *Game) Update() error

type GameScene

type GameScene struct {
	Width  int
	Height int
	Player *Player
}

Game represents the main game state

func GameplayScene

func GameplayScene() *GameScene

func (*GameScene) Draw

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

Draw draws the game screen by one frame

func (*GameScene) Layout

func (g *GameScene) Layout(outsideWidth int, outsideHeight int) (screenWidth int, screenHeight int)

Layout is hardcoded for now, may be made dynamic in future

func (*GameScene) Update

func (g *GameScene) Update(state *GameState) error

Update calculates game logic

type GameState

type GameState struct {
	SceneManager *SceneManager
}

type Player

type Player struct {
	Coords image.Point
	Sprite *ebiten.Image
}

Player is the player character in the game

type Scene

type Scene interface {
	Update(state *GameState) error
	Draw(screen *ebiten.Image)
}

type SceneManager

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

func (*SceneManager) Draw

func (s *SceneManager) Draw(r *ebiten.Image)

func (*SceneManager) GoTo

func (s *SceneManager) GoTo(scene Scene)

func (*SceneManager) Update

func (s *SceneManager) Update() error

type TitleScene

type TitleScene struct{}

func (*TitleScene) Draw

func (s *TitleScene) Draw(r *ebiten.Image)

func (*TitleScene) Update

func (s *TitleScene) Update(state *GameState) error

Jump to

Keyboard shortcuts

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