The former Reader inspired APIs were designed to timeout if no events
occur after an excessive amount of time. As we switch to the app
event based model, timing out is not required. We can block on
pollAll forever until new events arrive.
Change-Id: I086fc908ebfe6ae9bd96ce9199636ad0242bbec5
Reviewed-on: https://go-review.googlesource.com/14223
Reviewed-by: Nigel Tao <nigeltao@golang.org>
The CL provides accelerometer events only, upcoming CLs will add
support for gyroscope and magnetometer.
Change-Id: Ib5629ca7c49c9dfc8ca533fe7acde371efc102b2
Reviewed-on: https://go-review.googlesource.com/14036
Reviewed-by: Nigel Tao <nigeltao@golang.org>
We are also limiting the number of sensor managers to one.
The application provide sensor events to third-party packages
by consuming them in the main.
An application will be able to consume the sensor events similar
to the other events.
package main
func main() {
app.Main(func(a app.App) {
// enables the accelerometer
sensor.Enable(a, sensor.Accelerometer, 100*time.Millisecond)
var sz size.Event
for e := range a.Events() {
switch e := app.Filter(e).(type) {
case sensor.Event:
log.Println(e)
}
}
})
}
Change-Id: Iaad1c59f8d2322c7620df62ed9b9283c91746fa8
Reviewed-on: https://go-review.googlesource.com/13983
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Also remove an unnecessary constant type conversion.
Change-Id: Iff466553fac450bd531785f4fb4e2be97a991a52
Reviewed-on: https://go-review.googlesource.com/13715
Reviewed-by: Burcu Dogan <jbd@google.com>
Hoping to learn more so I can debug or replicate the darwin/amd64
builder failure, which is not creating a GL context.
Change-Id: I9f2fe54fbd9a072c65cd37c3b711554d4c71171f
Reviewed-on: https://go-review.googlesource.com/13693
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
There is no way to distinguish an unknown format from
Mono8 because Mono8 is zero. The current CL fixes this
issue by starting the format constants from iota + 1.
Change-Id: I8c709cdaff3bc46bcc15ab770cfcfd04c186034d
Reviewed-on: https://go-review.googlesource.com/12386
Reviewed-by: Burcu Dogan <jbd@google.com>
Embedding is more trouble than it's worth. For example, the image/draw
package will pick the slow code paths for an embedded *image.RGBA.
Change-Id: I64bd20a80814b838850950c05dd8257e5901aef7
Reviewed-on: https://go-review.googlesource.com/12567
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This is done by moving app.Context to internal/mobileinit,
introducing mobileinit.SetCurrentContext and,
making bind/java depend on it.
TODO: check gomobile bind's proguard rule - context lookup
was implemented through reflection on android.app.AppGlobals class.
Change-Id: Ieb6ad503eeef8c2c1c5836a21c667938c5a701a2
Reviewed-on: https://go-review.googlesource.com/12279
Reviewed-by: David Crawshaw <crawshaw@golang.org>
There is currently one usage of "an" prior to "PCM". The indefinite
article usage prior to an acronym is determined by the
pronunciation of that acronym's first letter. If the pronunciation
starts with a consonant, "a" is used. If the pronunciation starts
with a vowel, "an" is used.
Usage
https://en.wikipedia.org/wiki/Pulse-code_modulation
Note that there is currently a correct usage in the same file on a
different line: "a PCM header"
Change-Id: Id7749d20722a5cc9b96ecfe466be66fe3c76ab2b
Reviewed-on: https://go-review.googlesource.com/12083
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This CL reverts the changes made in golang/go#11299.
Allowing creation of multiple contexts break the case of multiple
third party packages depending on the al bindings. These packages
need to make sure that there is a valid current context or initiate
and make a context current. Packages racing to create and make a
context current is what we would like to avoid.
Therefore, al bindings will support only a single context that is
initiated during OpenDevice.
Fixesgolang/go#11385.
Change-Id: I662f70e49d12833a545005cf0724cc21f67bea09
Reviewed-on: https://go-review.googlesource.com/12001
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Ever since we moved to a bitmap font instead of using freetype, the backing
image's dimensions are 43x9, not 50x12, and we might as well match. For
example, the output will be exactly 43x9 pixels at 72DPI, or 86x18 pixels at
144DPI, etc.
Change-Id: I99975cc780760b28b73fbf6d55befbe500f1a6e1
Reviewed-on: https://go-review.googlesource.com/11880
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
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>
Change-Id: Id71acfeb605995d8caf947d996a1375335410e08
Reviewed-on: https://go-review.googlesource.com/11668
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
This CL is a followup of CL/11315 where it is suggested to remove
Context pointer types from the signatures.
Change-Id: Ice68bfabad0e345f7d93102257a99402be8760b5
Reviewed-on: https://go-review.googlesource.com/11560
Reviewed-by: Nigel Tao <nigeltao@golang.org>
This means that there's only one adb log prefix that Go app developers
need to watch: GoLog.
Change-Id: I562566b92a7bba19f7c7a9cc71315bea02844db1
Reviewed-on: https://go-review.googlesource.com/11609
Reviewed-by: Burcu Dogan <jbd@google.com>
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>
The test was broken with the foo -> exp/foo move.
Change-Id: Ie2bdf54f6da0365d2e0332bcacdd2b7a000c950c
Reviewed-on: https://go-review.googlesource.com/11392
Reviewed-by: David Crawshaw <crawshaw@golang.org>