config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Flags

func Flags(cmd *cobra.Command)

func GetDir

func GetDir() (string, error)

func GetPaletteDir

func GetPaletteDir() (string, error)

func GetSRAMDir

func GetSRAMDir() (string, error)

func GetScreenshotDir

func GetScreenshotDir() (string, error)

func GetStatesDir

func GetStatesDir() (string, error)

Types

type Audio

type Audio struct {
	Enabled  bool          `toml:"enabled" comment:"Enables audio output."`
	Volume   float64       `toml:"volume" comment:"Output volume (between 0 and 1)."`
	Channels AudioChannels `toml:"channels" comment:"Toggles specific audio channels."`
}

type AudioChannels

type AudioChannels struct {
	Triangle bool `toml:"triangle"`
	Square1  bool `toml:"square_1"`
	Square2  bool `toml:"square_2"`
	Noise    bool `toml:"noise"`
	PCM      bool `toml:"pcm"`
}

type Config

type Config struct {
	UI    UI    `toml:"ui"`
	State State `toml:"state"`
	Input Input `toml:"input"`
	Audio Audio `toml:"audio"`
	Debug Debug `toml:"debug,omitempty"`
}

func Load

func Load(cmd *cobra.Command) (*Config, error)

func NewDefault

func NewDefault() *Config

type Debug

type Debug struct {
	Enabled bool `toml:"enabled"`
	Trace   bool `toml:"trace"`
}

type Duration

type Duration time.Duration

func (Duration) MarshalText

func (d Duration) MarshalText() ([]byte, error)

func (*Duration) UnmarshalText

func (d *Duration) UnmarshalText(text []byte) error

type Input

type Input struct {
	Reset             Key      `toml:"reset" comment:"Key to reset the game (must be held)."`
	ResetHold         Duration `toml:"reset_hold" comment:"Time the reset button must be held."`
	State1Save        Key      `toml:"state1_save" comment:"Key to save the game state (separate from auto resume state)."`
	State1Load        Key      `toml:"state1_load" comment:"Key to load the last save state."`
	StateUndoModifier Key      `toml:"state_undo_modifier" comment:"Hold this key and press the save/load state key, and the action will be undone."`
	FastForward       Key      `toml:"fast_forward" comment:"Key to fast-forward the game (must be held)."`
	FastForwardRate   uint8    `toml:"fast_forward_rate" comment:"Fast-forward rate multiplier."`
	Fullscreen        Key      `toml:"fullscreen" comment:"Key to toggle fullscreen."`
	Screenshot        Key      `toml:"screenshot" comment:"Key to take a screenshot."`
	TurboDutyCycle    uint16   `toml:"turbo_duty_cycle" comment:"Frame duty cycle when turbo key is held (minimum: 2)."`
	Player1           Keymap   `toml:"player1" comment:"Player 1 keymap."`
	Player2           Keymap   `toml:"player2" comment:"Player 2 keymap."`
}

func (Input) ResetHoldFrames

func (i Input) ResetHoldFrames() int

type Key

type Key ebiten.Key

func (Key) MarshalText

func (k Key) MarshalText() ([]byte, error)

func (*Key) UnmarshalText

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

type Keymap

type Keymap struct {
	A      Key `toml:"a"`
	B      Key `toml:"b"`
	Start  Key `toml:"start"`
	Select Key `toml:"select"`
	Up     Key `toml:"up"`
	Down   Key `toml:"down"`
	Left   Key `toml:"left"`
	Right  Key `toml:"right"`

	ATurbo Key `toml:"a_turbo" comment:"Key to press the A button repeatedly (must be held)."`
	BTurbo Key `toml:"b_turbo" comment:"Key to press the B button repeatedly (must be held)."`
}

func (Keymap) GetMap

func (k Keymap) GetMap() map[button.Button]ebiten.Key

func (Keymap) GetTurboMap

func (k Keymap) GetTurboMap() map[button.Button]ebiten.Key

type Overscan added in v0.1.0

type Overscan struct {
	Top    int `toml:"top"`
	Right  int `toml:"right"`
	Bottom int `toml:"bottom"`
	Left   int `toml:"left"`
}

func (Overscan) Rect added in v0.1.0

func (t Overscan) Rect() image.Rectangle

type State

type State struct {
	Resume           bool     `toml:"resume" comment:"Automatically resumes the previous game state."`
	AutosaveInterval Duration `toml:"autosave_interval" comment:"If resume is enabled, the game state will be saved regularly at the configured interval."`
	UndoStateCount   int      `toml:"undo_state_count" comment:"Number of undo states to keep in memory."`
}

type TOMLParser

type TOMLParser struct{}

func (TOMLParser) Marshal

func (p TOMLParser) Marshal(o map[string]interface{}) ([]byte, error)

func (TOMLParser) Unmarshal

func (p TOMLParser) Unmarshal(b []byte) (map[string]interface{}, error)

type UI

type UI struct {
	Fullscreen        bool     `toml:"fullscreen" comment:"Default fullscreen state. Fullscreen can also be toggled with a key (F11 by default)."`
	Scale             float64  `toml:"scale" comment:"Multiplier used to scale the UI."`
	PauseUnfocused    bool     `` /* 148-byte string literal not displayed */
	Palette           string   `toml:"palette" comment:"Palette (.pal) file to use. An embedded palette will be used when blank."`
	RemoveSpriteLimit bool     `` /* 146-byte string literal not displayed */
	Overscan          Overscan `toml:"overscan,inline" comment:"Change the number of rows/cols of overscan."`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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