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

Fix menu multiline strings #87

Closed
alandtse opened this issue Sep 10, 2023 · 3 comments · Fixed by #119
Closed

Fix menu multiline strings #87

alandtse opened this issue Sep 10, 2023 · 3 comments · Fixed by #119
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@alandtse
Copy link
Collaborator

Right now, the imgui menu handle multiline text by using multiple text fields. This actually is bad as it will break wrapping depending on window size.

ImGui::Text("The Shader Cache is the collection of compiled shaders which replace the vanilla shaders at runtime.");
ImGui::Text("Clearing the shader cache will mean that shaders are recompiled only when the game re-encounters them.");
ImGui::Text("This is only needed for hot-loading shaders for development purposes.");

The better solution is to change to a multiline text string. Note extra space at end after period. This will allow proper word wrapping.

ImGui::Text(
"The Shader Cache is the collection of compiled shaders which replace the vanilla shaders at runtime. " 
"Clearing the shader cache will mean that shaders are recompiled only when the game re-encounters them. "
"This is only needed for hot-loading shaders for development purposes."
);
@alandtse alandtse added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Sep 10, 2023
@rjwignar
Copy link
Contributor

rjwignar commented Oct 5, 2023

I would like to work on this issue.

I took a look at Menu.cpp and noticed there are some paragraphs where this has already been done, such as:

ImGui::Text(
"Hide or show the shader failure message. "
"Your installation is broken and will likely see errors in game. "
"Please double check you have updated all features and that your load order is correct. "
"See CommunityShaders.log for details and check the NexusMods page or Discord server. ");

and

ImGui::Text(
"Number of threads to use to compile shaders. "
"The more threads the faster compilation will finish but may make the system unresponsive. ");

I noticed in the above two snippets, the final sentences also have an extra space after the period, which isn't present in the multiline text string example provided:
image

Is the extra space also required in the last sentence for proper word wrapping?

@alandtse
Copy link
Collaborator Author

alandtse commented Oct 5, 2023

Awesome. No it's not required for the final string, it's just a habit. The reason it's required in the other strings is cpp will concatenate two strings together. So "This is" "a sentence" will end up as "This isa sentence".

@rjwignar
Copy link
Contributor

rjwignar commented Oct 5, 2023

I've added my changes to #119.
I modified the tooltips that use multiple text fields (tooltips for the Clear Shader Cache and Clear Disk Cache buttons).
I also modified the spacing in the Test Interval slider tooltip.

I noticed the following tooltips that were multi-sentenced but already in one text field, but did not modify them:

  • Enable Async checkbox tooltip
  • Dump Shaders checkbox tooltip
  • Log Level combo box tooltip
  • Shader Defines tooltip

I've made a note of these tooltips in the above Pull Request.

Should these tooltips also be modified?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants