6711: Improve color picker popup in settings (use new popup system, add alpha support, support mouse locking) r=def- a=Robyt3
Use the popup system ported from the editor to reimplement the color picker popup.
- Before:
![screenshot_2023-06-05_21-57-46](https://github.com/ddnet/ddnet/assets/23437060/52d6adfa-7d62-4323-b6df-8d18a26b6cc6)
- After:
![screenshot_2023-06-05_21-57-26](https://github.com/ddnet/ddnet/assets/23437060/773115db-178c-48ab-a750-35b136a4fb30)
Remove special handling necessary for the hard-coded color picker.
Add alpha support to the color picker popup.
Support locking mouse position when dragging value selectors also in menus (color pickers), which improves usability of value selectors. Previously this was only supported in the editor.
Replace large HSLA scrollbar color picker for UI color setting with inline color picker popup:
- Before:
![screenshot_2023-06-05_21-57-57](https://github.com/ddnet/ddnet/assets/23437060/bb6cee4d-5438-40a3-b602-90abccc959ee)
- After:
![screenshot_2023-06-05_21-57-01](https://github.com/ddnet/ddnet/assets/23437060/e0a565a6-2956-403f-9fc0-4ab11a764400)
## Checklist
- [X] Tested the change ingame
- [X] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)
6712: Fix crash when enabling `dbg_dummies` on running server r=def- a=Robyt3
The server normally needs to be reloaded to spawn the debug dummies, so this code was not checking if a debug dummy player exists. Decreasing the number of debug dummies while the server is running also causes them to simply not be snapped instead of completely destroying them.
For debugging any number of dummies can be useful, so the maximum number of debug dummies is increased to the maximum number of clients.
See #6702.
## Checklist
- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [X] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)
Co-authored-by: Robert Müller <robytemueller@gmail.com>
Use the popup system ported from the editor to reimplement the color picker popup.
Remove special handling necessary for the hard-coded color picker.
Add alpha support to the color picker popup.
Support locking mouse position when dragging value selectors also in menus (color pickers), which improves usability of value selectors.
Previously this was only supported in the editor.
When enabling locked mouse a UI element ID must be specified. The mouse lock is stopped when this element is no longer active. This ensures that the mouse doesn't gets stuck in this state when the value selector isn't active anymore.
The server normally needs to be reloaded to spawn the debug dummies, so this code was not checking if a debug dummy player exists. Decreasing the number of debug dummies while the server is running also causes them to simply not be snapped instead of completely destroying them.
Set input string if it's not identical to the real input string instead of comparing to the display string, which would be incorrect for hidden number inputs.
It was incorrectly checked for `UIElement.Rect(0)->m_Y != pRect->h`, so any UI rect using `m_HintCanChangePositionOrSize` would be updated every frame (although, no UI element currently uses this hint).
Additionally, checks for changed rounding size and corners are added so UI elements are updated when those are changed.
6703: Only highlight hovered edit boxes when they are the hot item r=def- a=Robyt3
Prevent highlighting when edit box hovered but behind a popup menu.
## Checklist
- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)
6704: Extract `CMenus::UpdateColors` and `CUI::DebugRender` functions to improve readability of `CMenus::OnRender` r=def- a=Robyt3
## Checklist
- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)
Co-authored-by: Robert Müller <robytemueller@gmail.com>
6684: Make server settings editor height adjustable by dragging r=heinrich5991 a=Robyt3
Same as for the envelope editor. Extract `RenderExtraEditorDragBar` function to reduce duplicate code.
Fix height being changed by repeated clicking on the draggable element by also resetting `s_Operation` when `Clicked` is `true`.
## Checklist
- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)
6685: Support dragging demo player controls to move them, fix minor related issues r=heinrich5991 a=Robyt3
Allow dragging the demo player controls anywhere on the screen. The controls can't be moved outside of the screen. Round corners are automatically disabled when the controls are on the edge of the screen.
https://github.com/ddnet/ddnet/assets/23437060/72510c1f-4fd2-426b-a631-3a78db5f7b8b
## Checklist
- [X] Tested the change ingame
- [X] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)
6699: Add dragger prediction r=def- a=trml
..for servers with the new ddnetlaser. Tested this locally and on Fun server, and seems to work.
Also adjusted the criteria for when to send the original dragger id slightly, to improve prediction in some edge cases when going through solo/unsolo while being dragged.
## Checklist
- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)
Co-authored-by: Robert Müller <robytemueller@gmail.com>
Co-authored-by: trml <trml@users.noreply.github.com>
6695: Improve snapping of draggers r=def- a=trml
These are some things i noticed could be improved while attempting to add prediction for draggers:
Sets dragger owner to be the dragged player (this also means alpha will be applied).
It also ensures that the dragger that is sent for the players own team always has the same netobject id, and additionally that an idle dragger is always sent if no one in the players owns team is dragged (before it used to be that an idle dragger wasn't sent if _any_ player was dragged, including other teams visible to the player). The first one helps with keeping track of the dragger between snapshots (and simplifies prediction), while the second one ensures that a player still sees a dragger after show_other_alpha is applied to other teams.
Also fixes snapped order of to/from pos.
## Checklist
- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [x] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)
Co-authored-by: trml <trml@users.noreply.github.com>
6692: Add script to check for unused config variables to CI, remove unused config variables r=def- a=Robyt3
Add `scripts/check_config_variables.py` which checks if config variables defined in `src/game/variables.h` and `src/engine/shared/config_variables.h` are unused.
Remove unnecessary usage of the preprocessor that was causing false positives for the check.
Remove unused config variables:
- `dbg_focus`
- `gfx_tune_overlay`
- `sv_external_port`
- `dbg_pref`
- `dbg_stress_network`
- `sv_score_folder`
- `sv_rank_cheats`
## Checklist
- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)
Co-authored-by: Robert Müller <robytemueller@gmail.com>
Allow dragging the demo player controls anywhere on the screen. The controls can't be moved outside of the screen. Round corners are automatically disabled when the controls are on the edge of the screen.
The escape key was previously always causing the menus to be toggled in addition to the normal key handling.
Now the menu is activated/deactivated by using the same UI hotkey system as in the rest of the menus. By checking for the escape hotkey last in the render call, other parts of the menu, especially popup menus, can use the hotkey first.
Fixes escape key in the demo player closing demo controls and slice popup at the same time. Now the popup is closed first.
Ensure that tooltips are only activated when the associated UI element is currently the hot item. This prevents tooltips from being activated for UI elements that are currently not enabled due to them being behind a popup or outside of a clipping rect.
Same as for the envelope editor. Extract `RenderExtraEditorDragBar` function to reduce duplicate code.
Fix height being changed by repeated clicking on the draggable element by also resetting `s_Operation` when `Clicked` is `true`.
Show begin time, end time and length of demo cut in popup.
Replace demo slice error/confirm messages with generic popups.
Improve layout. Remove unnecessary empty space.
Sometimes the calculated popup width and height do not perfectly match the width and height when the text is rendered, so a small nudge value is added to prevent cases where this was noticeable.
Renaming a demo to the name of another demo would overwrite the target demo. Now an error message popup is shown instead to prevent this.
After a demo rename error popup is shown, return to the demo rename popup instead of closing the popup.
6677: Use icons for refresh and connect buttons, refactor `DoButtonMenu` r=def- a=Robyt3
Use less space for refresh and connect buttons to improve layout with 5:4 and 4:3 resolutions. Closes#5605. Closes#5878.
The "Refreshing..." text is replaced with combined refresh and ellipsis icons.
Alpha and saturation of the green color of the connect button are increased.
Move `CMenus::DoButtonMenu` to `CUI::DoButton_Menu`. Simplify usage by adding `SMenuButtonProperties` parameter object for all optional arguments. Remove unused `ColorHot` parameter.
Screenshots:
- Before:
![screenshot_2023-05-27_19-52-37](https://github.com/ddnet/ddnet/assets/23437060/3bf27f53-b034-4147-97ee-5c24a5b68457)
- After:
![screenshot_2023-05-27_19-51-07](https://github.com/ddnet/ddnet/assets/23437060/702a9c1c-be07-4cd6-94b5-b4b0fd9b4fa1)
- After (when refreshing):
![screenshot_2023-05-27_19-56-15](https://github.com/ddnet/ddnet/assets/23437060/0a456467-6550-4ce7-b756-56e3bbbc4f43)
## Checklist
- [x] Tested the change ingame
- [x] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)
Co-authored-by: Robert Müller <robytemueller@gmail.com>
Use less space for refresh and connect buttons to improve layout with 5:4 and 4:3 resolutions. Closes#5605. Closes#5878.
The "Refreshing..." text is replaced with combined refresh and ellipsis icons.
Alpha and saturation of the green color of the connect button are increased.
Move `CMenus::DoButtonMenu` to `CUI::DoButton_Menu`. Simplify usage by adding `SMenuButtonProperties` parameter object for all optional arguments. Remove unused `ColorHot` parameter.