Documentation ¶
Index ¶
- Constants
- func GameBindsAsString(gameBindsByProfile GameBindsByProfile) string
- func GenerateContextColours(contexts ContextToColours, config *Config)
- func GenerateImageOverlays(overlaysByImage OverlaysByImage, input string, inputData InputData, ...)
- func GenerateImages(overlaysByProfile OverlaysByProfile, categories map[string]string, ...) ([]bytes.Buffer, int)
- func LoadDevicesInfo(file string, devices *Devices, log *Logger)
- func LoadYaml(filename string, out interface{}, label string, log *Logger)
- func YamlObjectAsString(in interface{}, label string) string
- type Config
- type ContextToColours
- type DeviceInputTypeMapping
- type DeviceInputs
- type DeviceMap
- type DeviceNameFullToShort
- type Devices
- type Dimensions2d
- type FuncMatchGameInputToModel
- type FuncRequestHandler
- type GameActions
- type GameBindsByProfile
- type GameContextActions
- type GameData
- type GameDeviceContextActions
- type GameInput
- type GeneratedDevices
- type HeaderData
- type ImageMap
- type InputData
- type InputTypeMapping
- type LogEntry
- type Logger
- type OverlayData
- type OverlaysByImage
- type OverlaysByProfile
- type Point2d
- type RegexByName
- type Set
- type WatermarkData
Constants ¶
const ( // DeviceUnknown - unfamiliar with this device DeviceUnknown = "DeviceUnknown" // DeviceMissingInfo - only know the name of device DeviceMissingInfo = "DeviceMissingInfo" // ProfileDefault - the name of the default profile ProfileDefault = "default_metarefcard" )
const ( // InputPrimary - primary input InputPrimary = 0 // InputSecondary - secondary input InputSecondary = 1 // NumInputs - number of inputs. NumInputs = 2 )
Variables ¶
This section is empty.
Functions ¶
func GameBindsAsString ¶
func GameBindsAsString(gameBindsByProfile GameBindsByProfile) string
GameBindsAsString returns the object as a printable string
func GenerateContextColours ¶
func GenerateContextColours(contexts ContextToColours, config *Config)
GenerateContextColours - basic utility function to generate colours
func GenerateImageOverlays ¶
func GenerateImageOverlays(overlaysByImage OverlaysByImage, input string, inputData InputData, gameData GameData, actionName string, context string, shortName string, image string, gameLabel string, log *Logger)
GenerateImageOverlays - creates the image overlays into overlaysByImage
func GenerateImages ¶
func GenerateImages(overlaysByProfile OverlaysByProfile, categories map[string]string, gameLabel string, config *Config, log *Logger) ([]bytes.Buffer, int)
GenerateImages returns the generated images
func LoadDevicesInfo ¶
LoadDevicesInfo loads all the device information (across files) into "devices"
func YamlObjectAsString ¶
YamlObjectAsString outputs contents of yaml object with a label
Types ¶
type Config ¶
type Config struct { AppName string `yaml:"AppName"` Version string `yaml:"Version"` DebugOutput bool `yaml:"DebugOutput"` VerboseOutput bool `yaml:"VerboseOutput"` DevicesFile string `yaml:"DevicesFile"` Devices Devices DefaultImage Dimensions2d `yaml:"DefaultImage"` PixelMultiplier float64 `yaml:"PixelMultiplier"` HotasImagesDir string `yaml:"HotasImagesDir"` LogoImagesDir string `yaml:"LogoImagesDir"` JpgQuality int `yaml:"JpgQuality"` FontsDir string `yaml:"FontsDir"` InputFont string `yaml:"InputFont"` InputFontSize float64 `yaml:"InputFontSize"` InputMinFontSize int `yaml:"InputMinFontSize"` DefaultLineHeight int `yaml:"DefaultLineHeight"` InputPixelXInset float64 `yaml:"InputPixelXInset"` InputPixelYInset float64 `yaml:"InputPixelYInset"` ImageHeader HeaderData `yaml:"ImageHeader"` Watermark WatermarkData `yaml:"Watermark"` BackgroundColour string `yaml:"BackgroundColour"` LightColour string `yaml:"LightColour"` DarkColour string `yaml:"DarkColour"` AlternateColours []string `yaml:"AlternateColours"` }
Config contains all the configuration data for the app
type ContextToColours ¶
ContextToColours is a mapping of game contexts to colours that are used for visual grouping
func (ContextToColours) Keys ¶
func (m ContextToColours) Keys() []string
Keys returns a MockSet as an array
type DeviceInputTypeMapping ¶
type DeviceInputTypeMapping map[string]InputTypeMapping
DeviceInputTypeMapping contains a map of device short names to types of input maps (e.g. Slider, Axis, Rotaion)
type DeviceInputs ¶
DeviceInputs - structure of inputs for a device. input -> input data
type DeviceMap ¶
type DeviceMap map[string]DeviceInputs
DeviceMap - structure of devices. short name -> inputs
type DeviceNameFullToShort ¶
DeviceNameFullToShort maps game device full names to MetaRefCard short names
type Devices ¶
type Devices struct { GeneratedFile string `yaml:"GeneratedFile"` Index DeviceMap `yaml:"DeviceMap"` ImageMap ImageMap `yaml:"ImageMap"` DeviceToShortNameMap DeviceNameFullToShort `yaml:"DeviceNameMap"` DeviceLabelsByImage map[string]string `yaml:"DeviceLabelsByImage"` ImageSizeOverride map[string]Dimensions2d `yaml:"ImageSizeOverride"` // Device Name -> Dimensions2d }
Devices holds all the device related data
type Dimensions2d ¶
Dimensions2d contains width and height
type FuncMatchGameInputToModel ¶
type FuncMatchGameInputToModel func(deviceName string, actionData GameInput, deviceInputs DeviceInputs, gameInputMap InputTypeMapping, log *Logger) (GameInput, string)
FuncMatchGameInputToModel takes the game provided bindings with the device map to build a list of image overlays.
type FuncRequestHandler ¶
type FuncRequestHandler func(files [][]byte, config *Config, log *Logger) (GameData, GameBindsByProfile, Set, ContextToColours, string)
FuncRequestHandler - handles incoming requests and returns game data, game binds, neededDevices and a context to colour mapping
type GameBindsByProfile ¶
type GameBindsByProfile map[string]GameDeviceContextActions
GameBindsByProfile - Profile -> Short name -> Context -> Action -> Primary/Secondary -> Key
type GameContextActions ¶
type GameContextActions map[string]GameActions
GameContextActions - Context -> Action
type GameData ¶
type GameData struct { Logo string `yaml:"Logo"` Regexes map[string]string `yaml:"Regexes"` InputMap DeviceInputTypeMapping `yaml:"InputMap"` InputLabels map[string]string `yaml:"InputLabels"` }
GameData holds the game's parsed data
type GameDeviceContextActions ¶
type GameDeviceContextActions map[string]GameContextActions
GameDeviceContextActions - Short name -> Context -> Action -> Primary/Secondary -> Key
type GameInput ¶
type GameInput []string
GameInput - Array of inputs. Index of InputPrimary and InputSecondary
type GeneratedDevices ¶
type GeneratedDevices struct { Index DeviceMap `yaml:"DeviceMap"` ImageMap ImageMap `yaml:"ImageMap"` }
GeneratedDevices holds structure from the generated config
type HeaderData ¶
type HeaderData struct { Font string `yaml:"Font"` FontSize float64 `yaml:"FontSize"` Inset Point2d `yaml:"Inset"` TextHeight float64 `yaml:"TextHeight"` TextColour string `yaml:"TextColour"` BackgroundHeight float64 `yaml:"BackgroundHeight"` BackgroundColour string `yaml:"BackgroundColour"` }
HeaderData contains necessary data to generate header
type InputData ¶
type InputData struct { X int `yaml:"x"` // X location Y int `yaml:"y"` // Y location W int `yaml:"w"` // Width H int `yaml:"h"` // Height }
InputData - data relating to a given input
type InputTypeMapping ¶
type InputTypeMapping map[string]map[string]string // Device -> Type (Axis/Slider) -> axisInputMap/sliderInputMap
InputTypeMapping maps the type of input (e.g Slider, Axis, Rotation) to a map of game input to MetaRefCard input (e.g. X-Axis -> U-Axis)
type Logger ¶
type Logger []*LogEntry
Logger is a log utility to log to
type OverlayData ¶
OverlayData - data about what to put in overlay, grouping and location
type OverlaysByImage ¶
type OverlaysByImage map[string]map[string]OverlayData
OverlaysByImage - image overlay data indexed by image name Image -> Device:Input -> OverlayData
type OverlaysByProfile ¶
type OverlaysByProfile map[string]OverlaysByImage
OverlaysByProfile - image overlay object indexed by profile Profile -> OverlaysByImage
func PopulateImageOverlays ¶
func PopulateImageOverlays(neededDevices Set, config *Config, log *Logger, gameBindsByProfile GameBindsByProfile, gameData GameData, matchFunc FuncMatchGameInputToModel) OverlaysByProfile
PopulateImageOverlays returns a list of image overlays to put on device images
type RegexByName ¶
RegexByName - map of named regex strings
type WatermarkData ¶
type WatermarkData struct { Text string `yaml:"Text"` TextColour string `yaml:"TextColour"` BackgroundColour string `yaml:"BackgroundColour"` Font string `yaml:"Font"` FontSize float64 `yaml:"FontSize"` Location Point2d `yaml:"Location"` }
WatermarkData contains necessary data to generate watermark