Refactor GuiRotationDial, AimLock rendering#2781
Draft
oznogon wants to merge 8 commits intodaid:masterfrom
Draft
Refactor GuiRotationDial, AimLock rendering#2781oznogon wants to merge 8 commits intodaid:masterfrom
oznogon wants to merge 8 commits intodaid:masterfrom
Conversation
- Workaround ambiguous resources.h includes in EmptyEpsilon/init/ by including SP's resources.h - Include vectorUtils.h in components/beamweapon.cpp to ensure that M_PI is available - Use _WIN32 instead of WIN32 in preprocessor ifdefs; MSVC 18 doesn't appear to define WIN32.
af4b70a to
6e7acac
Compare
Owner
|
It's a big of a visual shame to lose the rounded corners, this could potentially be fixed by rendering a (stretched) texture on the dial instead of a solid color. |
Contributor
Author
|
Since this uses EDIT: Like daid/SeriousProton#306 ? |
GuiRotationDial uses sprites for the handle and ring, which makes resizing it inflexible and requires replacing sprites to theme it. Use drawCircleOutline, triangle strips, and theme colors instead to allow the ring and handle to be more easily customized.
Allow defining optional textures for the GuiRotationDial handle (front) and ring (back). - Rename dial_background.png to RotationDialBackground.png per other widget PNG naming conventions, and reshade to white to take theme colors better. - Replace dial_button.png with new RotationDialHandle.png as a 9-segment stretched texture in white with rounded corners. - Use drawTexturedTriangleStrip to texture the handle, falling back to colored drawTriangleStrip if no texture is defined in the theme. - Update drawStretched call to apply a ring texture if present, falling back to colored drawCircleOutline.
5eb7b57 to
346831f
Compare
Contributor
Author
|
Refactored to use |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GuiRotationDialuses sprites for the handle and ring. This limits howGuiRotationDialcan be used, since resizing it also changes the width of the ring and size of the handle, and the handle's arc is fixed to 20 degrees, which happens to be the size of the default handle sprite.Instead of using sprites, draw a circle outline and use triangle strips for the handle, and apply theme colors for direct customization.
Correspondingly refactor
AimLock(the only use ofGuiRotationDial) to remove its redundant rendering logic, move its radar rotation offset handling toGuiRotationDial, and fix the headers of the screens that useAimLockandAimLockButtonto correctly declare their classes. The default ring thickness, which is now configurable, is also reduced to 1/10 of the radius instead of about 1/8 to avoid hiding heading tigs.Before (right) and after: