d2gamescreen

package
v0.0.0-...-7f92c57 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2021 License: GPL-3.0 Imports: 36 Imported by: 0

Documentation

Overview

Package d2gamescreen is where the game screens are defined

Package d2gamescreen contains the screens

Index

Constants

View Source
const (
	ScreenModeUnknown mainMenuScreenMode = iota
	ScreenModeTrademark
	ScreenModeMainMenu
	ScreenModeMultiplayer
	ScreenModeTCPIP
	ScreenModeServerIP
)

mainMenuScreenMode types

Variables

This section is empty.

Functions

This section is empty.

Types

type BlizzardIntro

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

BlizzardIntro represents the Blizzard Intro screen

func CreateBlizzardIntro

func CreateBlizzardIntro(asset *d2asset.AssetManager) *BlizzardIntro

CreateBlizzardIntro creates a Blizzard Intro screen

func (*BlizzardIntro) OnLoad

func (v *BlizzardIntro) OnLoad(loading d2screen.LoadingState)

OnLoad loads the resources for the Blizzard Intro screen

type BuildInfo

type BuildInfo struct {
	Branch, Commit string
}

BuildInfo contains information about the current build

type CharacterSelect

type CharacterSelect struct {
	*d2mapentity.MapEntityFactory
	*d2hero.HeroStateFactory

	*d2util.Logger
	// contains filtered or unexported fields
}

CharacterSelect represents the character select screen

func CreateCharacterSelect

func CreateCharacterSelect(
	navigator d2interface.Navigator,
	asset *d2asset.AssetManager,
	renderer d2interface.Renderer,
	inputManager d2interface.InputManager,
	audioProvider d2interface.AudioProvider,
	ui *d2ui.UIManager,
	connectionType d2clientconnectiontype.ClientConnectionType,
	l d2util.LogLevel,
	connectionHost string,
) (*CharacterSelect, error)

CreateCharacterSelect creates the character select screen and returns a pointer to it

func (*CharacterSelect) Advance

func (v *CharacterSelect) Advance(tickTime float64) error

Advance runs the update logic on the Character Select screen

func (*CharacterSelect) OnLoad

func (v *CharacterSelect) OnLoad(loading d2screen.LoadingState)

OnLoad loads the resources for the Character Select screen

func (*CharacterSelect) OnMouseButtonDown

func (v *CharacterSelect) OnMouseButtonDown(event d2interface.MouseEvent) bool

OnMouseButtonDown is called when a mouse button is clicked

func (*CharacterSelect) OnUnload

func (v *CharacterSelect) OnUnload() error

OnUnload candles cleanup when this screen is closed

func (*CharacterSelect) Render

func (v *CharacterSelect) Render(screen d2interface.Surface)

Render renders the Character Select screen

type Cinematics

type Cinematics struct {
	*d2util.Logger
	// contains filtered or unexported fields
}

Cinematics represents the cinematics screen

func CreateCinematics

func CreateCinematics(
	navigator d2interface.Navigator,
	asset *d2asset.AssetManager,
	renderer d2interface.Renderer,
	aup d2interface.AudioProvider,
	l d2util.LogLevel,
	ui *d2ui.UIManager) *Cinematics

CreateCinematics creates an instance of the credits screen

func (*Cinematics) OnLoad

func (v *Cinematics) OnLoad(_ d2screen.LoadingState)

OnLoad is called to load the resources for the credits screen

func (*Cinematics) Render

func (v *Cinematics) Render(screen d2interface.Surface)

Render renders the credits screen

type Credits

type Credits struct {
	*d2util.Logger
	// contains filtered or unexported fields
}

Credits represents the credits screen

func CreateCredits

func CreateCredits(navigator d2interface.Navigator,
	asset *d2asset.AssetManager,
	renderer d2interface.Renderer,
	l d2util.LogLevel,
	ui *d2ui.UIManager) *Credits

CreateCredits creates an instance of the credits screen

func (*Credits) Advance

func (v *Credits) Advance(tickTime float64) error

Advance runs the update logic on the credits screen

func (*Credits) LoadContributors

func (v *Credits) LoadContributors() []string

LoadContributors loads the contributors data from file

func (*Credits) OnLoad

func (v *Credits) OnLoad(loading d2screen.LoadingState)

OnLoad is called to load the resources for the credits screen

func (*Credits) Render

func (v *Credits) Render(screen d2interface.Surface)

Render renders the credits screen

type Game

type Game struct {
	*d2mapentity.MapEntityFactory

	*d2util.Logger
	// contains filtered or unexported fields
}

Game represents the Gameplay screen

func CreateGame

func CreateGame(
	navigator d2interface.Navigator,
	asset *d2asset.AssetManager,
	ui *d2ui.UIManager,
	renderer d2interface.Renderer,
	inputManager d2interface.InputManager,
	audioProvider d2interface.AudioProvider,
	gameClient *d2client.GameClient,
	term d2interface.Terminal,
	l d2util.LogLevel,
	guiManager *d2gui.GuiManager,
) (*Game, error)

CreateGame creates the Gameplay screen and returns a pointer to it

func (*Game) Advance

func (v *Game) Advance(elapsed float64) error

Advance runs the update logic on the Gameplay screen nolint:gocyclo // not need to change

func (*Game) OnLoad

func (v *Game) OnLoad(_ d2screen.LoadingState)

OnLoad loads the resources for the Gameplay screen

func (*Game) OnPlayerCast

func (v *Game) OnPlayerCast(skillID int, targetX, targetY float64)

OnPlayerCast sends the casting skill action to the server

func (*Game) OnPlayerMove

func (v *Game) OnPlayerMove(targetX, targetY float64)

OnPlayerMove sends the player move action to the server

func (*Game) OnPlayerSave

func (v *Game) OnPlayerSave() error

OnPlayerSave instructs the server to save our player data

func (*Game) OnUnload

func (v *Game) OnUnload() error

OnUnload releases the resources of Gameplay screen

func (*Game) Render

func (v *Game) Render(screen d2interface.Surface)

Render renders the Gameplay screen

type GuiTestMain

type GuiTestMain struct {
	*d2util.Logger
	// contains filtered or unexported fields
}

GuiTestMain is a playground screen for the gui components

func CreateGuiTestMain

func CreateGuiTestMain(renderer d2interface.Renderer,
	guiManager *d2gui.GuiManager,
	l d2util.LogLevel,
	assetManager *d2asset.AssetManager) *GuiTestMain

CreateGuiTestMain creates a GuiTestMain screen

func (*GuiTestMain) Advance

func (g *GuiTestMain) Advance(_ float64) error

Advance does nothing for the GuiTestMain screen

func (*GuiTestMain) OnLoad

func (g *GuiTestMain) OnLoad(loading d2screen.LoadingState)

OnLoad loads the resources and creates the gui components

func (*GuiTestMain) Render

func (g *GuiTestMain) Render(_ d2interface.Surface)

Render does nothing for the GuiTestMain screen

type HeroRenderInfo

type HeroRenderInfo struct {
	Stance                   d2enum.HeroStance
	IdleSprite               *d2ui.Sprite
	IdleSelectedSprite       *d2ui.Sprite
	ForwardWalkSprite        *d2ui.Sprite
	ForwardWalkSpriteOverlay *d2ui.Sprite
	SelectedSprite           *d2ui.Sprite
	SelectedSpriteOverlay    *d2ui.Sprite
	BackWalkSprite           *d2ui.Sprite
	BackWalkSpriteOverlay    *d2ui.Sprite
	SelectionBounds          image.Rectangle
	SelectSfx                d2interface.SoundEffect
	DeselectSfx              d2interface.SoundEffect
	// contains filtered or unexported fields
}

HeroRenderInfo stores the rendering information of a hero for the Select Hero Class screen

type MainMenu struct {
	*d2util.Logger
	// contains filtered or unexported fields
}

MainMenu represents the main menu

func CreateMainMenu

func CreateMainMenu(
	navigator d2interface.Navigator,
	asset *d2asset.AssetManager,
	renderer d2interface.Renderer,
	inputManager d2interface.InputManager,
	audioProvider d2interface.AudioProvider,
	ui *d2ui.UIManager,
	buildInfo BuildInfo,
	l d2util.LogLevel,
	errorMessageOptional ...string,
) (*MainMenu, error)

CreateMainMenu creates an instance of MainMenu

func (v *MainMenu) Advance(tickTime float64) error

Advance runs the update logic on the main menu

func (v *MainMenu) OnKeyUp(event d2interface.KeyEvent) bool

OnKeyUp is called when a key is released

func (v *MainMenu) OnLoad(loading d2screen.LoadingState)

OnLoad is called to load the resources for the main menu

func (v *MainMenu) OnMouseButtonDown(event d2interface.MouseEvent) bool

OnMouseButtonDown is called when a mouse button is clicked

func (v *MainMenu) Render(screen d2interface.Surface)

Render renders the main menu

func (v *MainMenu) SetScreenMode(screenMode mainMenuScreenMode)

SetScreenMode sets the screen mode (which sub-menu the screen is on)

type MapEngineTest

type MapEngineTest struct {
	*d2util.Logger
	// contains filtered or unexported fields
}

MapEngineTest represents the MapEngineTest screen

func CreateMapEngineTest

func CreateMapEngineTest(currentRegion,
	levelPreset int,
	asset *d2asset.AssetManager,
	term d2interface.Terminal,
	renderer d2interface.Renderer,
	inputManager d2interface.InputManager,
	audioProvider d2interface.AudioProvider,
	l d2util.LogLevel,
	screen *d2screen.ScreenManager,
) (*MapEngineTest, error)

CreateMapEngineTest creates the Map Engine Test screen and returns a pointer to it

func (*MapEngineTest) Advance

func (met *MapEngineTest) Advance(tickTime float64) error

Advance runs the update logic on the Map Engine Test screen

func (*MapEngineTest) OnKeyDown

func (met *MapEngineTest) OnKeyDown(event d2interface.KeyEvent) bool

OnKeyDown defines the actions of the Map Engine Test screen when a key is pressed

func (*MapEngineTest) OnKeyRepeat

func (met *MapEngineTest) OnKeyRepeat(event d2interface.KeyEvent) bool

OnKeyRepeat is called to handle repeated key presses

func (*MapEngineTest) OnLoad

func (met *MapEngineTest) OnLoad(loading d2screen.LoadingState)

OnLoad loads the resources for the Map Engine Test screen

func (*MapEngineTest) OnMouseButtonDown

func (met *MapEngineTest) OnMouseButtonDown(event d2interface.MouseEvent) bool

OnMouseButtonDown handles mouse button down events

func (*MapEngineTest) OnMouseButtonRepeat

func (met *MapEngineTest) OnMouseButtonRepeat(event d2interface.MouseEvent) bool

OnMouseButtonRepeat handles repeated mouse clicks

func (*MapEngineTest) OnMouseMove

func (met *MapEngineTest) OnMouseMove(event d2interface.MouseMoveEvent) bool

OnMouseMove is the mouse move handler

func (*MapEngineTest) OnUnload

func (met *MapEngineTest) OnUnload() error

OnUnload releases the resources for the Map Engine Test screen

func (*MapEngineTest) Render

func (met *MapEngineTest) Render(screen d2interface.Surface)

Render renders the Map Engine Test screen

type SelectHeroClass

type SelectHeroClass struct {
	*d2inventory.InventoryItemFactory
	*d2hero.HeroStateFactory

	*d2util.Logger
	// contains filtered or unexported fields
}

SelectHeroClass represents the Select Hero Class screen

func CreateSelectHeroClass

func CreateSelectHeroClass(
	navigator d2interface.Navigator,
	asset *d2asset.AssetManager,
	renderer d2interface.Renderer,
	audioProvider d2interface.AudioProvider,
	ui *d2ui.UIManager,
	connectionType d2clientconnectiontype.ClientConnectionType,
	l d2util.LogLevel,
	connectionHost string,
) (*SelectHeroClass, error)

CreateSelectHeroClass creates an instance of a SelectHeroClass

func (*SelectHeroClass) Advance

func (v *SelectHeroClass) Advance(tickTime float64) error

Advance runs the update logic on the Select Hero Class screen

func (*SelectHeroClass) OnLoad

func (v *SelectHeroClass) OnLoad(loading d2screen.LoadingState)

OnLoad loads the resources for the Select Hero Class screen

func (*SelectHeroClass) OnUnload

func (v *SelectHeroClass) OnUnload() error

OnUnload releases the resources of the Select Hero Class screen

func (*SelectHeroClass) Render

func (v *SelectHeroClass) Render(screen d2interface.Surface)

Render renders the Select Hero Class screen

Jump to

Keyboard shortcuts

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