Commit graph

71 commits

Author SHA1 Message Date
Robert Müller f451a33361 Port CScrollRegion from upstream with some minor refactorings
Co-authored-by: LordSk <lordskelethom@gmail.com>
2022-08-23 10:01:28 +02:00
Robert Müller 9cbca642ea Rename CUIElement::Get to Rect
This makes it clear that the method is a getter for the rects.
2022-08-23 10:01:27 +02:00
Robert Müller 991b045a11 Remove unused CUIElement::m_ElementTime 2022-08-23 10:01:26 +02:00
Robert Müller f0c74f72ba Smooth console completion scrolling 2022-08-15 23:20:37 +02:00
Robert Müller 51fb3e9a22 Merge CUIEx class into CUI
There is no need to separate the UI in two classes anymore, as the dependency on `CRenderTools` has been removed.
2022-08-12 19:59:19 +02:00
Robert Müller b50309dd5c Move CUIRect class into its own files 2022-08-12 19:37:07 +02:00
Robert Müller 4005b82743 Move CRenderTools::DrawUIElRect to CUIElement::SUIElementRect::Draw
This method draws a particular UI element rectangle so it should be a member method.
2022-08-12 17:42:05 +02:00
Robert Müller 7b20009980 Move CUI::CORNER_* enum to IGraphics::CORNER_*
Entirely automatic replacement in preparation for moving rect drawing methods from `CRenderTools` to `IGraphics`.
2022-08-12 17:42:04 +02:00
ChillerDragon 1347860b2c Adapt upstreams CButtonContainer 2022-07-18 10:23:03 +02:00
Robert Müller a9787b15e3 Merge CRenderTools::DrawUIRect4NoRounding into DrawUIRect4
As this is a special case the methods can be merged to reduce the number of public methods.
2022-07-10 17:19:32 +02:00
Chairn 32318a7c90 Reworked color system
Removed duplicate structs. Replaced 4 floats array with appropriate
struct where applicable
2022-07-06 11:39:51 +02:00
Robert Müller 55d48db711 Integrate joystick with game controls and menus/editor UI 2022-06-13 20:40:37 +02:00
ChillerDragon 3667061b68 Use nullptr in generated and editor
-Wzero-as-null-pointer-constant
2022-06-13 18:28:13 +02:00
Robert Müller ffff4435c4 Remove ui_scale:
- remove config variable `ui_scale`
- remove `CUI::Scale`
- remove `CUI::SetScale`
- remove `CUI::DoLabelScaled`
- remove `CUIRect::Scale`
- use `CUI::DoLabel` instead of `CUI::DoLabelScaled`
- remove usages of `CUI::Scale()` and `CUIRect::Scale()`, or use 1.0f instead
2022-06-12 10:40:19 +02:00
Chairn 01edaec628 Format vector variables names (fixes #5209) 2022-06-11 21:38:49 +02:00
Robert Müller 91d2ba1865 Organize game-client includes 2022-05-29 21:24:43 +02:00
bors[bot] 59acac221c
Merge #5254 #5257
5254: Fix ingame menu button behavior when holding mouse button r=def- a=Robyt3

Fixes the following behavior:

1. Player is ingame and the ingame menu is opened with Esc
2. A mouse button is held down on one of the ingame menu buttons (e.g. the spectate button)
3. The ingame menu is closed without moving the mouse away from the button
4. The mouse button is released while ingame
5. The menu is opened again
    - Current behavior: The hovered button is immediately activated, as soon as the menu opens, due to the released mouse state being handled as a click.
    - Fixed behavior: The button is not activated. Instead another call to `FinishCheck` is added so it's also called when the menu is not active, to clear the active UI item in that case.

As well as the following:

1. The menu is closed while the mouse cursor is hovering over a button.
2. The mouse button is pressed and held while the menu is closed.
3. The menu is opened again.
   - Current behavior: The menu button is already held down and when the player releases the mouse button it will immediately be activated.
   - Fixed behavior: The button is not activated immediately, by clearing the hot item and next hot item variables in `FinishCheck`.

The latter behavior can still occur when entering the editor instead of closing the ingame menu.

Closes #3560. Closes #5229.

The first two commits are identical to upstream https://github.com/teeworlds/teeworlds/pull/3158, where those issues also exist. The last commit adapts upstream behavior so buttons can only become hot when the mouse is not pressed.

## 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 if it works standalone, system.c especially
- [ ] 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)


5257: Refactoring: Move CMenus::UseMouseButtons to CUI::SetEnabled, extract CRenderTools::RenderCursor r=def- a=Robyt3

Adopt changes from upstream.

## 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 if it works standalone, system.c especially
- [ ] 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>
2022-05-27 18:37:17 +00:00
Robert Müller caa23bcfdd Move CMenus::UseMouseButtons to CUI::SetEnabled 2022-05-27 19:43:12 +02:00
Robert Müller 910f01cbf2 Fix ingame menu buttons when mouse is held ingame and released in menu 2022-05-27 19:07:56 +02:00
Robert Müller 2b02bd449b Prevent lock of UI
Co-authored-by: oy <tom_adams@web.de>
2022-05-27 11:53:05 +02:00
Jupeyy 3c597aff95 Switch to nanoseconds 2022-05-18 18:05:41 +02:00
Robert Müller 3708abe8e0 Remove CRenderTools' pointers to CUI and CGameClient 2022-05-14 13:31:07 +02:00
Robert Müller fc93ba0539 Remove unused DoButtonLogic pText argument 2022-05-14 00:26:15 +02:00
Robert Müller a248822ea5 Add CUI:MouseHovered and MouseInsideClip 2022-05-13 20:24:10 +02:00
Robert Müller 1855b4aea1 Support nested CUI clipping regions 2022-05-13 20:20:04 +02:00
Edgar 3c904ffbb4
fix conflict 2022-04-07 09:46:02 +02:00
Chairn 6086893fa6 Renamed all shadowing/shadowed variables 2022-03-24 17:59:49 +01:00
Jupeyy cce42d41de Auto select search string on hot key 2022-03-13 19:12:06 +01:00
Jupeyy 95fe457abb Auto font size 2022-03-11 17:34:48 +01:00
Robert Müller 4fbca828f4 Add optional Spacing parameter to H/VSplitMid 2022-01-26 20:41:05 +01:00
def 7aac8b5386 Add readability-container-size-empty 2022-01-22 13:54:25 +01:00
Robert Müller a61c45550d rename Init method and move implementation 2021-12-03 20:26:27 +01:00
Robert Müller af82a20374 move ms_FontmodHeight to CUI 2021-12-03 20:26:25 +01:00
Robert Müller 053981ee4c refactor UI scrollbars 2021-11-26 23:03:45 +01:00
def 36a6b39031 Fix save typing when server settings are open in editor
As reported by louis:

> while saving a mapname while having the "Server Settings" tab open,
> pressing "m" while typing the mapname will unfocus the cursor from the
> mapname field onto the server settings field
2021-11-22 18:26:14 +01:00
Jupeyy 0d17665137 Revert "Add new mouse state"
This reverts commit e4cb348db2.
2021-10-23 13:48:21 +02:00
Jupeyy e4cb348db2 Add new mouse state 2021-10-07 16:48:25 +02:00
Jupeyy fd68cc3a05 Add basic selection support for ui ex edit boxes 2021-10-04 19:58:25 +02:00
Robert Müller 3d412646a0 add CUI::MapScreen convenience method 2021-09-22 21:48:55 +02:00
Jupeyy 1e07a00c3b Refactor CUIElements 2021-09-14 00:21:20 +02:00
Jupeyy a663799188 uint64 -> uint64_t, int64 -> int64_t 2021-06-24 17:19:17 +02:00
Alexander Akulich 2790270abf Adopt upstream refactoring: Mark several functions as 'const' 2021-02-23 18:26:16 +03:00
def fc75e95e35 Merge branch 'master' into pr_color_picker 2020-12-18 19:13:51 +01:00
Дядя Женя c084c9cde2 Fix Mac & Linux build 2020-12-14 04:18:04 +03:00
Дядя Женя 77f84ac831 Ready 2020-12-14 03:51:31 +03:00
Дядя Женя 9b4dfc142a Merge branch 'master' into pr_color_picker
# Conflicts:
#	src/game/client/components/chat.h
#	src/game/client/components/menus_settings.cpp
2020-12-13 20:40:33 +03:00
Дядя Женя e234776de2 Merge branch 'master' into pr_animations_hud 2020-12-13 20:34:53 +03:00
Jupeyy c0dbd4a6f5 Fix leak, initialize UI Element Rect 2020-11-25 13:11:34 +01:00
Jupeyy 51a31774f8 Don't trigger text alignment for editboxes 2020-11-15 07:15:38 +01:00
Jupeyy a9631bf9cd Fix text color change 2020-11-08 19:43:01 +01:00