Commit Graph
76 Commits
Author SHA1 Message Date
Anders Jenbo 11e37e972a Port essential parts to use SDL abstraction for file access 2021-10-20 21:52:59 +02:00
Gleb Mazovetskiy dec45920eb Text rendering: Support Zero-width space
Zero-width space is a non-printing character that indicates a word
boundary.

https://en.wikipedia.org/wiki/Zero-width_space
2021-10-20 02:33:25 +02:00
Anders Jenbo 5b3abbd315 Correct dialog font full width 2021-10-17 08:40:45 +02:00
Anders Jenbo b3546e3254 Load full width kerning programmatically 2021-10-16 02:00:30 +02:00
Anders Jenbo f022a341b0 Avoid crashing from missing fonts 2021-10-12 21:05:19 +02:00
Gleb Mazovetskiy f4404e1452 WordWrapString: Also break on , U+FF0C (FULLWIDTH COMMA) 2021-10-01 10:29:03 +02: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 d0f70d5468 Correct loading of unicode fonts past row 09 2021-09-25 03:59:00 +02:00
Anders Jenbo 704a04ae4d Add support for Unicode fonts 2021-09-24 03:03:58 +02:00
Alex 6df826eb02 Fix compiler warnings 2021-09-23 19:06:37 +02:00
Anders Jenbo 7771a08d03 Translatable mainpanel 2021-09-19 07:21:52 +02:00
staphen 09b8afba4e Fix OOB error in DrawString 2021-09-13 23:48:54 +02:00
qndel 1f61b683a6 fix chat line wrapping 2021-09-13 22:53:32 +02:00
Anders Jenbo 41f6b62caa Fix infinit loop if first word overflows the text box
Fixes #2829
2021-09-12 01:37:28 +02:00
Anders Jenbo 7169882b1f ✨ Implement new font rendering 2021-09-12 01:37:28 +02:00
Juliano Leal Goncalves 7da37da8c9 ♻️ Leverage 'Point' in 'RenderTile' function 2021-09-06 00:31:25 +02:00
Juliano Leal Goncalves bb2dfdfb73 🚚 Rename 'ItemStruct' to 'Item' 2021-08-30 13:40:08 +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
Anders Jenbo 24d0d37d26 Add drop shadow to DrawMapLineSteep 2021-07-27 01:39:46 +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
Anders Jenbo dce78dde62 Rename lighting globals 2021-07-08 02:01:14 -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
qndel a1710ff51e pass item to CelDrawItem (#2265)
pass item to CelDrawItem
2021-06-29 18:09:54 +02:00
Anders Jenbo 8e07ef8fe5 Clang-tidy: misc-unused-parameters 2021-06-27 17:34:32 +02:00
Anders Jenbo 2bdb6caa07 Cleanup majority of remaning implicit bool conversions (#2234) 2021-06-26 21:05:45 +02:00
Anders Jenbo 2417d3d333 🔥 Remove unused code 2021-06-25 13:22:08 +02:00
Anders Jenbo af254601d6 ♻️ Apply clang-tidy to engine 2021-06-25 13:22:08 +02: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 14218080b6 🚚 engine.h: Extract CelGetFrame and friends 2021-06-21 02:34:28 -07:00
Gleb Mazovetskiy e40b1963f9 🚚 engine.h: Extract CelSprite and file loading 2021-06-21 01:36:20 -07:00
Gleb Mazovetskiy f9f301b054 🚚 engine.h: Extract Point, Direction, clamp
`engine.h` is getting quite bloated. Moves this code to their own files.
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
Chance4us 608c231f46 Draw black drop shadow for automap (#2090) 2021-05-31 16:09:55 +02:00
Kalebe Alves 118efe8e6d Use Point/SDL_Rect for control functions coordinate system 2021-05-28 19:57:16 +02:00
Kalebe Alves 0461529176 Move byte from engine.h 2021-05-27 16:04:27 +02:00
qndel b1d74d2791 alt highlighting (#2060) 2021-05-25 23:47:29 +02:00
Anders Jenbo 6ce8f13751 Apply clang-tidy to more code and do some related cleanups 2021-05-24 05:27:06 +02: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
qndel 69b903743a fix typos 2021-05-23 05:52:52 +02:00
qndel faae9a65c7 fix typos (#2038) 2021-05-23 03:57:47 +02:00
Gleb Mazovetskiy bb95e0c337 cl2_render: Use memset when rendering outline
A minor cleanup that replaces the for-loop rendering for a fill run
with memsets.
2021-05-22 15:55:51 +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