Peter Nelson
5e689ce25e
Codechange: Store cursor sprites in vector. ( #12564 )
...
Combine two separate fixed length arrays to allow simpler iteration.
No need to check that arrays are all the same length.
No need to separately store the number of sprites to draw.
Removes the upper limit of the number of sprites that can be drawn.
Removes lengthof and array indices.
2024-04-24 21:26:07 +01:00
Peter Nelson
7572cfd103
Codechange: Redefine ZOOM_LVL so that ZOOM_LVL_NORMAL is 1x zoom.
...
This matches expectations of what normal zoom means.
2024-04-04 22:27:03 +01:00
Peter Nelson
9854553e10
Codechange: ZOOM_LVL_SHIFT/BASE are not actually ZOOM_LVLs.
...
Rename to ZOOM_BASE_SHIFT and ZOOM_BASE respectively, and derive from ZOOM_LVL instead of numeric value.
2024-04-04 22:27:03 +01:00
Peter Nelson
3c94e81665
Codechange: Use ZOOM_LVL_MIN to refer to first zoom level.
...
Many uses of ZOOM_LVL_NORMAL actually just want the first zoom level slot, so use ZOOM_LVL_MIN to make this clearer.
2024-04-04 22:27:03 +01:00
Patric Stout
a3cfd23cf9
Codechange: rename byte to uint8_t ( #12308 )
2024-03-16 23:59:32 +01:00
Patric Stout
3e625b5b1a
Add: track savegame size to report with survey ( #12304 )
2024-03-16 08:58:56 +01:00
Peter Nelson
dc6305e8c1
Codechange: Use std::make_unique instead of passing new into a unique_ptr. ( #12263 )
...
std::make_unique will also initialise the data so MemSetT is not needed.
2024-03-11 08:09:44 +00:00
Rubidium
bab5a8a787
Codechange: use std::source_location over __FILE__ and __LINE__ for Backup
2024-03-10 10:14:20 +01:00
frosch
bb86023d50
Fix #12127 , 555a379: Truncation ellipses rendered shadows even for black font without shadows ( #12132 )
2024-02-22 22:22:35 +00:00
frosch
555a37930b
Fix: Shadows of individual character glyphs could be drawn over other characters ( #12115 )
2024-02-18 16:30:54 +01:00
Peter Nelson
ae575a7a5b
Codechange: Store text run positions in vector of points.
...
This simplifies the interlaced vector of x/y positions.
2024-01-19 00:08:31 +00:00
Patric Stout
302ba93471
Fix: [SDL2] only resolutions of the first display were shown ( #11778 )
2024-01-14 22:25:54 +00:00
Peter Nelson
a6873ef7dd
Codechange: Avoid repeatedly calling virtual methods in text drawing loop. ( #11774 )
2024-01-14 19:06:50 +00:00
Peter Nelson
9ce1626bb4
Change: Support custom transparency remaps with 32bpp blitters.
...
This closes a 15 year old TODO...
2023-12-25 11:22:52 +00:00
Peter Nelson
daec0e2ca4
Codechange: Split palette handling to separate file.
2023-12-25 11:22:52 +00:00
Peter Nelson
4ecc107d30
Codechange: Perform simpler comparison first when checking for palette updates.
...
This avoids unnecessarily comparing contents of an array.
2023-12-25 11:22:52 +00:00
Peter Nelson
fd0aa3dd19
Fix #11515 : Zoom level could wrap around when changing interface scale. ( #11615 )
...
This happened due to converting the new value to unsigned before clamping instead of after.
2023-12-22 15:23:42 +00:00
Peter Nelson
c1afbc9415
Fix: Update widget dimensions before updating viewport signs. ( #11611 )
...
Viewport signs used fullbevel WidgetDimensions before it was updated for the new interface scale.
2023-12-20 22:10:05 +00:00
Peter Nelson
b19a6c3b81
Fix: Window width/height was doubly-scaled with automatic DPI switch. ( #11598 )
2023-12-18 13:05:06 +00:00
Peter Nelson
d6515d6c98
Fix 0a8bcdd: Scaling non-sprite fonts does not depend on _font_zoom changing. ( #11579 )
2023-12-13 19:51:44 +00:00
Peter Nelson
0a8bcdd344
Change: Be selective about clearing sprite/font caches on interface scale change. ( #11576 )
...
Sprite cache contains all zoom levels anyway, so does not need to be reloaded.
Font cache does not need to be clear if the font zoom hasn't changed, i.e. when changing the max sprite zoom level setting.
2023-12-11 21:03:54 +00:00
Peter Nelson
dc27f1649a
Fix e2425b7: Sprites no longer refreshed if max zoom level changed.
...
Handle this via AdjustGUIZoom() instead.
2023-12-11 14:16:49 +00:00
Peter Nelson
e2425b72c1
Fix: Don't implicitly ReInit all windows after updating the character width cache.
...
This caused duplicate ReInit when changing interface scale.
2023-12-07 23:58:32 +00:00
Peter Nelson
6f7153bf71
Codechange: Make a generic DrawRectOutline function from DrawOutline. ( #11524 )
...
This allows drawing an outline from Rect, not just constrained to a Widget's Rect. And reduces duplication a little.
2023-11-30 18:10:07 +00:00
Peter Nelson
c18a1494b7
Codechange: Remove FONT_HEIGHT_... macros. ( #11481 )
...
These make it look like we're dealing with a constant, but actually each is a call to `GetCharacterHeight(...)`.
2023-11-21 19:04:24 +00:00
Peter Nelson
d04fd4602d
Codechange: Assert that max width passed to GetStringHeight is non-zero.
...
Max width of zero will cause text layouters to crash, potentially after exhausting memory first.
2023-11-20 23:09:20 +00:00
Peter Nelson
58c037fba0
Change: Increase finance window lines (and underlines) with interface scale.
2023-11-15 12:43:44 +00:00
Peter Nelson
d19832569e
Cleanup: No need to cast `const Font *` to itself. ( #11395 )
2023-10-25 13:08:07 +00:00
Rubidium
c9276c2959
Codechange: replace x.size() == 0 with x.empty()
2023-10-20 23:05:43 +02:00
Niels Martin Hansen
4765d0f8c2
Change: Text Layouter support querying all lines for character at pixel
2023-09-13 16:11:08 +02: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
Patric Stout
0d840b4570
Codechange: remove queue_wrap / last_position from mouse movement
...
No backend uses it anymore, so also no longer any need to support
it.
2023-06-04 00:40:56 +02:00
Patric Stout
e83f244750
Codechange: simplify UpdateCursorPositionRelative
...
The function is only called with fix_at=true, so don't support
the other cases.
2023-06-04 00:40:56 +02:00
Rubidium
63d9bb93b8
Codechange: migrate from C-style GetString to C++-style GetString
2023-05-21 21:17:12 +02:00
Rubidium
3323402aaa
Codechange: rename smallvec_type to container_func and use only when needed
2023-05-20 16:53:10 +02: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
Patric Stout
60399e17bd
Codechange: C++-ify the Layouter and related functions
...
They all now access a std::string_view, instead of a "const char *"
or std::string (in some cases).
Additionally, GetCharAtPosition and friends now return an index
instead of a "const char *", as it makes for a more clear interface.
2023-05-08 19:21:42 +02:00
PeterN
db573c8742
Fix #10660 : Sprite Font scale affected by viewport zoom level limits. ( #10668 )
2023-04-17 00:14:03 +02:00
PeterN
e97bf271dc
Codechange: Make SpriteType, CargoSortType, SourceType and ScriptType enum classes. ( #10663 )
...
This avoids a (soft) namespace conflict between the four ST_* enums.
2023-04-16 20:00:55 +01:00
rubidium42
6ba55e663e
Codechange: do not hide variables with other variables
2023-01-29 07:21:34 +01:00
Patric Stout
1fb101eabb
Codechange: address CodeQL issue "Multiplication result converted to larger type" ( #10306 )
...
Most are very unlikely to ever be triggered in our codebase; two
stand out: linkgraph and money cheat. Those, potentially, could
wrap earlier than expected.
2023-01-02 20:30:02 +00:00
PeterN
f7e2b6ef12
Change: Make vehicle list dropdown buttons resize to fit strings. ( #10286 )
2022-12-27 18:39:37 +00:00
Peter Nelson
9666e46739
Feature: Variable GUI scale.
...
GUI scale is now variable from 100% to 500%, and no longer restricted to
powers-of-2.
2022-11-12 18:28:39 +00:00
Peter Nelson
062ea68422
Change: Scale position of font shadow.
2022-11-12 18:28:39 +00:00
Peter Nelson
123983743f
Change: Add optional text labels to slider widget.
2022-11-12 18:28:39 +00:00
Bouke Haarsma
45d98f689a
Fix #9993 : Handle DPI changes on macOS and Windows
2022-10-16 16:52:14 +02:00
PeterN
f279fc5772
Fix: DrawStringMultiLine() could overdraw ( #10014 )
...
This function did not take the line height into account when checking text will fit before the bottom bounds.
2022-09-10 17:48:38 +01:00
Michael Lutz
57b992717b
Codechange: Extend DrawSpriteToRgbaBuffer to work with 8bpp blitters.
2022-01-01 12:19:30 +01:00
Michael Lutz
f40e82a19d
Fix #9743 : [OSX] Don't try to render touchbar sprites with invalid zoom level.
2022-01-01 12:19:30 +01:00
Danny de Bruijne
753b1d7e15
Feature: Add selected toolbar buttons to MacBook Pro Touch Bar
2021-09-23 21:03:00 +02:00