internal

package
v0.2.70 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package internal contains utility functions and constants for Spy Cards Online.

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = &Config{
	UserImageBaseURL: "https://spy-cards.lubar.me/spy-cards/user-img/",
	ArcadeAPIBaseURL: "https://spy-cards.lubar.me/spy-cards/arcade/api/",
}

DefaultConfig is the Config used by the official Spy Cards Online site.

View Source
var OnSettingsChanged []func(*Settings)
View Source
var Version = [3]uint64{0, 2, 70}

Version is the current version of Spy Cards Online.

Functions

func ModifyRequest added in v0.2.67

func ModifyRequest(r *http.Request) *http.Request

ModifyRequest modifies an HTTP request before it is sent.

func SaveSettings

func SaveSettings(s *Settings)

func SetActive

func SetActive(b bool)

SetActive sets the active flag for the UI, which hides some UI elements.

func WithConfig

func WithConfig(ctx context.Context, config *Config) context.Context

WithConfig attaches a Config to a context.

Types

type AudioSettings added in v0.2.67

type AudioSettings struct {
	Music  float64 `json:"music"`
	Sounds float64 `json:"sounds"`
}

type ButtonStyle added in v0.2.67

type ButtonStyle int
const (
	StyleKeyboard       ButtonStyle = 0
	StyleGenericGamepad ButtonStyle = 1
)

type Config

type Config struct {
	UserImageBaseURL string `json:"user_image_base_url"`
	ArcadeAPIBaseURL string `json:"arcade_api_base_url"`
}

Config holds data about external services used by Spy Cards Online.

func GetConfig

func GetConfig(ctx context.Context) *Config

GetConfig returns the Config associated with a context, or DefaultConfig.

type ControlsSettings added in v0.2.67

type ControlsSettings struct {
	Keyboard int              `json:"keyboard,omitempty"`
	Gamepad  map[string]int   `json:"gamepad,omitempty"`
	CustomKB []KeyboardLayout `json:"customKB"`
	CustomGP []GamepadLayout  `json:"customGP"`
}

type GamepadButton added in v0.2.67

type GamepadButton struct {
	Button     int
	IsAxis     bool
	IsPositive bool
}

func (GamepadButton) MarshalJSON added in v0.2.67

func (gpb GamepadButton) MarshalJSON() ([]byte, error)

func (GamepadButton) String added in v0.2.67

func (gpb GamepadButton) String() string

func (*GamepadButton) UnmarshalJSON added in v0.2.67

func (gpb *GamepadButton) UnmarshalJSON(b []byte) error

type GamepadLayout added in v0.2.67

type GamepadLayout struct {
	Name   string            `json:"name"`
	Button [10]GamepadButton `json:"button"`
	Style  ButtonStyle       `json:"style,omitempty"`
}

type KeyboardLayout added in v0.2.67

type KeyboardLayout struct {
	Name string     `json:"name"`
	Code [10]string `json:"code"`
}

type Settings

type Settings struct {
	Audio AudioSettings `json:"audio"`

	Character string `json:"character,omitempty"`

	Disable3D  bool `json:"disable3D,omitempty"`
	ForceRelay bool `json:"forceRelay,omitempty"`
	DisableCRT bool `json:"disableCRT,omitempty"`

	LastTermacadeOption int    `json:"lastTermacadeOption"`
	LastTermacadeName   string `json:"lastTermacadeName,omitempty"`

	AutoUploadRecording     bool `json:"autoUploadRecording,omitempty"`
	DisplayTermacadeButtons bool `json:"displayTermacadeButtons,omitempty"`

	Controls ControlsSettings `json:"controls"`
}

func LoadSettings

func LoadSettings() *Settings

Jump to

Keyboard shortcuts

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