Documentation ¶
Index ¶
Constants ¶
const ( ScreenWidth = 160 ScreenHeight = 144 )
const ( // DefaultConfigDir is the base folder where to store the emulator's config // file and subfolders for saves/screenshots. DefaultConfigDir = "~/.goholint/" // DefaultConfigPath is the path to our config file in the user's home. DefaultConfigPath = DefaultConfigDir + "config.ini" // DefaultConfig contains a reasonable default config.ini that's used // automatically if no config exists at run time // // TODO: template using our real default values? DefaultConfig = `` /* 2306-byte string literal not displayed */ )
const ( // Arbitrary default colors that looked good on my screen. Kinda greenish. ColorWhiteRGB = 0xe0f0e7 ColorLightGrayRGB = 0x8ba394 ColorDarkGrayRGB = 0x55645a ColorBlackRGB = 0x343d37 ColorWhiteR = (ColorWhiteRGB >> 16) & 0xff ColorWhiteG = (ColorWhiteRGB >> 8) & 0xff ColorWhiteB = ColorWhiteRGB & 0xff ColorLightGrayR = (ColorLightGrayRGB >> 16) & 0xff ColorLightGrayG = (ColorLightGrayRGB >> 16) & 0xff ColorLightGrayB = ColorLightGrayRGB & 0xff ColorDarkGrayR = (ColorDarkGrayRGB >> 16) & 0xff ColorDarkGrayG = (ColorDarkGrayRGB >> 16) & 0xff ColorDarkGrayB = ColorDarkGrayRGB & 0xff ColorBlackR = (ColorBlackRGB >> 16) & 0xff ColorBlackG = (ColorBlackRGB >> 16) & 0xff ColorBlackB = ColorBlackRGB & 0xff )
Default palette colors with separate RGB components for easier use with SDL API.
const DateFormat = "2006-01-02-15-04-05.000"
DateFormat layout for generated file names.
const ModMask = sdl.KMOD_CTRL | sdl.KMOD_SHIFT
ModMask only keeps the keyboard modifiers we allow in keymaps.
Variables ¶
var ColorBlack = color.RGBA{ColorBlackR, ColorBlackG, ColorBlackB, 0xff}
var ColorDarkGray = color.RGBA{ColorDarkGrayR, ColorDarkGrayG, ColorDarkGrayB, 0xff}
var ColorLightGray = color.RGBA{ColorLightGrayR, ColorLightGrayG, ColorLightGrayB, 0xff}
var ColorWhite = color.RGBA{ColorWhiteR, ColorWhiteG, ColorWhiteB, 0xff}
var DefaultKeymap = Keymap{ "up": KeyStroke{Code: sdl.K_UP}, "down": KeyStroke{Code: sdl.K_DOWN}, "left": KeyStroke{Code: sdl.K_LEFT}, "right": KeyStroke{Code: sdl.K_RIGHT}, "a": KeyStroke{Code: sdl.K_s}, "b": KeyStroke{Code: sdl.K_d}, "select": KeyStroke{Code: sdl.K_BACKSPACE}, "start": KeyStroke{Code: sdl.K_RETURN}, "screenshot": KeyStroke{Code: sdl.K_F12}, "recordgif": KeyStroke{Code: sdl.K_g}, "nextpalette": KeyStroke{Code: sdl.K_PAGEDOWN}, "previouspalette": KeyStroke{Code: sdl.K_PAGEUP}, "togglevoice1": KeyStroke{Code: sdl.K_1}, "togglevoice2": KeyStroke{Code: sdl.K_2}, "togglevoice3": KeyStroke{Code: sdl.K_3}, "togglevoice4": KeyStroke{Code: sdl.K_4}, "quit": KeyStroke{Code: sdl.K_q, Mod: sdl.KMOD_LCTRL}, "home": KeyStroke{Code: sdl.K_ESCAPE}, }
DefaultKeymap is a reasonable default mapping for QWERTY/AZERTY layouts.
var DefaultPalette = []color.RGBA{ ColorWhite, ColorLightGray, ColorDarkGray, ColorBlack, }
DefaultPalette represents the selectable colors in the DMG.
var DefaultUIBackground = color.RGBA{0x00, 0x00, 0x00, 0xff}
Default UI colors. Black text, white outline.
var DefaultUIForeground = color.RGBA{0xff, 0xff, 0xff, 0xff}
Functions ¶
func CreateFileIn ¶
CreateFileIn creates a new file with the requested suffix (which can be only an extension, a timestamp + an extension, etc) in the requested subfolder. The folder will be created under the configuration path if it doesn't already exist.
Returns an open file or an error.
Types ¶
type Options ¶
type Options struct { BootROM string // -boot <path> CPUProfile string // -cpuprofile <path> DebugLevel string // -level <debug level> DebugModules module // -debug <module> Duration uint // -cycles <amount> FastBoot bool // -fastboot GIFPath string // -gif <path> Keymap Keymap // From config. Mono bool // -mono Palettes [][]color.RGBA // From config. PaletteNames []string // From config, same order. ROMPath string // -rom <path> SavePath string // -save <full path> UIBackground color.RGBA // From config. UIForeground color.RGBA // From config. VSync bool // -vsync WaitKey bool // -waitkey ZoomFactor uint // -zoom <factor> }
Options structure grouping command line flags and config file values.