2014-07-10 07:29:36 -04:00
|
|
|
// Copyright 2014 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package app
|
|
|
|
|
2014-11-10 08:55:57 +11:00
|
|
|
import "golang.org/x/mobile/event"
|
2014-09-11 19:39:16 -04:00
|
|
|
|
2014-09-09 19:51:04 -04:00
|
|
|
// Run starts the app.
|
|
|
|
//
|
|
|
|
// It must be called directly from from the main function and will
|
|
|
|
// block until the app exits.
|
|
|
|
func Run(cb Callbacks) {
|
|
|
|
run(cb)
|
2014-07-10 07:29:36 -04:00
|
|
|
}
|
2014-09-03 09:03:00 -04:00
|
|
|
|
2014-09-09 19:51:04 -04:00
|
|
|
// Callbacks is the set of functions called by the app.
|
|
|
|
type Callbacks struct {
|
|
|
|
// Draw is called by the render loop to draw the screen.
|
|
|
|
//
|
|
|
|
// Drawing is done into a framebuffer, which is then swapped onto the
|
|
|
|
// screen when Draw returns. It is called 60 times a second.
|
|
|
|
Draw func()
|
2014-09-11 19:39:16 -04:00
|
|
|
|
|
|
|
// Touch is called by the app when a touch event occurs.
|
|
|
|
Touch func(event.Touch)
|
2014-09-09 19:51:04 -04:00
|
|
|
}
|
2014-09-03 09:03:00 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
TODO(crawshaw): Implement.
|
|
|
|
var Start func()
|
|
|
|
var Stop func()
|
|
|
|
var Resume func()
|
|
|
|
var Pause func()
|
|
|
|
*/
|