loadscreen

package
v0.0.0-...-79996cc Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package loadscreen implements a modal "Loading" screen for the game, which can be shown or hidden by gameplay scenes as needed.

Index

Constants

View Source
const (
	ProgressWidth  = 300
	ProgressHeight = 16
)

Configuration values.

Variables

This section is empty.

Functions

func Hide

func Hide()

Hide the loading screen.

NOTICE: the loadscreen is hidden on an async goroutine and it is NOT SAFE to clean up textures used by the wallpaper images, but this is OK because the loadscreen uses the same wallpaper every time and is called many times during gameplay, it can hold its textures.

func IsActive

func IsActive() bool

IsActive returns whether the loading screen is currently visible.

func Loop

func Loop(windowSize render.Rect, e render.Engine)

Loop is called on every game loop. If the loadscreen is not active, nothing happens. Otherwise the loading screen UI is drawn to screen.

func PreloadAllChunkBitmaps

func PreloadAllChunkBitmaps(chunker *level.Chunker)

PreloadAllChunkBitmaps is a helper function to eager cache all bitmap images of the chunks in a level drawing. It is designed to work with the loading screen and will set the Progress percent based on the total number of chunks vs. chunks remaining to pre-cache bitmaps from.

func Resized

func Resized()

Resized the window.

func SetProgress

func SetProgress(v float64)

SetProgress sets the current progress value for loading screens having a progress bar.

func SetSubtitle

func SetSubtitle(value ...string)

SetSubtitle specifies secondary text beneath the Loading banner. The subtitle is blanked on Show() and ShowWithProgress() and must be specified by the caller if desired. Pass multiple values for multiple lines of text.

func Show

func Show()

Show the basic loading screen without a progress bar.

func ShowWithProgress

func ShowWithProgress()

ShowWithProgress initializes the loading screen with a progress bar starting at zero.

Types

This section is empty.

Jump to

Keyboard shortcuts

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