gamebase

package
v0.0.0-...-e7326f8 Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoMainScene = errors.New("main scene isn't set up")

This error will be returned when main scene is not set up.

Functions

func DefaultLayoutF

func DefaultLayoutF(gb *GameBase, outsideWidth, outsideHeight int) (width, height int)

Default implementation of the layout() function (required by ebitengine)

Types

type GameBase

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

Base for all the games. This defines main scene, current scene and layout() function that required by ebitengine.

func New

func New(runSide interfaces.RunSide) *GameBase

Returns new instance of the GameBase. By default, current scene is nil. Make sure to set the main scene by using SetScene(...)!

func (*GameBase) Draw

func (gb *GameBase) Draw(screen *ebiten.Image)

func (*GameBase) GetCurrentScene

func (gb *GameBase) GetCurrentScene() interfaces.IScene

Returns current showing scene.

func (*GameBase) GetDebugMode

func (gb *GameBase) GetDebugMode() bool

Returns true if debugging is enabled.

func (*GameBase) GetRunSide

func (gb *GameBase) GetRunSide() interfaces.RunSide

Returns defined running side. Client \ Server \ Singleplayer.

func (*GameBase) Layout

func (gb *GameBase) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int)

func (*GameBase) Run

func (gb *GameBase) Run(windowSizeX int, windowSizeY int, title string) error

func (*GameBase) RunAsMobile

func (gb *GameBase) RunAsMobile()

func (*GameBase) SetDebugMode

func (gb *GameBase) SetDebugMode(debugMode bool)

Changes the debug mode.

func (*GameBase) SetScene

func (gb *GameBase) SetScene(scene interfaces.IScene) error

Changes a current scene of the game.

func (*GameBase) Update

func (gb *GameBase) Update() error

type LayoutF

type LayoutF func(gb *GameBase, outsideWidth, outsideHeight int) (width, height int)

Function that defines layout() function (required by ebtiengine)

Jump to

Keyboard shortcuts

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