2
0
mirror of synced 2025-02-23 14:58:12 +00:00

53 Commits

Author SHA1 Message Date
Hyang-Ah (Hana) Kim
b3bd3d29aa example: limit examples build to linux or darwin.
windows and other non-mobile os support is not there yet.

Change-Id: Ie9c456b646bfa0b0c489e1b6344b5afca4801c5f
Reviewed-on: https://go-review.googlesource.com/12744
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-28 16:32:30 +00:00
Nigel Tao
cdc5281044 event/config: specify width and height in both pixels and points.
Change-Id: I494c17b2bad6c920ea20b22046d1d3fbc7b6b1d4
Reviewed-on: https://go-review.googlesource.com/12700
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-28 01:48:05 +00:00
Florin Patan
6256dc3e64 example/network: use correct app event filter
This change allows the example/network from gomobile to compile
correctly.

Change-Id: Id0f722796e0224ec4a7c06b163a25a4f3a5fbcb3
Reviewed-on: https://go-review.googlesource.com/12471
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-21 14:54:22 +00:00
Jae Kwon
96f72abd68 cmd/gomobile: expect GoNativeActivity in external manifests
gomobile expects GoNativeActivity, otherwise current_ctx_clazz stays
null.
Fixed cmd/gomobile/manifest.go to expect GoNativeActivity, and fixed the
network example app.

Change-Id: Idad6f9bec2fcbc876fbd6013009582868ad3e133
Reviewed-on: https://go-review.googlesource.com/12374
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-18 02:39:09 +00:00
Hyang-Ah (Hana) Kim
32ad533813 example/audio: use the latest config.Event in arranger func.
Change-Id: I452e9e7e37a983421acac23ab265b822fbc3db19
Reviewed-on: https://go-review.googlesource.com/12339
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-17 19:53:07 +00:00
David Crawshaw
c8a8acd495 example/sprite: move to events
Change-Id: I5f5b2aee9edebc7b50ee98e23da5f0fa7e06112d
Reviewed-on: https://go-review.googlesource.com/12335
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-17 17:57:13 +00:00
David Crawshaw
3ee73d9a25 example/audio: move to events
Change-Id: Ib6971e48abfa16b995d815ab37077c83940b9096
Reviewed-on: https://go-review.googlesource.com/12336
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-17 17:42:28 +00:00
Nigel Tao
84f8e5edcc event: move event.Filter to app.Filter.
Change-Id: I11044a6e01b53e441c05fc1baec36718e783622f
Reviewed-on: https://go-review.googlesource.com/12288
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-17 01:18:36 +00:00
David Crawshaw
c6888a7bae example/network: rewrite to use event loop
Change-Id: Ibcf8fa9aec7327e98d4a0cdb5c37bb39bcc41bf8
Reviewed-on: https://go-review.googlesource.com/12278
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-16 20:19:15 +00:00
Nigel Tao
b43065626f app: rename EndDraw to EndPaint.
Change-Id: I3e38df0e21be2246dd16886fa00c9360d42db145
Reviewed-on: https://go-review.googlesource.com/12282
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-16 03:33:11 +00:00
David Crawshaw
460bd28e6c example/basic: rewrite to use event loop
Change-Id: Ic7d8557c42b17238f3dae7fc9287a7cdb5f55eb1
Reviewed-on: https://go-review.googlesource.com/12272
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-07-16 03:17:43 +00:00
Nigel Tao
e4c6af17e3 event: rename event.Foo to foo.Event.
Fixes golang/go#10444

Change-Id: Ie5a8ab8a09b1b1a4f7037da7cf945d39ab6a98fc
Reviewed-on: https://go-review.googlesource.com/12225
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-16 01:03:51 +00:00
Hyang-Ah (Hana) Kim
c68947979f example/network: a simple example to show AndroidManifest customization
Change-Id: I558925eca6be12772726cfff96b48fd4c6bbc303
Reviewed-on: https://go-review.googlesource.com/11892
Reviewed-by: Burcu Dogan <jbd@google.com>
2015-07-09 17:52:27 +00:00
Nigel Tao
467d8559f2 f32: move to exp/f32.
In the long term, a lot of this package should be removed in favor of the
golang.org/x/image/math/f32 package. The latter is the common location for
matrix types shared across graphics libraries. For example, the
golang.org/x/image/draw package refers to golang.org/x/image/math/f64.

Change-Id: I9d7ccd3cb35912e0d9dc5bd46c919516ea840340
Reviewed-on: https://go-review.googlesource.com/11856
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-03 01:37:12 +00:00
Nigel Tao
bd8fa0d7bb gl/glutil: move to exp/gl/glutil.
Change-Id: I310c365300cb3fbf8a1abb630e26661fa7ef4844
Reviewed-on: https://go-review.googlesource.com/11824
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-07-01 11:41:50 +00:00
Nigel Tao
c7c93d6952 app/debug: move to exp/app/debug.
Change-Id: I97f3585ff155e8c5b95c5bb32cfa793980c81a9a
Reviewed-on: https://go-review.googlesource.com/11821
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-30 23:41:11 +00:00
David Crawshaw
8bb4ca139b asset: move app.Open to its own package
This does not break the dependency on the app package's AndroidContext
for loading assets on android. A potential answer for gobind-based
apps: add a SetAndroidContext method to app.Context. But I'll explore
that separately after the long weekend.

Change-Id: I812f899740e288c379eee7900f42d9d53926d4ce
Reviewed-on: https://go-review.googlesource.com/11675
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-29 21:49:28 +00:00
David Crawshaw
8144405762 app, bind: separate the app package from gobind
Historically, the app package implemented Go runtime initialization.
This was convoluted, so the package was used both by all-Go apps
(currently based on Android's NativeActivity) and bind-based apps.

With Go 1.5 we have -buildmode=c-shared, which does a lot of the work
of the old app package. That code was removed a while back, but both
all-Go and gobind-based apps still used package app. The intermingled
initialization processes led to some strange states.

This CL separates gobind-based apps completely from the app package.
As part of that users are now expected to use System.loadLibrary
themselves. (A future CL may want to make the loadLibrary call part
of the .aar generated by gomobile bind.)

Delete the libhello example, which has been replaced by gomobile bind,
which could do with its own example at some point. Also delete the
libhellojni example, which now has nothing to do with the x/mobile
repository.

Change-Id: I444397f246dbafe81e5c53532eb482c197d26f70
Reviewed-on: https://go-review.googlesource.com/11654
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-06-29 11:40:40 +00:00
Nigel Tao
42f0d17876 app: use one thread for both GL and other UI C code.
This change will break Darwin. I have only built and tested this on
desktop linux and Android linux. A follow-up CL will fix Darwin.

Currently, OpenGL gets its own thread, and UI C code (e.g. the Android
event loop, or the X11 event loop) gets its own thread. This relies on
multiple system-provided UI-related C libraries working nicely together,
even when running on different threads. Keeping all the C code on the
one thread seems more sound.

As side-effects:
  - In package app/debug, DrawFPS now takes an explicit Config.
  - In package app, some callbacks now take an explicit Config.
  - In package exp/sprite, Render now takes an explicit Config.
  - In package event, there are new events (Config, Draw, Lifecycle),
    and an event filter mechanism to replace multiple app Callbacks.
  - In package geom, the deprecated Width, Height and PixelsPerPt global
    variables were removed in favor of an event.Config that is
    explicitly passed around (and does not require mutex-locking).
    Converting a geom.Pt to pixels now requires passing a pixelsPerPt.
  - In package gl, the Do, Start and Stop functions are removed, as well
    as the need to call Start in its own goroutine. There is no longer a
    separate GL thread. Instead, package app explicitly performs any GL
    work (gl.DoWork) when some is available (gl.WorkAvailable).
  - In package gl/glutil, Image.Draw now takes an explicit Config.

Callbacks are no longer executed on 'the UI thread'.

Changing the app programming model from callbacks to events (since a
channel of events works with select) will be a follow-up change.

Change-Id: Id9865cd9ee1c45a98c613e9021a63c17226a64b1
Reviewed-on: https://go-review.googlesource.com/11351
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-26 07:43:17 +00:00
Nigel Tao
96bcad7e98 example/audio: delete obsolete TODO.
Change-Id: I6245a48a45fd1631550bb4102734a41e06fafcba
Reviewed-on: https://go-review.googlesource.com/11471
Reviewed-by: Burcu Dogan <jbd@google.com>
2015-06-25 00:36:49 +00:00
Burcu Dogan
1d641b5393 audio: move to exp/audio
Change-Id: I8640b1a38a292972db6dd00506e38c89470b2c15
Reviewed-on: https://go-review.googlesource.com/11311
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-06-21 18:18:56 +00:00
Nigel Tao
c0c696a96d sprite: move to exp/sprite.
Change-Id: Idfdc0c192d7e6d50e1063b2eb582bbe05294643a
Reviewed-on: https://go-review.googlesource.com/11230
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-21 03:08:52 +00:00
Burcu Dogan
e33b2cee97 mobile/audio: determine the format and sample rate from the WAV format
Change-Id: Ieca37d7785e0608160728716654ceb6650799f3e
Reviewed-on: https://go-review.googlesource.com/9874
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-05-08 15:51:42 +00:00
Burcu Dogan
d861c4af68 mobile/audio: rename (*Player).Destroy to (*Player).Close
Destroy sounds like C, we should use Close in Go.

Change-Id: I73da732300a955e458513f15ad898b7f34c8ed7c
Reviewed-on: https://go-review.googlesource.com/9875
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-05-08 04:27:49 +00:00
Burcu Dogan
cf8de59746 example/audio: add sample audio app
This app makes a sound as the gopher hits the edges of the screen.

Change-Id: I85c7d55ec88b1a9faec5dfb7b29e03d1149f5d65
Reviewed-on: https://go-review.googlesource.com/9698
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-05-07 01:05:33 +00:00
Burcu Dogan
88e68e02f0 example/basic,example/sprite: give a reference to gomobile installation
Removing the duplicate installation instructions and giving a reference
to the gomobile godoc.

Change-Id: I476e4a4f4545eeb17d9ba18f471076d63c1f15d1
Reviewed-on: https://go-review.googlesource.com/9631
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-05-01 20:58:37 +00:00
Burcu Dogan
1cb3b97c74 example/sprite: switch to gomobile build
Fixes #10523.

Change-Id: Ic0bf345624f6584757e2af5cb91a679827ee3b13
Reviewed-on: https://go-review.googlesource.com/9340
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-04-25 00:22:47 +00:00
Burcu Dogan
717c2c4312 example/basic: add build instructions for gomobile
This CL also removes Android build system required files and keeping
it to the bare minimum to what gomobile requires.

Fixes #10523.

Change-Id: Iabf16e7ea040a74eaf64746e7cc4e23ef3683af2
Reviewed-on: https://go-review.googlesource.com/9204
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-04-24 23:59:43 +00:00
Dmitri Shuralyov
eaba00bca5 gl: use better spec-defined func names, fix bug, increase consistency
Change func names and parameter order to more closely follow OpenGL
ES/WebGL spec.
    BufferData(target, usage, src) -> BufferData(target, src, usage)
    GenBuffer -> CreateBuffer
    GenFramebuffer -> CreateFramebuffer
    GenRenderbuffer -> CreateRenderbuffer
    GenTexture -> CreateTexture
Fix issue where glBoolean helper was returning inverted result.
Make Attrib.String() logic consistent with others (print value, not
struct).
Make internal code of GetUniformLocation the same as GetAttribLocation
and BindAttribLocation for consistency.
Resolves golang/go#10218.

Change-Id: Ib33dfff7c22c4d178b2e6b8d228f80f3c17308a8
Reviewed-on: https://go-review.googlesource.com/8000
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-25 21:38:11 +00:00
Hyang-Ah Hana Kim
e3048a987d example/libhello: update main.go to initiate java.Init.
changes required after golang.org/cl/5555

Change-Id: If355dcfa0edfdc204eac4e89837927ab9a978b65
Reviewed-on: https://go-review.googlesource.com/5651
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-23 21:57:36 +00:00
Daniel Ortiz Pereira da Silva
696db895ff example/sprite: make example lives
Add necessary files to build and run example/sprite.
Change main.go to get image from assets.

Change-Id: Ic3065aab97f59c34f2c0446ab4b46840305b5864
Reviewed-on: https://go-review.googlesource.com/1882
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2014-12-22 13:10:48 +00:00
Daniel Ortiz Pereira da Silva
9c997eaee4 example: add windows batch files
Add windows batch files to build and run examples

Change-Id: I9102ceb5c47f692730a8b024648b1d10ff49b624
Reviewed-on: https://go-review.googlesource.com/1622
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2014-12-22 13:10:26 +00:00
David Crawshaw
1aa04cf038 app: Start and Stop callbacks
Change-Id: If8ea6aaf2fb2c62eaf4119526a8bb46b8a84b982
Reviewed-on: https://go-review.googlesource.com/1881
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2014-12-19 19:01:54 +00:00
David Crawshaw
96c0ef1480 all: update docs to remove code.google.com
Fixes golang/go#9259.

Change-Id: I4768ce0a2abc56100e6616bacdf6aad196639b10
Reviewed-on: https://go-review.googlesource.com/1370
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2014-12-11 14:15:30 +00:00
Hana (Hyang-Ah) Kim
969a1bf7dd example/libhellojni: fix build and allow go get golang.org/x/mobile/...
Change-Id: Id0cd58705c882ea58cedbee5a6e9aff010c0ad4d
Reviewed-on: https://go-review.googlesource.com/1281
Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-12-10 01:38:44 +00:00
David Crawshaw
0274bdc8dd x/mobile/example/gopher: remove example
Moved to github.com/crawshaw/gopher3d for now, to simplify
the licensing story for the go.mobile subprepository.

LGTM=hyangah
R=hyangah
CC=golang-codereviews
https://golang.org/cl/182550043
2014-12-05 14:50:40 -05:00
David Crawshaw
fb724b9af0 go.mobile/example/libhello: remove superfluous ln
LGTM=hpw
R=golang-codereviews, hyangah, hpw
CC=golang-codereviews
https://golang.org/cl/139600043
2014-11-20 13:35:41 -05:00
David Crawshaw
0df569094b x/mobile/example/sprite: use SubTex in example
Fixes golang/go#9107

LGTM=nigeltao
R=nigeltao
CC=golang-codereviews, yliu
https://golang.org/cl/177800043
2014-11-16 09:59:23 -05:00
Nigel Tao
86c05e810c go.mobile/sprite/glsprite: first cut of a glsprite Engine.
Also add the example/sprite program.

LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/170270043
2014-11-11 09:39:37 +11:00
Hana Kim
32f2370535 go.mobile/bind: include the bind invocation command in generated files.
This change also updates bind/testdata/*.golden.

LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/167160043
2014-11-10 13:46:47 -05:00
Andrew Gerrand
9470e0ba58 go.mobile: use golang.org/x/... import paths
LGTM=bradfitz, rsc
R=rsc, bradfitz
CC=golang-codereviews
https://golang.org/cl/162710043
2014-11-10 08:55:57 +11:00
Hana Kim
c2dd086961 go.mobile/example/libhello: fix typo.
LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/172740043
2014-11-05 14:00:48 -05:00
Nigel Tao
2457abfa93 go.mobile/f32: add a f32.Bytes function.
LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/166720044
2014-10-29 09:19:38 +11:00
Nigel Tao
f458564116 go.mobile/example/basic: strip the "core" from the shaders'
"# version 100 core", as Ubuntu 14.04's OpenGLES doesn't like it:
"shader compile: 0:1(10): error: illegal text following version number"

LGTM=adg, crawshaw
R=crawshaw, bryanturley, adg
CC=golang-codereviews
https://golang.org/cl/163260043
2014-10-28 12:08:26 +11:00
David Crawshaw
12badfbcea go.mobile/example/basic: fix build
LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/145470043
2014-09-29 05:17:34 +10:00
David Crawshaw
8439ecbf6b go.mobile/example/gopher: import generated gopher data
As you can't see it in the review tool, there is a copyright
notice in gopher.obj:

The Go gopher was designed by Renee French. (http://reneefrench.blogspot.com/)
The gopher 3D model was made by Takuya Ueda (http://u.hinoichi.net).
Licensed under the Creative Commons 3.0 Attributions license.

Model from http://github.com/golang-samples/gopher-3d

LGTM=adg, nigeltao
R=nigeltao, adg, bryanturley
CC=davidday, golang-codereviews
https://golang.org/cl/143840044
2014-09-17 18:38:43 -04:00
David Crawshaw
400bc443a2 go.mobile/example/gopher: parse wavefront obj file
LGTM=nigeltao
R=nigeltao, adg
CC=davidday, golang-codereviews
https://golang.org/cl/139510043
2014-09-17 18:35:56 -04:00
David Crawshaw
7dcf08fb02 go.mobile/example/libhello: make example self-contained
This example now uses the pre-L build system.
A gradle-based example will follow as soon as
I am testing on Android L devices.

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/143900043
2014-09-12 10:54:02 -04:00
David Crawshaw
3fd6804d3e go.mobile/example/basic: respond to touch events
LGTM=nigeltao
R=nigeltao
CC=adg, bryanturley, davidday, golang-codereviews
https://golang.org/cl/139440043
2014-09-11 19:14:12 -04:00
David Crawshaw
f3dc0a9c65 go.mobile/example/basic: app that draws a triangle
This is the first example of an App written entirely in Go that
draws to the device screen. Build and run process is driven
entirely by all.bash, no need for the Android Studio button
mashing in the lib* examples.

LGTM=nigeltao
R=golang-codereviews, nigeltao, bryanturley
CC=golang-codereviews
https://golang.org/cl/130420043
2014-09-09 20:25:47 -04:00