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

Requesting a function to obtain the current viewport bounds #37

Closed
dashkal16 opened this issue Sep 19, 2017 · 9 comments
Closed

Requesting a function to obtain the current viewport bounds #37

dashkal16 opened this issue Sep 19, 2017 · 9 comments

Comments

@dashkal16
Copy link

It would be nice to have a way to obtain the 2d overlay bounds, so that UI can be scaled to the player's screen.

glasses.getOverlayBounds(user:string): number, number
Returns the maximal x and y coordinates for the given player.

This probably requires a client round-trip to actually query since the current screen size affects these values.

@ben-mkiv
Copy link
Collaborator

ben-mkiv commented Sep 20, 2017

isn't the resolution static and content is scaled anyways?

512 x 288 if i figured that out correct (while these are float values, not pixels!)

@dashkal16
Copy link
Author

I was getting different values when I resized my game window and tested again.
I tested by writing a quick event dump to capture mouse events, then clicking in the lower-right corner.

@ben-mkiv
Copy link
Collaborator

are you using some version <1.10.2?

@dashkal16
Copy link
Author

I am not: OpenGlasses-MC1.12.1-1.5.4.jar

@ben-mkiv
Copy link
Collaborator

please take a look on this bug, that might help you to actually convert the position the event triggers to the internal resolution of openglasses. but note that this actually is a workaround and could change in future releases: #36

@dashkal16
Copy link
Author

If that's the solution, then aside from needing the bounds (constants would be fine if the coords are to be fixed), that bug definitely needs a squash, because the mouse events for the overlay definitely vary with the screen size.

@ben-mkiv
Copy link
Collaborator

@marcin212 i would suggest to expose the internal resolution of 512/288 to the lua backend.

i would put it on my todo list if you agree with that.

@marcin212
Copy link
Contributor

marcin212 commented Sep 20, 2017

new event:
glasses_screen_size

@dashkal16
Copy link
Author

Much appreciated! I'll give that a poke next release :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants