Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/mobile/app: detect device orientation #10327

Open
rakyll opened this issue Apr 3, 2015 · 5 comments
Open

x/mobile/app: detect device orientation #10327

rakyll opened this issue Apr 3, 2015 · 5 comments
Assignees
Labels
mobile Android, iOS, and x/mobile
Milestone

Comments

@rakyll
Copy link
Contributor

rakyll commented Apr 3, 2015

A function that returns the device's current orientation would be handy to switch between portrait- and landscape-optimized user interfaces.

const (
   OrientationLandscape = iota
   OrientationPortrait
   // ...
)

func Orientation() int

Thoughts? cc/ @crawshaw @hyangah

@rakyll rakyll added this to the Go1.5 milestone Apr 3, 2015
@rakyll rakyll self-assigned this Apr 3, 2015
@hyangah
Copy link
Contributor

hyangah commented Apr 3, 2015

Agree it would be nice.
But I'm not sure whether it belongs to mobile/app (what's the boundary of 'app' package?)
or we need a separate package (something corresponds to UIDevice or WindowManager).

@rakyll
Copy link
Contributor Author

rakyll commented Apr 4, 2015

I would prefer to put it in window package. The device word restricts the functionality to the mobile devices.

@rsc rsc changed the title mobile/app: detect device orientation x/mobile/app: detect device orientation Apr 14, 2015
@rsc rsc removed the repo-mobile label Apr 14, 2015
@bonly
Copy link

bonly commented Apr 24, 2015

it is important to get the screen's size when developing with mobile game! plz

@rsc rsc modified the milestones: Unreleased, Go1.5 Apr 26, 2015
@gopherbot
Copy link

CL https://golang.org/cl/9708 mentions this issue.

crawshaw added a commit to golang/mobile that referenced this issue May 6, 2015
Config provides a way to concurrently access Width and Height.

Register provides a way for packages to run code on app state change
without plumbing changes all the way to the process main function.
This is motivated by gl/glutil.Image which needs to rebuild its
textures on start/stop and can be deeply nested.
(See golang.org/cl/9707 for the followup.)

Tested manually on android and darwin/amd64. Doing this kind makes it
clear any CL modifying this code needs a lot of manual testing right
now, so some kind of trybot support is something I'm going to
prioritise.

Fixes golang/go#10686
Fixes golang/go#10461
Fixes golang/go#10442
Fixes golang/go#10226
Updates golang/go#10327

Change-Id: I2882ebf3995b6ed857cda823e94fbb17c54b43a8
Reviewed-on: https://go-review.googlesource.com/9708
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
@rakyll
Copy link
Contributor Author

rakyll commented May 10, 2015

This is also critical when working with sensor data, e.g. screen rotates but the accelerometer sensor is in the same position. The values read should be interpreted differently depending on the orientation.

imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 10, 2021
Config provides a way to concurrently access Width and Height.

Register provides a way for packages to run code on app state change
without plumbing changes all the way to the process main function.
This is motivated by gl/glutil.Image which needs to rebuild its
textures on start/stop and can be deeply nested.
(See golang.org/cl/9707 for the followup.)

Tested manually on android and darwin/amd64. Doing this kind makes it
clear any CL modifying this code needs a lot of manual testing right
now, so some kind of trybot support is something I'm going to
prioritise.

Fixes golang/go#10686
Fixes golang/go#10461
Fixes golang/go#10442
Fixes golang/go#10226
Updates golang/go#10327

Change-Id: I2882ebf3995b6ed857cda823e94fbb17c54b43a8
Reviewed-on: https://go-review.googlesource.com/9708
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 11, 2021
Config provides a way to concurrently access Width and Height.

Register provides a way for packages to run code on app state change
without plumbing changes all the way to the process main function.
This is motivated by gl/glutil.Image which needs to rebuild its
textures on start/stop and can be deeply nested.
(See golang.org/cl/9707 for the followup.)

Tested manually on android and darwin/amd64. Doing this kind makes it
clear any CL modifying this code needs a lot of manual testing right
now, so some kind of trybot support is something I'm going to
prioritise.

Fixes golang/go#10686
Fixes golang/go#10461
Fixes golang/go#10442
Fixes golang/go#10226
Updates golang/go#10327

Change-Id: I2882ebf3995b6ed857cda823e94fbb17c54b43a8
Reviewed-on: https://go-review.googlesource.com/9708
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
@changkun changkun added the mobile Android, iOS, and x/mobile label Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mobile Android, iOS, and x/mobile
Projects
None yet
Development

No branches or pull requests

6 participants