package stone import "time" import "image/color" type Application struct { DamageBuffer title string backend Backend config Config } func (application *Application) SetSize (width, height int) { application.DamageBuffer.SetSize(width, height) // application.updateWindowSize() } func (application *Application) SetTitle (title string) { application.title = title application.backend.SetTitle(title) } func (application *Application) Run ( callback func (application *Application), ) ( err error, ) { // default values for certain parameters width, height := application.Size() if width < 1 { width = 80 } if height < 1 { height = 20 } application.DamageBuffer.SetSize(width, height) // TODO: load these from a file application.config.colors = [4]color.Color { color.RGBA { R: 0x2B, G: 0x30, B: 0x3C, A: 0xFF }, color.RGBA { R: 0x4C, G: 0x56, B: 0x6A, A: 0xFF }, color.RGBA { R: 0x2E, G: 0x34, B: 0x40, A: 0xFF }, color.RGBA { R: 0xA8, G: 0x55, B: 0x5D, A: 0xFF }, } application.config.padding = 4 application.backend, err = instantiateBackend(application) if err != nil { return } application.backend.Run(callback) return } func (application *Application) Await (timeout time.Duration) (keepRunning bool) { keepRunning = application.backend.Await(timeout) return } func (application *Application) Poll () (keepRunning bool) { keepRunning = application.backend.Poll() return } func (application *Application) Title () (title string) { title = application.title return } func (application *Application) Config () (config *Config) { config = &application.config return } func (application *Application) Resized () (resized bool) { resized = application.backend.Resized() return }