Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(551)

Side by Side Diff: third_party/go/src/golang.org/x/mobile/app/doc.go

Issue 1275153002: Remove third_party/golang.org/x/mobile as it is no longer used with Go 1.5. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Remove golang.org/x/mobile Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 /*
6 Package app lets you write Apps for Android (and eventually, iOS).
7
8 There are two ways to use Go in an Android App. The first is as a
9 library called from Java, the second is to use a restricted set of
10 features but work entirely in Go.
11
12 Shared Library
13
14 A Go program can be compiled for Android as a shared library. JNI
15 methods can be implemented via cgo, or generated automatically with
16 gobind: http://golang.org/x/mobile/cmd/gobind
17
18 The library must include a package main and a main function that does
19 not return until the process exits. Libraries can be cross-compiled
20 using the Android NDK and the Go tool:
21
22 GOOS=android GOARCH=arm GOARM=7 CGO_ENABLED=1 \
23 go build -ldflags="-shared" .
24
25 See http://golang.org/x/mobile/example/libhello for an example of
26 calling into a Go shared library from a Java Android app.
27
28 Native App
29
30 An app can be written entirely in Go. This results in a significantly
31 simpler programming environment (and eventually, portability to iOS),
32 however only a very restricted set of Android APIs are available.
33
34 The provided interfaces are focused on games. It is expected that the
35 app will draw to the entire screen (via OpenGL, see the go.mobile/gl
36 package), and that none of the platform's screen management
37 infrastructure is exposed. On Android, this means a native app is
38 equivalent to a single Activity (in particular a NativeActivity) and
39 on iOS, a single UIWindow. Touch events will be accessible via this
40 package. When Android support is out of preview, all APIs supported by
41 the Android NDK will be exposed via a Go package.
42
43 See http://golang.org/x/mobile/example/sprite for an example app.
44
45 Lifecycle in Native Apps
46
47 App execution begins in platform-specific code. Early on in the app's
48 life, the Go runtime is initialized and the Go main function is called.
49 (For Android, this is in ANativeActivity_onCreate, for iOS,
50 application:willFinishLaunchingWithOptions.)
51
52 An app is expected to call the Run function in its main. When the main
53 function exits, the app exits.
54
55 package main
56
57 import (
58 "log"
59
60 "golang.org/x/mobile/app"
61 )
62
63 func main() {
64 app.Run(app.Callbacks{
65 Draw: draw,
66 })
67 }
68
69 func draw() {
70 log.Print("In draw loop, can call OpenGL.")
71 }
72
73 */
74 package app // import "golang.org/x/mobile/app"
OLDNEW
« no previous file with comments | « third_party/go/src/golang.org/x/mobile/app/desktop.go ('k') | third_party/go/src/golang.org/x/mobile/app/loop_android.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698