Commit Graph

354 Commits (3e625b5b1a81b00f774ca87b48d3e4f4e9d014c3)

Author SHA1 Message Date
Patric Stout 3e625b5b1a
Add: track savegame size to report with survey (#12304) 3 months ago
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.
3 months ago
Rubidium bab5a8a787 Codechange: use std::source_location over __FILE__ and __LINE__ for Backup 3 months ago
frosch bb86023d50
Fix #12127, 555a379: Truncation ellipses rendered shadows even for black font without shadows (#12132) 3 months ago
frosch 555a37930b
Fix: Shadows of individual character glyphs could be drawn over other characters (#12115) 3 months ago
Peter Nelson ae575a7a5b Codechange: Store text run positions in vector of points.
This simplifies the interlaced vector of x/y positions.
4 months ago
Patric Stout 302ba93471
Fix: [SDL2] only resolutions of the first display were shown (#11778) 5 months ago
Peter Nelson a6873ef7dd
Codechange: Avoid repeatedly calling virtual methods in text drawing loop. (#11774) 5 months ago
Peter Nelson 9ce1626bb4 Change: Support custom transparency remaps with 32bpp blitters.
This closes a 15 year old TODO...
5 months ago
Peter Nelson daec0e2ca4 Codechange: Split palette handling to separate file. 5 months ago
Peter Nelson 4ecc107d30 Codechange: Perform simpler comparison first when checking for palette updates.
This avoids unnecessarily comparing contents of an array.
5 months ago
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.
5 months ago
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.
5 months ago
Peter Nelson b19a6c3b81
Fix: Window width/height was doubly-scaled with automatic DPI switch. (#11598) 6 months ago
Peter Nelson d6515d6c98
Fix 0a8bcdd: Scaling non-sprite fonts does not depend on _font_zoom changing. (#11579) 6 months ago
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.
6 months ago
Peter Nelson dc27f1649a Fix e2425b7: Sprites no longer refreshed if max zoom level changed.
Handle this via AdjustGUIZoom() instead.
6 months ago
Peter Nelson e2425b72c1 Fix: Don't implicitly ReInit all windows after updating the character width cache.
This caused duplicate ReInit when changing interface scale.
6 months ago
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.
6 months ago
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(...)`.
6 months ago
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.
6 months ago
Peter Nelson 58c037fba0 Change: Increase finance window lines (and underlines) with interface scale. 7 months ago
Peter Nelson d19832569e
Cleanup: No need to cast `const Font *` to itself. (#11395) 7 months ago
Rubidium c9276c2959 Codechange: replace x.size() == 0 with x.empty() 7 months ago
Niels Martin Hansen 4765d0f8c2 Change: Text Layouter support querying all lines for character at pixel 9 months ago
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
11 months ago
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.
1 year ago
Patric Stout e83f244750 Codechange: simplify UpdateCursorPositionRelative
The function is only called with fix_at=true, so don't support
the other cases.
1 year ago
Rubidium 63d9bb93b8 Codechange: migrate from C-style GetString to C++-style GetString 1 year ago
Rubidium 3323402aaa Codechange: rename smallvec_type to container_func and use only when needed 1 year ago
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.
1 year ago
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.
1 year ago
PeterN db573c8742
Fix #10660: Sprite Font scale affected by viewport zoom level limits. (#10668) 1 year ago
PeterN e97bf271dc
Codechange: Make SpriteType, CargoSortType, SourceType and ScriptType enum classes. (#10663)
This avoids a (soft) namespace conflict between the four ST_* enums.
1 year ago
rubidium42 6ba55e663e Codechange: do not hide variables with other variables 1 year ago
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.
1 year ago
PeterN f7e2b6ef12
Change: Make vehicle list dropdown buttons resize to fit strings. (#10286) 1 year ago
Peter Nelson 9666e46739 Feature: Variable GUI scale.
GUI scale is now variable from 100% to 500%, and no longer restricted to
powers-of-2.
2 years ago
Peter Nelson 062ea68422 Change: Scale position of font shadow. 2 years ago
Peter Nelson 123983743f Change: Add optional text labels to slider widget. 2 years ago
Bouke Haarsma 45d98f689a Fix #9993: Handle DPI changes on macOS and Windows 2 years ago
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.
2 years ago
Michael Lutz 57b992717b Codechange: Extend DrawSpriteToRgbaBuffer to work with 8bpp blitters. 2 years ago
Michael Lutz f40e82a19d Fix #9743: [OSX] Don't try to render touchbar sprites with invalid zoom level. 2 years ago
Danny de Bruijne 753b1d7e15 Feature: Add selected toolbar buttons to MacBook Pro Touch Bar 3 years ago
Patric Stout 0013673faf Change: prevent palette updates during copying to the video driver
ThreadSanitizer rightfully notices that the game-thread could
update the palette while the draw-thread is copying it for local
use. The odds of this are very small, but nevertheless, it does
carry a very good point.

It wouldn't hurt the application in any way, but it might cause
visual glitches on the screen.
3 years ago
Patric Stout 74186998a2 Codechange: use _cur_palette the same in all the drivers
It was a bit of a mixed bag. With this change, gfx.cpp is in
control who accesses _cur_palette from the video-drivers.
3 years ago
Patric Stout c12a152ec9
Fix: thread safety issue during exiting the game (#9380)
_exit_game is read by the draw-thread to know when to exit, but
most of the time written by the game-thread.
3 years ago
rubidium42 55a11710a6 Codechange: convert printf DEBUG statements to fmt Debug statements 3 years ago
Michael Lutz 418e0ea85f Codechange: Use dynamic string list for contents of land info window. 3 years ago