resources

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2022 License: MIT Imports: 10 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	// Combinations contains buttons combinations
	Combinations [][]Button
	// Once determines if the action should be triggered every frame when the button is pressed (default) or only once
	Once bool
}

Action contains buttons combinations with settings

type Axis

type Axis struct {
	Value interface{}
}

Axis can be an emulated axis, a gamepad axis or a mouse axis

func (*Axis) UnmarshalTOML added in v0.6.0

func (a *Axis) UnmarshalTOML(i interface{}) error

UnmarshalTOML fills structure fields from TOML data

type Button

type Button struct {
	Value interface{}
}

Button can be a US keyboard key, a mouse button or a gamepad button

func (*Button) UnmarshalTOML added in v0.6.0

func (b *Button) UnmarshalTOML(i interface{}) error

UnmarshalTOML fills structure fields from TOML data

type ControllerAxis

type ControllerAxis struct {
	ID       ebiten.GamepadID
	Axis     int
	Invert   bool
	DeadZone float64 `toml:"dead_zone"`
}

ControllerAxis is a gamepad axis

type ControllerButton

type ControllerButton struct {
	ID            ebiten.GamepadID
	GamepadButton ebiten.GamepadButton
}

ControllerButton is a gamepad button

func (*ControllerButton) UnmarshalTOML

func (b *ControllerButton) UnmarshalTOML(i interface{}) error

UnmarshalTOML fills structure fields from TOML data

type Controls

type Controls struct {
	// Axes contains axis controls, used for inputs represented by a float value from -1 to 1
	Axes map[string]Axis
	// Actions contains buttons combinations, used for general inputs
	Actions map[string]Action
}

Controls contains input controls

type Emulated

type Emulated struct {
	Pos Button
	Neg Button
}

Emulated is an emulated axis

type Font

type Font struct {
	Font *truetype.Font
}

Font structure

func (*Font) UnmarshalTOML

func (f *Font) UnmarshalTOML(i interface{}) error

UnmarshalTOML fills structure fields from TOML data

type InputHandler

type InputHandler struct {
	// Axes contains input axis values
	Axes map[string]float64
	// Actions contains input actions
	Actions map[string]bool
}

InputHandler contains input axis values and actions corresponding to specified controls

type Key

type Key struct {
	Key ebiten.Key
}

Key is a US keyboard key

func (*Key) UnmarshalText

func (k *Key) UnmarshalText(text []byte) error

UnmarshalText fills structure fields from text data

type MouseAxis

type MouseAxis struct {
	Axis int
}

MouseAxis is a mouse axis

type MouseButton

type MouseButton struct {
	MouseButton ebiten.MouseButton
}

MouseButton is a mouse button

func (*MouseButton) UnmarshalText

func (b *MouseButton) UnmarshalText(text []byte) error

UnmarshalText fills structure fields from text data

type Resources

type Resources struct {
	ScreenDimensions *ScreenDimensions
	Controls         *Controls
	InputHandler     *InputHandler
	SpriteSheets     *map[string]components.SpriteSheet
	Fonts            *map[string]Font
	AudioContext     *audio.Context
	AudioPlayers     *map[string]*audio.Player
	Prefabs          interface{}
	Game             interface{}
}

Resources contains references to data not related to any entity

func InitResources

func InitResources() *Resources

InitResources initializes resources

type ScreenDimensions

type ScreenDimensions struct {
	Width  int
	Height int
}

ScreenDimensions contains current screen dimensions

Jump to

Keyboard shortcuts

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