Peter Nelson
e8015e497d
Codechange: Use begin/end of nwidget parts of begin/length.
...
This simplifies processing nwidget parts as, unlike the remaining length, the pointer to the end of the list never changes. This is the same principle as we use(d) for tracking end instead of length for C-style strings.
And this removes 160~ instances of the lengthof() macro.
2023-09-04 10:20:45 +01:00
Richard Wheeler
96fdfb941a
Feature: Transparency option for cost and income indicators ( #11001 )
2023-08-25 16:04:40 +02:00
Patric Stout
0238a2b567
Codechange: use std::variant instead of using bitflags in the value ( #11191 )
2023-08-12 16:05:00 +00:00
Rubidium
eaae0bb5e7
Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
...
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
2023-07-19 19:30:14 +02:00
PeterN
43ddf19df3
Change: Allow text shadow on WWT_EMPTY/WWT_TEXT to extend horizontally. ( #11065 )
...
This alleviates text shadows of truetype fonts being cropped in some
window layouts.
2023-06-25 11:58:39 +01:00
PeterN
40f567d464
Fix #10811 : Crash getting row from non-resizable widget. ( #10833 )
...
GetScrolled*FromWidget took line height from the widget's resize_y value,
however not all widgets are resizable, resulting in a division-by-zero.
Allow passing line height explicitly in cases where a widget is not
resizable.
2023-05-15 18:57:50 +01:00
Patric Stout
7634553d22
Feature: opt-in survey when exiting a game
...
On first start-up, the game will ask if you want to participate
in our automated survey. You have to opt-in, and can easily opt-out
(via the Options) at any time.
When opt-in, whenever you exit a game, a JSON blob will be send
to the survey server hosted by OpenTTD. This JSON blob contains
information that gives a global picture of the game just played:
- What settings were used
- How many humans vs AIs
- How long the game has been played
- Basic information about the OS / CPU
All this information is kept very generic, so there is no
chance we send private information to our survey server.
Nothing in the JSON blob could identify you as a person; it
mostly tells about the game played. At any time you can see
what the JSON blob includes, by pressing the "Preview Survey
Results" button in-game.
2023-05-14 23:22:02 +02:00
PeterN
da7f431812
Cleanup: widget pos_x/y are already int. ( #10809 )
...
Remove old casts left over from when pos_x/y were unsigned.
2023-05-12 18:02:51 +01:00
PeterN
6998fbf71d
Fix: WWT_TEXT with SetTextStyle did not work. ( #10797 )
...
FontSize was passed to incorrect parameter of DrawString function.
2023-05-09 17:23:37 +00:00
Peter Nelson
35ba49bfb4
Change: Rename text colour NWidgetPart to SetTextStyle and add font size.
...
This allows to set both text colour and size for any widget with default
drawing.
2023-04-30 11:47:53 +01:00
Peter Nelson
55d981aec3
Add: Helper to update widget vertical size.
...
This avoids directly setting min_y outside widget code.
2023-04-25 13:27:22 +01:00
Peter Nelson
d93f96a442
Fix: Account for extra dropdown list padding.
2023-04-12 18:43:15 +01:00
rubidium42
6ba55e663e
Codechange: do not hide variables with other variables
2023-01-29 07:21:34 +01:00
Rubidium
f001e84e5e
Codechange: use RAII to automatically restore _cur_dpi after use
2023-01-28 20:33:02 +01:00
PeterN
c448eb04d8
Fix #10242 : Allow a space for text shadow when clipping WWT_EMPTY/WWT_TEXT. ( #10243 )
2022-12-15 23:21:10 +00:00
Peter Nelson
9bf24ec56f
Codechange: Reorder and properly declare DrawSpriteIgnorePadding().
...
Parameters have been rearranged to be closer to those of the standard
DrawSprite() function, and PaletteID can now be set.
2022-11-17 09:12:07 +00:00
Peter Nelson
ecb5393c55
Change: Standardize progress bar layout.
...
Progress bars are drawn differently depending on when it was added, with
different layouts and sizes.
This change adds a standard padding size to use, and makes all progress
bars visually similar, with scaled padding.
2022-11-12 18:28:39 +00:00
Peter Nelson
ed60c88b0a
Change: Use power-of-2 scaling for some dimensions in GUI.
...
These are related to drawing sprites that are normally drawn on the
landscape, and should therefore still follow power-of-2 scaling to fit
correctly.
2022-11-12 18:28:39 +00:00
Peter Nelson
dd90d79e7b
Add: Setting to toggle thin vs chunky (scaled) bevels.
2022-11-12 18:28:39 +00:00
Peter Nelson
e554fd7808
Change: Hide WidgetDrawDistances from general use.
2022-11-12 18:28:39 +00:00
Peter Nelson
890b2666d3
Change: Use scaled WidgetDimensions.
2022-11-12 18:28:39 +00:00
Peter Nelson
23a8222200
Change: Split vscroll and hscroll padding.
...
Vertical and horizontal scrollbars are different sizes, this allows
different padding for each type.
2022-11-12 18:28:39 +00:00
Peter Nelson
90ce704366
Change: Use scaled WidgetDimensions for core widgets.
2022-11-12 18:28:39 +00:00
Peter Nelson
0bb9a45785
Change: Simplify drawing widget image buttons.
2022-11-12 18:28:39 +00:00
Peter Nelson
d0add1e07f
Change: Ignore offsets when drawing GUI sprite.
2022-11-12 18:28:39 +00:00
Peter Nelson
b5693becdc
Add: Define scaled WidgetDimensions.
...
Includes RectPadding container.
2022-11-12 18:28:39 +00:00
Peter Nelson
0108e9f387
Change: Set up suggested widget padding for panel, frame and inset.
...
Window handlers are free to ignore the suggested padding, however some
handlers have logic that assumes this information was already provided.
2022-11-12 18:28:39 +00:00
Peter Nelson
68423c40c5
Fix: Off-by-one in GetAlignedPosition().
2022-11-12 18:28:39 +00:00
Peter Nelson
dd9f6bc803
Change: Use RectPadding Horizontal()/Vertical() helpers.
2022-11-12 18:28:39 +00:00
Peter Nelson
04cbe57d2a
Change: Use RectPadding for widget padding/uz_padding.
2022-11-12 18:28:39 +00:00
Peter Nelson
f5f035a22b
Codechange: Make use of Rect Width/Height helpers.
2022-11-12 18:28:39 +00:00
PeterN
f24286a1ae
Fix: Ensure 31-bit shifts are unsigned. ( #10128 )
...
Shifting a signed 32-bit integer by 31 bits is undefined behaviour.
A few more than necessary are switched to unsigned for consistentency.
2022-11-04 07:15:59 +00:00
Peter Nelson
ba94efba87
Change: Add flag to apply resize to largest resize step first.
...
Resize step is normally allocated equally amongst all resizable widgets.
With this flag, we allocate as much as possible from the largest
resize step first.
2022-10-16 14:56:34 +02:00
Peter Nelson
296af146fb
Change: Default widget text colour to black.
...
TC_FROMSTRING really means blue, and we almost never actually use
blue text.
2022-10-16 14:24:51 +02:00
Patric Stout
28e90769f7
Codechange: use "[[maybe_unused]]" instead of a wide variety of other ways we had
...
While at it, replace OTTD_ASSERT with WITH_ASSERT, as this
is always set if assert() is valid. No matter if NDEBUG is set
or not.
2021-06-03 17:30:00 +02:00
PeterN
330a305c99
Fix: Apply unscaled padding to Viewport inside WWT_INSET. ( #9219 )
...
Since pixel dimensions in SetPadding() are scaled by GUI size, padding for inset viewports was excessive.
Instead, automatically apply padding for WWT_INSET at widget level. This applies to all widgets inside a WWT_INSET, which in all instances is a NWID_VIEWPORT.
2021-05-08 21:01:16 +01:00
Peter Nelson
d8e06e590a
Codechange: Make GetCurrentRect() conform to usual Rect bounds, and reuse it.
...
Similar code is already repeated in other locations.
2021-05-08 09:53:55 +01:00
Peter Nelson
52b16237ad
Codechange: Don't update window contents if scrollbar position has not moved.
2021-05-08 09:52:54 +01:00
PeterN
256dbee255
Fix: Crash when extra viewport height is zero with sign in view. ( #9175 )
...
If a viewport sign straddles the top of a viewport, a crash will occur if the viewport height is zero. This is resolved by simply not attempting to draw the viewport in this situation, consistent with other widgets.
2021-05-02 10:21:27 +01:00
Peter Nelson
4791ff2862
Fix: Recalculate padding and minimum sizes when GUI or Font zoom is changed.
2021-04-30 17:08:15 +01:00
Peter Nelson
6fe5353da2
Cleanup: Set unchanging scrollbar properties in constructor.
2021-04-30 17:08:15 +01:00
Peter Nelson
03a43b8247
Cleanup: Call SetMinimalSize instead of setting min_y directly.
2021-04-30 17:08:15 +01:00
Peter Nelson
f5569763c9
Fix: Specify width when width is required instead of top.
2021-04-30 17:08:15 +01:00
Peter Nelson
4c6cca459a
Cleanup: Remove fairly redundant DrawDropdown() function.
2021-04-30 17:08:15 +01:00
Peter Nelson
5153e1b6e3
Cleanup: Horizontal widget size is commonly width rather than length.
2021-04-30 17:08:15 +01:00
Peter Nelson
51b4bd6c38
Codechange: Add widget text colour override property.
2021-04-22 16:42:04 +01:00
Peter Nelson
636e37d183
Codechange: Add internal widget alignment property, along with widget part.
2021-04-22 16:42:04 +01:00
Peter Nelson
2a0365b3d9
Cleanup: Remove unnecessary parameter of GetScrolledRowFromWidget()
...
Line height defaults to the resize height of the relevant widget, which is
set in all cases. Therefore it is not necessary to specify this value every time.
Additionally fixes scrolled padding for the framerate window.
2021-04-21 23:12:10 +02:00
Rubidium
bf4fe19a66
Codechange: merge duplicated logic to scroll in lists by key into a single function
2021-04-21 21:12:08 +02:00
Charles Pigott
dd798d688b
Fix #8919 : Release builds with asserts enabled ( #8925 )
2021-04-01 23:57:49 +01:00