Commit Graph

387 Commits

Author SHA1 Message Date
Peter Nelson
03f5f7145f
Fix f6e78a480d: Truncation ellipsis always drawn in initial colour. (#14451)
Truncation ellipsis is now a layouted line, so we can no longer rely on implicitly using the last set colour.
2025-07-18 18:24:19 +01:00
Peter Nelson
0dc40877fd
Codechange: Initialise/reset font cache with FontSizes bitset. (#14448)
Instead of choosing either "Normal/Small/Large" or "Monospace", use an EnumBitSet to allow any combination.
2025-07-18 18:23:28 +01:00
Peter Nelson
f6e78a480d
Change: Make truncation ellipsis translatable. (#14417) 2025-07-09 22:55:43 +01:00
Peter Nelson
42a9d27fd9
Fix: Don't draw truncation ellipsis if it's too wide. (#14401) 2025-06-30 20:40:04 +01:00
Peter Nelson
80d2194511
Fix: Don't include ellipsis width in RTL truncation offset. (#14400)
This caused the right-most glyphs to be truncated.
2025-06-30 10:03:24 +01:00
Peter Nelson
e23de03a99 Codechange: Use FlatSet for sprite picker list. 2025-05-05 14:00:38 +01:00
frosch
8571af9833 Codechange: Turn ZoomLevel into enum class. 2025-05-03 23:21:09 +02:00
frosch
7055ea0aee Codechange: Define sequential operators for ZoomLevel. 2025-05-03 23:21:09 +02:00
Peter Nelson
8b14faaa40
Codechange: Add version of DrawStringMultiLine that performs clipping test. (#14189)
Normally DrawStringMultiLine does not perform any clipping, as the return value may be needed if it the text is not drawn.

In some specific cases the height is already known, so it is possible to test for clipping, which can cut down on layouting time for text which won't be visible.
2025-05-02 22:59:55 +01:00
Peter Nelson
5008568dfc
Codechange: Rename CenterBounds to CentreBounds and move to geometry header. (#14002) 2025-04-14 23:55:40 +01:00
Jonathan G Rennison
be79099a6f
Codechange: Use a std::span as input for GfxFillPolygon (#13866)
Instead of a std::vector const reference.
2025-03-22 15:16:14 +00:00
Peter Nelson
51fd2853cb
Fix 6e10584b91: Keep custom news from game scripts in encoded form. (#13741)
This allows the news message to translated as appropriate.
2025-03-04 23:15:50 +00:00
Peter Nelson
27761ae431 Cleanup: Remove global string parameters.
Global parameters, and functions for dealing with them, are now gone.
2025-03-04 08:48:35 +00:00
Rubidium
3880cc1b57 Codechange: swap x/y axes for dirty blocks around 2025-03-03 23:25:24 +01:00
Rubidium
ec1b9e53f4 Codechange: use std::vector over ReallocT for dirty blocks 2025-03-03 23:25:24 +01:00
Rubidium
15dcf56dad Codechange: remove ZeroedMemoryAllocator 2025-02-28 20:12:44 +01:00
Peter Nelson
2b80812922
Codechange: Use parameterised GetString() in network-related windows. (#13635) 2025-02-22 13:16:47 +00:00
Peter Nelson
4c99b5b368 Codechange: Return pair from GetBroadestDigit instead of out parameters. 2025-02-22 10:33:22 +00:00
Peter Nelson
6cf7a899e9
Codechange: Use EnumBitSet for PauseMode. (#13553) 2025-02-14 08:30:04 +00:00
Jonathan G Rennison
d06b371254 Cleanup: Fix various spelling errors 2025-02-12 22:44:51 +01:00
Peter Nelson
161b02efda Codechange: Use enum class for BlitterMode. 2025-01-25 21:42:21 +00:00
Peter Nelson
eafee92476
Fix 3d4b98845a: TC_FORCED no longer working. (#12961)
Since initial colour is no longer passed to the text layout, TC_FORCED flag is not seen by the layouter, so it had no effect.

Instead, check for TC_FORCED when drawing and avoid using the string's colours if set.
2024-09-22 18:08:22 +01:00
Peter Nelson
5cd81a980e Codechange: Store both left and right glyph positions in a run.
This also allows the end of a run to be known without using an extra position entry.
2024-06-09 09:57:20 +01:00
Peter Nelson
80ddcb9d7d Codechange: Move GetCharPosInString/GetCharAtPosition to gfx_layout.
These functions are related more to layouting than graphics.
2024-06-09 09:57:20 +01:00
Peter Nelson
3d4b98845a
Codechange: Remove initial colour from layouter cache. (#12728)
Initial colour is now always TC_INVALID, which is substituted with the desired colour when drawing the layout line.

This allows strings which differ only by initial colour to use the same layout cache entry, increasing the efficacy of the cache.
2024-05-28 19:33:44 +01:00
Rubidium
d183d8e587 Codechange: remove INVALID_STRING_ID now drop down uses spans 2024-04-28 18:47:31 +02:00
Rubidium
37a03b513f Codechange: refactor string list dimension finding into a separate function 2024-04-28 18:47:31 +02:00
Rubidium
546a996d95 Codechange: pass options to ShowDropDownMenu using a span 2024-04-28 18:47:31 +02:00
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