desktop

package
v0.0.0-...-4d18667 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package desktop manages the creation of windows and runs game states in thise windows. This will be the entry point for all games running on the desktop.

To start a game you have to create a window with a mode and pass it a game state:

func main() {
	mode := &desktop.Mode{Width: 1280, Height: 800, Fullscreen: false}
	window, err := desktop.OpenWindow(mode)
	if err != nil {
		panic(err)
	}

	window.Run(&game.State{
		// define your callbacks here...
	})
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exit

func Exit()

Exit closes the game and calls the cleanup callbacks.

Types

type Mode

type Mode struct {
	Width      int32
	Height     int32
	Fullscreen bool
}

Mode represents the resolution of a window and whether it is fullscreen.

func CurrentMode

func CurrentMode() *Mode

CurrentMode returns the mode that is currently active.

func FullscreenModes

func FullscreenModes() []*Mode

FullscreenModes returns an array of all available fullscreen modes.

type Window

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

Window is the os application frame where all the stuff will happen.

func OpenWindow

func OpenWindow(m *Mode) (*Window, error)

OpenWindow creates a new window on the main monitor.

func (*Window) Run

func (w *Window) Run(state *game.State)

Run starts the main game loop for the given game state by invoking all defined callbacks in the given game state.

Jump to

Keyboard shortcuts

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