game

package
v0.0.0-...-1659512 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommandUnknown command = iota
	CommandQuit
	CommandMoveN
	CommandMoveNE
	CommandMoveE
	CommandMoveSE
	CommandMoveS
	CommandMoveSW
	CommandMoveW
	CommandMoveNW
	CommandZoomOut
	CommandZoomIn
	CommandScrollLeft
	CommandScrollRight
	CommandScrollUp
	CommandScrollDown
	CommandNextTimeStep
	CommandInteract
	CommandSelect1
	CommandSelect2
	CommandSelect3
	CommandSelect4
	CommandSelect5
	CommandSelect6
	CommandSelect7
	CommandSelect8
	CommandSelect9
	CommandSelect0
	CommandAltSelect1
	CommandAltSelect2
	CommandAltSelect3
	CommandAltSelect4
	CommandAltSelect5
	CommandAltSelect6
	CommandAltSelect7
	CommandAltSelect8
	CommandAltSelect9
	CommandAltSelect0
	CommandDebugReload
)

List of commandTypes.

Variables

This section is empty.

Functions

This section is empty.

Types

type Game

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

Game is the main struct of the game

func (*Game) GameLoop

func (g *Game) GameLoop()

GameLoop is a blocking function actually running the game.

func (*Game) NotifyCommand

func (g *Game) NotifyCommand(command command)

NotifyCommand will be called from commandManager when a registered command is received.

func (*Game) NotifyMouseCommand

func (g *Game) NotifyMouseCommand(buttonLeft, buttonMiddle, buttonRight bool, x, y int32)

NotifyMouseCommand will be called from commandManager when a mouse event is received.

func (*Game) Occupied

func (g *Game) Occupied(p utils.Vec2) bool

Occupied returns true if the given tile is occupied by a blocking entity and if the tile is currently visible.

func (*Game) Setup

func (g *Game) Setup(windowWidth, windowHeight int, fullscreen bool)

Setup should be called first after creating an instance of Game.

func (*Game) Shutdown

func (g *Game) Shutdown()

Shutdown should be called when the program quits.

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

MainMenu represents the main menu of the game

func (g *MainMenu) MoveCursor(dx, dy int32)

MoveCursor moves the cursor of the currently selected item.

func (g *MainMenu) Render(console *console.MatrixConsole, gameInProgress bool)

Render the main menu on the provided console

func (g *MainMenu) Select() MainMenuActionType

Select selects the currently activated cursor element.

type MainMenuActionType int

MainMenuActionType holds the type of result.

const (
	MainMenuActionUnknown MainMenuActionType = iota
	MainMenuActionStartGame
	MainMenuActionLoadGame
	MainMenuActionOptions
	MainMenuActionQuit
)

List of MainMenuActionTypes.

Jump to

Keyboard shortcuts

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