Commit graph

28 commits

Author SHA1 Message Date
Gleb Mazovetskiy
1519e995cf Move store graphics out of stores.cpp
These graphics are used in various places outside of `stores.cpp`.
2022-01-30 14:56:04 +01:00
KPhoenix
a08026097a
Chat Interface Revision (#3840)
Co-authored-by: Anders Jenbo <anders@jenbo.dk>
2021-12-25 10:11:42 +00:00
Gleb Mazovetskiy
1425bec3e4 Add missing GetLineWidth declaration to header 2021-11-25 12:22:27 +01:00
Gleb Mazovetskiy
c57644970f Move UiFlags and UiPanels into their own files
The first breaks circular dependency between `DiabloUI` and `text_render`.
The latter one moves `UiPanels` to a more appropriate place.
2021-11-25 12:22:27 +01:00
Gleb Mazovetskiy
af168fd8df Add DrawStringWithColors
A way to color parts of the string differently while keeping the color
information out of the string itself.

This is an alternative to #3546.
2021-11-25 00:26:16 +00:00
Gleb Mazovetskiy
0c694edaba WordWrapString: Wrap on punctuation
Useful for Chinese and Japanese, which do not have spaces between words,
nor whitespace after punctuation.
2021-09-30 18:16:31 +02:00
Anders Jenbo
4dd8b121ec Replace TTF with PCX font 2021-09-29 18:13:48 +02:00
Anders Jenbo
704a04ae4d Add support for Unicode fonts 2021-09-24 03:03:58 +02:00
Anders Jenbo
7771a08d03 Translatable mainpanel 2021-09-19 07:21:52 +02:00
Anders Jenbo
7169882b1f Implement new font rendering 2021-09-12 01:37:28 +02:00
Vladimir Olteanu
b17ff04ee2 Use string_view in DrawString and friends 2021-08-05 01:40:43 +02:00
ephphatha
0575716eac Rename UiFlags members to group related options 2021-07-31 20:22:40 +02:00
ephphatha
4ad53232a0 Convert the UiFlags enum to a scoped enum type
Replace operator&& with named function
2021-07-31 20:22:40 +02:00
ephphatha
b680e3fef1 Align end comment markers for doxygen comments
Including a bunch from previous PRs (since I was responsible for the broken formatting for most 😓)
2021-07-09 18:00:15 +02:00
Anders Jenbo
2ca6e37c46 Clean up sub folders using clang-tidy/Android Studio 2021-07-08 03:30:25 -07:00
Gleb Mazovetskiy
55464eec78 Fix -Wmissing-braces
Fixes warnings such as this one:

```
../../../../../../Source/engine/render/text_render.hpp:83:33: warning: suggest braces around initialization of subobject [-Wmissing-braces]
        return DrawString(out, text, { position.x, position.y, out.w() - position.x, 0 }, flags, spacing, lineHeight, drawTextCursor);
                                       ^~~~~~~~~~~~~~~~~~~~~~
```
2021-07-03 19:08:45 -07:00
Gleb Mazovetskiy
cb0dae8590 🚚 Rename CelOutputBuf to Surface and extract 2021-07-03 05:33:32 -07:00
Andrew James
60a47caf1b
Refactor Draw* functions to use Rectangle and Point types
Added overload for DrawString taking a Point to avoid creating a rect for callers which only use position. This also documents the way DrawString operates when passed a clipping rectangle with a dimension of 0.
As part of this overload removed the logic for 0 width regions from DrawString. This does change the behaviour of the Rectangle version if called with a rect with width 0, all callers using that behaviour have been updated in this commit.

Using Rectangle/Size allowed simplifying the logic for certain calls where they could use DrawText alignment flags, previously this was manually aligning by calculating dimensions and offsetting the position. This also fixes #2169

Also includes a few instances where a temporary buffer was used to set the text to be drawn with unbounded sprintf calls, replaced those with snprintf as is recommended in modern C applications. Moving to C++ strings would be good in a future refactor.
2021-06-24 01:36:06 +02:00
Gleb Mazovetskiy
e40b1963f9 🚚 engine.h: Extract CelSprite and file loading 2021-06-21 01:36:20 -07:00
ephphatha
b478d8295c Remove dead code, FreeText() is never called
Given the program already lets the destructors get called naturally there's no need to explicitly call this function. Even if it was desirable to re-init the font data the old instances will be destroyed when the new instance is assigned to the optional.
2021-06-19 08:47:47 -07:00
Gleb Mazovetskiy
b76f7656f3 🧹 LoadArt: BYTE -> uint8_t
The change in include order necessitated a couple of other minor
cleanups, one in stubs.h and one in sdl2_to_1_2_backports.h
2021-05-23 18:45:01 +02:00
Anders Jenbo
6acb49bea4 Render quest and menu text using common text rendering 2021-05-21 04:23:49 +02:00
Anders Jenbo
4c6ddc79a1 Clean up text render 2021-05-19 14:09:33 +02:00
Anders Jenbo
a03a2c2634 Render chat panel using common text rendering 2021-05-19 14:09:33 +02:00
Anders Jenbo
d723ebce1a Render help text using common text rendering 2021-05-19 14:09:33 +02:00
thebigMuh
7fbcfeb35c Adding text rendering flag to adjust spacing to fit horizontally
Now also works for multiline strings
2021-05-16 00:55:20 +02:00
Anders Jenbo
7667880de4 🐛 Implement letter spacing in new font rendering
Fixes #1950
2021-05-13 21:52:44 +02:00
Anders Jenbo
68923c6c33 Generic game text render function
This should gradually replace all the direct rendering of game texts
throughout the code. The interface is made to closly mirror that of the
art fonts as that is what will eventually be used for rendering Unicode
fonts both in the menus and ingame.

fixup!  Generic game text render function
2021-05-08 18:48:19 +02:00