diff --git a/run.go b/run.go index 355108aac..1505d164c 100644 --- a/run.go +++ b/run.go @@ -50,6 +50,8 @@ type Game interface { // // Layout is called almost every frame. // + // It is ensured that Layout is invoked before Update is called in the first frame. + // // If Layout returns non-positive numbers, the caller can panic. // // You can return a fixed screen size if you don't care, or you can also return a calculated screen size diff --git a/uicontext.go b/uicontext.go index de87e02fa..300c45e66 100644 --- a/uicontext.go +++ b/uicontext.go @@ -155,6 +155,8 @@ func (c *uiContext) Update() error { } func (c *uiContext) update() error { + c.updateOffscreen() + updateCount := clock.Update(MaxTPS()) // Ensure that Update is called once before Draw so that Update can be used for initialization. @@ -174,8 +176,6 @@ func (c *uiContext) update() error { uiDriver().ResetForFrame() } - c.updateOffscreen() - if updateCount > 0 { if IsScreenClearedEveryFrame() { c.offscreen.Clear()