app

package
v0.18.2 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: MIT Imports: 20 Imported by: 2

Documentation

Overview

Package app provides a GLFW+GL implementation of the github.com/mokiat/lacking/app package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(cfg *Config, controller app.Controller) error

Run starts a new application and opens a single window.

The specified configuration is used to determine how the window is initialized.

The specified controller will be used to send notifications on window state changes.

Types

type Config

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

Config represents an application window configuration.

func NewConfig

func NewConfig(title string, width, height int) *Config

NewConfig creates a new Config object that contains the minimum required settings.

func (*Config) AudioEnabled added in v0.18.0

func (c *Config) AudioEnabled() bool

AudioEnabled returns whether audio will be enabled.

func (*Config) Cursor

func (c *Config) Cursor() *app.CursorDefinition

Cursor returns the cursor configuration for this application.

func (*Config) CursorVisible

func (c *Config) CursorVisible() bool

CursorVisible returns whether the cursor will be shown when hovering over the window.

func (*Config) Fullscreen

func (c *Config) Fullscreen() bool

Fullscreen returns whether the window will be created in fullscreen mode.

func (*Config) Icon

func (c *Config) Icon() string

Icon returns the filepath location of an icon image that will be used by the application.

func (*Config) Locator

func (c *Config) Locator() resource.ReadLocator

Locator returns the resource locator that will be used to load app-specific resources (e.g. icon).

func (*Config) MaxSize

func (c *Config) MaxSize() (int, int)

MaxSize returns the maximum size for the window. This method returns (0, 0) if a maximum size is not specified.

func (*Config) Maximized

func (c *Config) Maximized() bool

Maximized returns whether the window will be created in maximized state.

func (*Config) MinSize

func (c *Config) MinSize() (int, int)

MinSize returns the minimum size for the window. This method returns (0, 0) if a minimum size is not specified.

func (*Config) SetAudioEnabled added in v0.18.0

func (c *Config) SetAudioEnabled(enabled bool)

SetAudioEnabled specifies whether audio should be enabled.

func (*Config) SetCursor

func (c *Config) SetCursor(definition *app.CursorDefinition)

SetCursor configures a custom cursor to be used. Specifying nil disables the custom cursor.

func (*Config) SetCursorVisible

func (c *Config) SetCursorVisible(visible bool)

SetCursorVisible specifies whether the cursor should be displayed when moved over the window.

func (*Config) SetFullscreen

func (c *Config) SetFullscreen(fullscreen bool)

SetFullscreen specifies whether the window should be created in a fullscreen mode.

func (*Config) SetIcon

func (c *Config) SetIcon(icon string)

SetIcon specifies the filepath to an icon image that will be used for the application.

An empty string value indicates that no icon should be used.

func (*Config) SetLocator

func (c *Config) SetLocator(locator resource.ReadLocator)

SetLocator changes the resource locator that will be used to load app-specific resources (e.g. icon).

func (*Config) SetMaxSize

func (c *Config) SetMaxSize(width, height int)

SetMaxSize sets a maximum size for the window. Specifying a non-positive value for any dimension disables this setting.

func (*Config) SetMaximized

func (c *Config) SetMaximized(maximized bool)

SetMaximized specifies whether the window should be created in maximized state.

func (*Config) SetMinSize

func (c *Config) SetMinSize(width, height int)

SetMinSize sets a minimum size for the window. Specifying a non-positive value for any dimension disables this setting.

func (*Config) SetTitle added in v0.18.0

func (c *Config) SetTitle(title string)

SetTitle sets the title of the application window.

func (*Config) SetVSync

func (c *Config) SetVSync(vsync bool)

SetVSync indicates whether v-sync should be enabled.

func (*Config) Title added in v0.18.0

func (c *Config) Title() string

Title returns the title of the application window.

func (*Config) VSync

func (c *Config) VSync() bool

VSync returns whether v-sync will be enabled.

type Gamepad

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

func (*Gamepad) ActionDownButton

func (g *Gamepad) ActionDownButton() bool

func (*Gamepad) ActionLeftButton

func (g *Gamepad) ActionLeftButton() bool

func (*Gamepad) ActionRightButton

func (g *Gamepad) ActionRightButton() bool

func (*Gamepad) ActionUpButton

func (g *Gamepad) ActionUpButton() bool

func (*Gamepad) BackButton

func (g *Gamepad) BackButton() bool

func (*Gamepad) Connected

func (g *Gamepad) Connected() bool

func (*Gamepad) DpadDownButton

func (g *Gamepad) DpadDownButton() bool

func (*Gamepad) DpadLeftButton

func (g *Gamepad) DpadLeftButton() bool

func (*Gamepad) DpadRightButton

func (g *Gamepad) DpadRightButton() bool

func (*Gamepad) DpadUpButton

func (g *Gamepad) DpadUpButton() bool

func (*Gamepad) ForwardButton

func (g *Gamepad) ForwardButton() bool

func (*Gamepad) LeftBumper

func (g *Gamepad) LeftBumper() bool

func (*Gamepad) LeftStickButton

func (g *Gamepad) LeftStickButton() bool

func (*Gamepad) LeftStickX

func (g *Gamepad) LeftStickX() float64

func (*Gamepad) LeftStickY

func (g *Gamepad) LeftStickY() float64

func (*Gamepad) LeftTrigger

func (g *Gamepad) LeftTrigger() float64

func (*Gamepad) Pulse

func (g *Gamepad) Pulse(intensity float64, duration time.Duration)

func (*Gamepad) RightBumper

func (g *Gamepad) RightBumper() bool

func (*Gamepad) RightStickButton

func (g *Gamepad) RightStickButton() bool

func (*Gamepad) RightStickX

func (g *Gamepad) RightStickX() float64

func (*Gamepad) RightStickY

func (g *Gamepad) RightStickY() float64

func (*Gamepad) RightTrigger

func (g *Gamepad) RightTrigger() float64

func (*Gamepad) SetStickDeadzone

func (g *Gamepad) SetStickDeadzone(deadzone float64)

func (*Gamepad) SetTriggerDeadzone

func (g *Gamepad) SetTriggerDeadzone(deadzone float64)

func (*Gamepad) StickDeadzone

func (g *Gamepad) StickDeadzone() float64

func (*Gamepad) Supported

func (g *Gamepad) Supported() bool

func (*Gamepad) TriggerDeadzone

func (g *Gamepad) TriggerDeadzone() float64

Jump to

Keyboard shortcuts

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