trompetin17
19e82ebceb
Add getPreferredTextSize to calculate unconstrained text width
...
Introduces (CButton|CText).getPreferredTextSize, a new method for estimating
the natural width of a caption if the object had no width constraints.
Unlike .getTextSize, which reports the size after applying current
layout constraints (e.g., fixed width or anchors), getPreferredTextSize
answers the question: "How wide would this object need to be to display
the caption on a single line?"
This is particularly useful for modders and layout logic that wants to
dynamically size elements *before* assigning a fixed width or anchoring.
2025-06-26 16:58:32 -05:00
phosit
891908b801
Remove UNUSED
...
The `UNUSED` macro is used to mark a variable as unused but with a name.
Those usages are replaced with comments so that `UNUSED` can be removed.
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-unused
2025-06-26 17:25:05 +02:00
phosit
93666d8628
Remove ignore_result
...
`std::ignore` serves the same purpose and is C++ standard.
2025-06-19 19:05:56 +02:00
phosit
d9795d29fe
Remove the name of some unused arguments
...
Remove some usage of the `UNUSED` macro. Remove only those cases where
the names can be deduced from their type.
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-unused
2025-06-18 12:49:59 +02:00
trompetin17
dfb4598186
Align font height, capHeight to FreeType metrics
...
Previously, `height` was derived from a manually chosen glyph (typically
"I", Standard Cap Height) using FontBuilder, and `lineSpacing` was used
inconsistently for layout logic as a height.
Now, with the FreeType-based system:
- `height` uses `face->size->metrics.height`, which includes the
recommended line height with internal leading/line gap as defined by
the font designer.
- `lineSpacing` was removed
- `GetCapHeight` uses the standard cap height + ascender to have a
visual virtual alignment
This change standardizes font metric usage:
- Use `height` for vertical layout and line progression.
- Use `GetCapheight` in layout engines like `CGUIText` or `CGUIString`,
This ensures better alignment across fonts and consistent spacing in
multiline text rendering.
Fixes : #7962
2025-06-11 08:10:18 -05:00
phosit
1a8757660f
Get config values without using return parameters
...
Many temporaries can be removed.
2025-04-09 12:51:21 +02:00
phosit
b41ca5ad78
Replace FALLTHROUGH by the standard attribute
2025-01-29 19:34:12 +01:00
phosit
473f8ca72e
Remove FALLTHROUGH on empty cases
...
`#include "lib/code_annotation.h"` can be removed in some places.
2025-01-29 19:34:12 +01:00
trompetin17
8c250568e7
Add scrollpanel widget
...
This PR introduces a new ScrollPanel component with the following
capabilities:
- Scroll Orientation Support: Allows scrolling in horizontal, vertical,
or both directions, providing flexibility for different use cases.
- Partial Object Rendering: Supports partial rendering of objects that
are only partially visible within the scroll boundaries, improving
visual accuracy and performance.
- Boundary-Constrained Mouse Interaction: Handles mouse events strictly
within the panel's visible boundaries, preventing interaction with
objects outside the scrollable area.
- Minimum Internal Size (min_width, min_height): Introduces support for
virtual space management, allowing the panel to maintain a minimum
internal size independent of its actual on-screen dimensions. Even
when the panel is resized, this ensures that the content respects a
defined virtual space (with min_width and min_height), effectively
simulating a larger internal canvas. This is particularly useful for
large content or scenarios where a more extensive scrollable area is
required than the current visible panel.
2024-11-12 15:01:42 -05:00
trompetin17
ff28ac36a6
Tooltip set like ghost
...
Tooltip shouldnt receive any mouse event direct, there is a edge case
when you have a big tooltip and the object that need that tooltip is in
the bottom left, at this moment tooltip is in the same position of the
mouse, current code was returning the tooltip, and the code hide the
tooltip, and find again there is another object that needs the tooltip
and show again. To fix this is just than simple to set a tooltip like
ghost because shouldnt receive any mouse event.
2024-10-27 17:18:42 -05:00
Stan
a4d9993e86
Finish implementing property "textcolor_selected" for list GUI objects
...
Fixes #6920
Patch by: @Vantha
Differential Revision: https://code.wildfiregames.com/D5269
This was SVN commit r28135.
2024-07-03 08:32:52 +00:00
Stan
9af1433995
Rename the "color" property of COlist columns to "textcolor"
...
Patch by: @Vantha
Differential Revision: https://code.wildfiregames.com/D5278
This was SVN commit r28120.
2024-06-22 20:18:09 +00:00
vladislavbelov
ffc4a56b9f
Revert non-ASCII characters from source and configuration files introduced in 157c6af18e.
...
Fixes #6846
Differential Revision: https://code.wildfiregames.com/D5185
This was SVN commit r27965.
2023-12-03 00:30:12 +00:00
phosit
3fff9df4a0
Return CTerrain and CUnitManager references from CWorld instead of pointers
...
Accepted By: @vladislavbelov
Comments By: @Stan
Differential Revision: https://code.wildfiregames.com/D4739
This was SVN commit r27861.
2023-09-26 20:10:40 +00:00
vladislavbelov
5ba7ec3bfa
Removes scissor backend setup from GUI.
...
Differential Revision: https://code.wildfiregames.com/D5051
This was SVN commit r27798.
2023-08-15 17:29:45 +00:00
bb
157c6af18e
Make the space in 0 A.D. non-breaking throughout the codebase.
...
Avoid cases of filenames
Update years in terms and other legal(ish) documents
Don't update years in license headers, since change is not meaningful
Will add linter rule in seperate commit
Happy recompiling everyone!
Original Patch By: Nescio
Comment By: Gallaecio
Differential Revision: D2620
This was SVN commit r27786.
2023-07-27 20:54:46 +00:00
vladislavbelov
7378692c89
Fixes CGUISimpleSetting warnings and allows it to be moved.
...
Differential Revision: https://code.wildfiregames.com/D5071
This was SVN commit r27763.
2023-07-18 20:01:22 +00:00
trompetin17
5e2ae82d9e
Bug fix: Use sort order asc by default instead of desc
...
refs 9044735e87
This was SVN commit r27429.
2023-01-12 19:10:28 +00:00
vladislavbelov
7c84c23114
Adds Vulkan backend.
...
Comments By: phosit, Stan
Differential Revision: https://code.wildfiregames.com/D4876
This was SVN commit r27412.
2023-01-10 20:22:20 +00:00
trompetin17
9044735e87
Optional column "sort_order" attribute support olist GUI
...
Patch by: @Grapjas
Differential revision: D4859
Reviewed by: @trompetin17
This was SVN commit r27398.
2023-01-09 14:26:03 +00:00
trompetin17
c8e24927b2
Add support to change column heading text in olist GUI component
...
Patch by: @Grapjas
Reviewed by: @phosit @trompetin17
Differential Revision: https://code.wildfiregames.com/D4857
This was SVN commit r27384.
2023-01-07 15:02:12 +00:00
vladislavbelov
2ef801f5d0
Remove some unnecessary string copy related to substr.
...
Patch By: phosit
Differential Revision: https://code.wildfiregames.com/D4772
This was SVN commit r27271.
2022-12-04 19:56:12 +00:00
vladislavbelov
4d77de66d4
Removes GUI dependency from Canvas2D.
...
Initially the GetDefaultGuiMatrix function was added in 4113aa0a36 and
renamed in 04c63a4093 .
This was SVN commit r27111.
2022-10-04 20:25:39 +00:00
vladislavbelov
75518d0e15
Removes drawing via IDeviceCommandContext from CMinimap.
...
Comments By: phosit
Differential Revision: https://code.wildfiregames.com/D4779
This was SVN commit r27109.
2022-10-04 19:32:42 +00:00
vladislavbelov
095838da0a
Fixes A8 framebuffer format used for LOS interpolation and enables smooth LOS by default.
...
Tested By: Langbart, mastoras
Differential Revision: https://code.wildfiregames.com/D4654
This was SVN commit r26906.
2022-05-26 16:36:57 +00:00
vladislavbelov
a6f60afdc5
Adds instancing support to backend and enables it for minimap.
...
Tested By: Langbart
Differential Revision: https://code.wildfiregames.com/D4650
This was SVN commit r26901.
2022-05-24 07:11:23 +00:00
vladislavbelov
1f8705d8f7
Avoids drawing text in GUI if it will be clipped.
...
Tested By: Langbart
Differential Revision: https://code.wildfiregames.com/D4640
This was SVN commit r26870.
2022-05-10 16:32:25 +00:00
vladislavbelov
62e589ab76
Adds renderer backend interface and dummy backend.
...
Comments By: phosit, Stan
Tested By: Langbart, phosit
Differential Revision: https://code.wildfiregames.com/D4636
This was SVN commit r26858.
2022-05-08 22:02:46 +00:00
vladislavbelov
3ed4eaf247
Removes ogl_WarnIfError from regular renderer code.
...
This was SVN commit r26850.
2022-05-02 21:52:21 +00:00
vladislavbelov
04bd96cee0
Moves uniform and texture binding to CDeviceCommandContext.
...
Tested By: Langbart
Differential Revision: https://code.wildfiregames.com/D4631
This was SVN commit r26848.
2022-05-02 20:57:22 +00:00
vladislavbelov
aba7a170d9
Moves vertex attribute binding to CDeviceCommandContext.
...
Tested By: Langbart, Stan
Differential Revision: https://code.wildfiregames.com/D4610
This was SVN commit r26815.
2022-04-23 20:11:14 +00:00
vladislavbelov
2c8f4c4837
Moves AssertPointersBound to draw commands to not forget to call it for new shaders.
...
In the future it allows to call AssertPointersBound in a more lazy way.
This was SVN commit r26784.
2022-04-12 18:02:08 +00:00
vladislavbelov
b4253d48cb
Moves CShaderProgram to backend and handling via CDeviceCommandContext.
...
Differential Revision: https://code.wildfiregames.com/D4548
This was SVN commit r26652.
2022-03-14 22:16:14 +00:00
vladislavbelov
647fccd410
Replaces native GL types by backend format in vertex attributes in CShaderProgram.
...
This was SVN commit r26594.
2022-03-07 02:21:05 +00:00
vladislavbelov
ce18f297d5
Adds icons to minimap.
...
Tested By: Langbart, Stan
Differential Revision: https://code.wildfiregames.com/D4513
This was SVN commit r26592.
2022-03-07 01:22:06 +00:00
vladislavbelov
3a4bbd11fd
Moves all GL draw commands to CDeviceCommandContext.
...
Differential Revision: https://code.wildfiregames.com/D4518
This was SVN commit r26525.
2022-03-03 07:09:59 +00:00
vladislavbelov
da4ec670c1
Moves glViewport from CRenderer to CDeviceCommandContext.
...
This was SVN commit r26497.
2022-02-26 23:17:48 +00:00
vladislavbelov
d1f1d41a9f
Uses triangles for drawing lines in CCanvas2D.
...
Differential Revision: https://code.wildfiregames.com/D4444
This was SVN commit r26479.
2022-02-25 06:59:57 +00:00
vladislavbelov
4de89c3db1
Moves texture management to CDeviceCommandContext, adds quality options.
...
Comments By: nwtour, Stan
Tested By: nwtour, Stan
Differential Revision: https://code.wildfiregames.com/D4488
This was SVN commit r26365.
2022-02-13 19:30:28 +00:00
Angen
0a72a02ea0
Make scale variables constant
...
b4fbbed379
This was SVN commit r26307.
2022-02-06 11:11:35 +00:00
vladislavbelov
ac77d1c3e0
Moves scissor test management to DeviceCommandContext.
...
This was SVN commit r26288.
2022-02-01 17:58:21 +00:00
vladislavbelov
5adbe4f1a3
Moves blend state management to DeviceCommandContext. Fixes #6420
...
Tested By: Langbart
Comments By: Stan
Differential Revision: https://code.wildfiregames.com/D4441
This was SVN commit r26228.
2022-01-19 17:28:47 +00:00
vladislavbelov
9aedcade7f
Draws slider button only inside its element.
...
Tested By: Stan
Differential Revision: https://code.wildfiregames.com/D4435
This was SVN commit r26213.
2022-01-14 06:50:44 +00:00
vladislavbelov
15c40861b4
Separates terrain alphamap combining and uploading.
...
Tested By: Stan
Differential Revision: https://code.wildfiregames.com/D4419
This was SVN commit r26184.
2022-01-07 14:33:54 +00:00
vladislavbelov
87b5c233c5
Splits CRenderer part about scene to CSceneRenderer.
...
Tested By: Stan
Differential Revision: https://code.wildfiregames.com/D4412
This was SVN commit r26165.
2022-01-04 13:29:01 +00:00
vladislavbelov
2f90becb28
Removes SkipSubmit and unused friends from Renderer.
...
This was SVN commit r26162.
2022-01-03 12:16:16 +00:00
vladislavbelov
4fba543488
Unifies providing SkyManager and WaterManager like other managers, refs b889826a3d.
...
This was SVN commit r26158.
2022-01-03 10:49:12 +00:00
vladislavbelov
3809457513
Replaces unclear PreferGLSL by direct renderer backend choice.
...
Commented By: Stan
Differential Revision: https://code.wildfiregames.com/D4363
This was SVN commit r26069.
2021-12-14 06:34:02 +00:00
vladislavbelov
4c26a2d11f
Adds disabled sprites to slider.
...
Tested By: Langbart
Differential Revision: https://code.wildfiregames.com/D4355
This was SVN commit r26019.
2021-11-27 13:37:05 +00:00
vladislavbelov
9b3dcd2610
Slightly improves minimap flares, makes animation more smooth via alpha fade in/out.
...
Tested By: Langbart
Differential Revision: https://code.wildfiregames.com/D4351
This was SVN commit r26001.
2021-11-16 16:58:32 +00:00