Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

Added the ability to configure pixels_per_point to allow for egui to properly scale the UI #13

Merged
merged 1 commit into from Sep 14, 2021

Conversation

jacobsky
Copy link
Collaborator

This should fix the issue with pixels per point not properly being set by the UI. This allows the individual control nodes to properly scale egui as needed.

Also made some minor changes to the function call of paint_shapes, since it is already using &mut self, rather than passing the texture into the method, the method queries for it directly.

Also added some additional widgets to the example to test the mouse position is correct regardless of the pixels_per_point setting.

Let me know if you have any questions about the changes.

@jacobsky
Copy link
Collaborator Author

Found an issue related to the input handling. when adding the conversion I removed the offset in the coordinates and didn't put it back. I'll work on fixing that.

@setzer22
Copy link
Owner

Looks good to me!

Something that may be a bit of a limitation is that I don't see a way to update the pixels_per_point at runtime though. The value is read at _ready and not set again.

Maybe we could add a set_pixels_per_point public method on GodotEgui so that it can be set programatically? This could be useful if the game has an options panel to control ui scale for accessibility

What do you think?

@jacobsky
Copy link
Collaborator Author

jacobsky commented Sep 14, 2021

Issue has been fixed as of bced470, this PR should be ready for review/merge

@jacobsky
Copy link
Collaborator Author

Looks good to me!

Something that may be a bit of a limitation is that I don't see a way to update the pixels_per_point at runtime though. The value is read at _ready and not set again.

Maybe we could add a set_pixels_per_point public method on GodotEgui so that it can be set programatically? This could be useful if the game has an options panel to control ui scale for accessibility

What do you think?

Ah, I hadn't considered that. I'll add that. I think that would make a lot of sense to allow to configure at runtime. Like you said, accessibility options are pretty important, especially when it comes to configuring text output.

…ositions.

Added a public setter for `GodotEgui` to allow user to set pixels_per_point at runtime (without having to directly access the egui_ctx).
@jacobsky
Copy link
Collaborator Author

@setzer22 I've added and tested the changes. I also included a fun little demo of the GUI actively resizing every frame to showcase it's usage.

@jacobsky jacobsky merged commit 134b8e7 into setzer22:main Sep 14, 2021
@jacobsky jacobsky deleted the pixels_per_point branch September 14, 2021 13:29
@jacobsky jacobsky added this to the 0.2.0 release milestone Sep 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants