Added default style if style is not set on Run{,Wait}.
Exposed Resources in Context as well.
This commit is contained in:
parent
b78f215c8c
commit
e2472cffef
@ -12,6 +12,7 @@ type Context interface {
|
||||
Overlays() *Overlays
|
||||
Quit()
|
||||
Renderer() Renderer
|
||||
Resources() Resources
|
||||
ShowTooltip(t string)
|
||||
Style() *Style
|
||||
Textures() *Textures
|
||||
@ -71,6 +72,8 @@ func (c *context) Overlays() *Overlays { return c.overlays }
|
||||
|
||||
func (c *context) Renderer() Renderer { return c.renderer }
|
||||
|
||||
func (c *context) Resources() Resources { return c.renderer.Resources() }
|
||||
|
||||
func (c *context) ShowTooltip(t string) {
|
||||
c.tooltip.Text = t
|
||||
}
|
||||
|
3
ui/ui.go
3
ui/ui.go
@ -13,6 +13,9 @@ func Run(r Renderer, s *Style, view Control) error {
|
||||
|
||||
// RunWait runs the application loop and conditionally waits on events before rendering.
|
||||
func RunWait(r Renderer, s *Style, view Control, wait bool) error {
|
||||
if s == nil {
|
||||
s = DefaultStyle()
|
||||
}
|
||||
ctx := newContext(r, s, view)
|
||||
defer ctx.Destroy()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user