1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 19:13:07 +01:00
Commit Graph

114 Commits

Author SHA1 Message Date
Gymnasiast
05c9e0f7dc Use TextColours in the text drawing structs 2025-12-20 11:43:51 +01:00
Gymnasiast
95c22476c9 Moving scrolling text handling into its own namespace, fix usage of colour_t 2025-12-20 11:43:36 +01:00
Gymnasiast
b3c854e3aa Move ColourFlags/ColourWithFlags to own compilation units 2025-11-04 00:09:07 +01:00
Gymnasiast
300a094b58 Create TextDrawFlag 2025-11-03 23:25:31 +01:00
Gymnasiast
9c2000565d Use ColourFlags in TextDrawInfo 2025-11-03 23:25:31 +01:00
Gymnasiast
64ef3da5a4 Use FlagHolder in ColourWithFlags 2025-11-03 23:25:31 +01:00
Gymnasiast
7fd9743d22 Unwrap always-true if 2025-11-03 23:25:31 +01:00
Gymnasiast
10d9fc5e56 Replace darkness flags with TextDarkness enum 2025-11-03 23:25:30 +01:00
Gymnasiast
fe24e9b77b Create Drawing.String.h 2025-11-03 23:25:30 +01:00
Gymnasiast
0ec4e3353b Update members of FontStyle 2025-11-03 23:25:30 +01:00
Gymnasiast
5e6f5ceb6f Update members of TextDarkness 2025-11-03 23:25:29 +01:00
Gymnasiast
53be1c6f5c Update fields of TextDrawInfo 2025-11-03 23:25:29 +01:00
Gymnasiast
890b8137ba Rename members of FormatToken 2025-10-07 20:27:03 +02:00
Gymnasiast
daa4fe8ac3 Rename field of all config categories 2025-10-07 20:21:32 +02:00
Michael Steenbeek
1a571cd4e4 Create enum for TextColour 2025-05-11 22:37:21 +02:00
Matt
6335c31336 Rename DrawPixelInfo to RenderTarget (#24339)
* Begin backend separation, rename type DrawingPixelInfo to RenderTarget

* Rename dpi variables to rt
2025-05-04 22:06:46 +00:00
Duncan
d5de6c2b49 Start Simplifying CMake code (#24177)
* Use generator expressions

* Update cmake minimum

* Move options and remove project name

* Use further generator expressions

* Try upgrading to CMake 3.25 on Ubuntu 22.04 CI

Install software-properties-common

* Standardise with DISABLE_TTF for disable defines

* Set X64 var differently due to unknown reasons

---------

Co-authored-by: Michael Steenbeek <1478678+Gymnasiast@users.noreply.github.com>
2025-04-11 16:09:52 +01:00
73
b9b2c96c97 Rename sprites.h to SpriteIds.h (#23804) 2025-02-13 15:51:46 +00:00
Michael Steenbeek
be9f27e4f9 Mass rename constants (#23656) 2025-01-19 15:59:45 +00:00
Aaron van Geffen
fa06a49302 Update copyright year to 2025 (#23514) 2024-12-31 20:30:04 +01:00
Aaron van Geffen
2a3a72396b Remove ImageId::FromUInt32 and ToUInt32 (#23415)
* Allow high image ids when rendering an inline sprite

* CustomWindow: refactor use of ImageId::FromUInt32

* Dropdown: refactor use of ImageId::FromUInt32, ToUInt32

* Remove ImageId::FromUInt32

* Fix typo in mechanic status string ids

* Rewrite InventoryFormatItem to not use inline sprites any more

* Widget: replace ImageId::ToUInt32 with ImageId::GetIndex

* Remove ImageId::ToUInt32
2024-12-17 21:26:11 +01:00
Aaron van Geffen
3685d1a24b clang-format: change IndentPPDirectives to BeforeHash (#23287) 2024-11-29 12:04:56 +09:00
hnsdeveloper
3eb9a03708 Replace #define with constexpr in Colour.h
Co-authored-by: Gymnasiast <Gymnasiast@users.noreply.github.com>
2024-11-02 12:54:54 +00:00
Aaron van Geffen
1b7bbee608 Move CodepointView class to its own header 2024-09-10 23:36:59 +02:00
Aaron van Geffen
3d5c19de08 Drop Localisation.h include where not required 2024-07-13 13:33:32 +02:00
Aaron van Geffen
c08541efc7 Remove gCommonStringFormatBuffer, CommonTextBufferSize 2024-07-13 13:25:55 +02:00
Aaron van Geffen
039d0ef1a7 Move CSChar and UnicodeChar namespaces to their own headers 2024-07-12 23:02:31 +02:00
Aaron van Geffen
b5ef2693b0 Remove common.h include from all units 2024-07-09 16:45:19 +02:00
Aaron van Geffen
51bcbe3710 Move UTF8 functions from localisation into core (#22278) 2024-07-12 19:21:15 +03:00
Gymnasiast
8a181b5513 Split colours and colour flags 2024-05-26 12:35:40 +02:00
Aaron van Geffen
a63d86c488 Introduce Config namespace and struct 2024-05-10 12:10:21 +02:00
Harry Hopkinson
98ac3a1bbc Replace GfxDrawString() with DrawText() 2024-05-10 09:56:03 +00:00
Michał Janiszewski
7b12667ddb Reduce <algorithm> include (#21947) 2024-05-01 13:47:27 +02:00
mrmbernardi
d48b75fb86 Refactor TTF drawing (#21621) 2024-03-28 23:28:54 +01:00
Harry Hopkinson
78d95fc0bd Pass DrawPixelInfo by reference (#21563) 2024-03-10 12:00:08 -03:00
Ota
e9b214282d Fix #21039: Text rendering bleeds pixels through windows
Should fix [#21039 ](https://github.com/OpenRCT2/OpenRCT2/issues/21039).

As it is explained in the issue, the outline and inset code would not respect the DPI bounds in the drawing process by accessing e.g. `*(dst + 1)` to draw an outline, in this case to the right.
#### Approach
I approached this issue by creating a function `GetPixel()`  in `TTFSurface` that would return a value if the given x and y coordinates is a part of a TTF text, else 0. 

In the for loop, iterating through the TTF text, the if condition
```
if (surface->GetPixel(xx + srcX_start + 1, yy + srcY_start)
                        || surface->GetPixel(xx + srcX_start - 1, yy + srcY_start)
                        || surface->GetPixel(xx + srcX_start, yy + srcY_start + 1)
                        || surface->GetPixel(xx + srcX_start, yy + srcY_start - 1))
```
checks if the coordinates **(xx, yy)** is an outline of a text. the writing bounds. Adding `srcX_start`, which is 0 or `-skipX` if `skipX < 0`, when calling `GetPixel()`, would shift the pixel access to the correct position, where the text begins on the surface. The same is done for the Y axis. (Not having this would lead to the outlines/insets not moving with the text when the window with the TTF text moves)
2024-02-17 23:31:07 +01:00
James103
1d8dc111f1 Replace 2023 with 2024 in copyright headers (#21139)
Replace all instances of the year 2023 with 2024 in all copyright headers
2024-01-01 12:52:28 +01:00
Michael Bernardi
8c7d1d149a Added OpenGL TTF hinting 2023-12-08 01:13:17 +01:00
Michael Bernardi
f64706e1d9 Add insetting and outlining to OpenGL TTF rendering 2023-12-08 01:13:17 +01:00
ζeh Matt
39458a3df3 Refactor ShortenPath 2023-08-10 14:39:38 +03:00
Gymnasiast
9c2d5b9fef Make GfxDrawSprite() take reference 2023-04-11 22:53:30 +01:00
Michał Janiszewski
470d02572d Fix #17371: GCC regression with -Wmaybe-uninitialized (#19810)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105937 was reported for
GCC12 and fixed in GCC13 (not yet released).

Leave the suppresions in place until we can get rid of GCC12
2023-04-03 16:09:41 +02:00
Gymnasiast
a15f72da87 Pass DPI by ref to string drawing 2023-02-24 22:05:07 +01:00
Silent
0763fd5a78 Fix GfxWrapString potentially corrupting the in/out buffer
Fixes a consistent assertion when displaying "Cannot start construction"
in Japanese, but it has potential fix countless other crashes
related to string wrapping/display.
2023-02-14 09:50:05 +01:00
Duncan
859b071ddc Rename classes with snakes OpenRCT2/A*-F* (#19215)
* Rename classes with snakes OpenRCT2/A*-F*

* Clang format files
2023-01-19 08:16:44 +00:00
Hielke Morsink
0762fcb601 Rename snake_case functions in OpenRCT2/util folder 2023-01-18 22:44:13 +01:00
Michael Steenbeek
12874f2af7 Replace format_string(4) with OpenRCT2::FormatStringLegacy() (#19190)
Co-authored-by: duncanspumpkin <duncans_pumpkin@hotmail.co.uk>
2023-01-17 21:56:30 +01:00
Michael Steenbeek
b4480b344e Rename snake_case functions from localisation folder 2023-01-16 23:12:35 +00:00
Duncan
8504c8d05e Finish Removing snake_case from Drawing Methods 2023-01-16 22:31:34 +00:00
Gymnasiast
5309c80e29 Remove snake_case in interface folder 2023-01-16 22:20:41 +01:00