util

package
v0.0.0-...-5e7dcd9 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// System Key-Names
	KC_POWER = "kc_power"
	KC_RESET = "kc_reset"

	// Controller Key-Names
	KC_P1_UP    = "kc_p1_up"
	KC_P1_DOWN  = "kc_p1_down"
	KC_P1_LEFT  = "kc_p1_left"
	KC_P1_RIGHT = "kc_p1_right"
	KC_P1_A     = "kc_p1_a"
	KC_P1_B     = "kc_p1_b"
	KC_P1_X     = "kc_p1_x"
	KC_P1_Y     = "kc_p1_y"

	KC_P2_UP    = "kc_p2_up"
	KC_P2_DOWN  = "kc_p2_down"
	KC_P2_LEFT  = "kc_p2_left"
	KC_P2_RIGHT = "kc_p2_right"
	KC_P2_A     = "kc_p2_a"
	KC_P2_B     = "kc_p2_b"
	KC_P2_X     = "kc_p2_x"
	KC_P2_Y     = "kc_p2_y"
)
View Source
const (
	OPT_FILE      = "options.json"
	OPT_FILE_MODE = 0650
	OPT_INDENT    = "    "
)

Variables

View Source
var KEY_DESCS = map[string]string{
	KC_POWER:    "Power Button (Exits)",
	KC_RESET:    "Reset Button (Reboots)",
	KC_P1_UP:    "Player 1 Up Button",
	KC_P1_DOWN:  "Player 1 Down Button",
	KC_P1_LEFT:  "Player 1 Left Button",
	KC_P1_RIGHT: "Player 1 Right Button",
	KC_P1_A:     "Player 1 A Button",
	KC_P1_B:     "Player 1 B Button",
	KC_P1_X:     "Player 1 X Button",
	KC_P1_Y:     "Player 1 Y Button",
	KC_P2_UP:    "Player 2 Up Button",
	KC_P2_DOWN:  "Player 2 Down Button",
	KC_P2_LEFT:  "Player 2 Left Button",
	KC_P2_RIGHT: "Player 2 Right Button",
	KC_P2_A:     "Player 2 A Button",
	KC_P2_B:     "Player 2 B Button",
	KC_P2_X:     "Player 2 X Button",
	KC_P2_Y:     "Player 2 Y Button",
}

Key descriptions for auto-configuration

View Source
var KEY_LISTENERS = map[string][]KeyListener{}

Functions

func AddKeyListener

func AddKeyListener(key string, lnr KeyListener)

func DiffSign

func DiffSign(a, b uint8) uint8

func HandleInputs

func HandleInputs()

func LoadOptions

func LoadOptions() error
func PopupBox(msg string, clr rl.Color)

func SaveOptions

func SaveOptions() error

func StepTowardsColour

func StepTowardsColour(col rl.Color, trgt rl.Color) rl.Color

Types

type ConfigMenu

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

func NewConfigMenu

func NewConfigMenu() *ConfigMenu

func (*ConfigMenu) ConfigureInputs

func (m *ConfigMenu) ConfigureInputs()

Goes through all keys and prompts the use to press the desired key

func (*ConfigMenu) IsDone

func (m *ConfigMenu) IsDone() bool

type Inputs

type Inputs map[string]int32

type KeyListener

type KeyListener func()

type Options

type Options struct {
	MasterVol  float32   `json:"master_vol"`
	PixelSize  int32     `json:"pixel_size"`
	TargetFPS  int32     `json:"target_fps"`
	ColourFG   rl.Color  `json:"colour_fg"`
	ColourBG   rl.Color  `json:"colour_bg"`
	Samples    [4]string `json:"samples"`
	Inputs     Inputs    `json:"inputs"`
	ConfigKeys bool      `json:"configure_key"`
	MonAddrs   []string  `json:"mon_addrs"`
	DebugMode  bool      `json:"debug_mode"`
}
var GlobalOptions Options

Jump to

Keyboard shortcuts

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