semi opaque

This commit is contained in:
Jorijn van der Graaf 2025-11-27 00:08:10 +01:00
commit 0329616148
6 changed files with 80 additions and 91 deletions

View file

@ -30,7 +30,7 @@ import std;
using namespace Crafter;
TextElement::TextElement(std::int_fast32_t anchorX, std::int_fast32_t anchorY, std::uint_fast32_t relativeWidth, std::uint_fast32_t relativeHeight, std::int_fast32_t anchorOffsetX, std::int_fast32_t anchorOffsetY, std::int_fast32_t z, bool ignoreScaling) : RenderingElementPreScaled(false, anchorX, anchorY, relativeWidth, relativeHeight, anchorOffsetX, anchorOffsetY, z, ignoreScaling) {
TextElement::TextElement(std::int_fast32_t anchorX, std::int_fast32_t anchorY, std::uint_fast32_t relativeWidth, std::uint_fast32_t relativeHeight, std::int_fast32_t anchorOffsetX, std::int_fast32_t anchorOffsetY, std::int_fast32_t z, bool ignoreScaling) : RenderingElementPreScaled(OpaqueType::Transparent, anchorX, anchorY, relativeWidth, relativeHeight, anchorOffsetX, anchorOffsetY, z, ignoreScaling) {
}
@ -249,7 +249,7 @@ void TextElement::RenderText(Window& window, const std::string_view text, float
} else if (currentLine.empty() || (currentLine.length() + currentWord.length() + 1) * (int)(scale * 1.5f) <= maxLineWidth) {
// Add word to current line
if (!currentLine.empty()) {
currentLine = currentLine.substr(0) + std::string(" ") + currentWord;
currentLine = currentLine + std::string(" ") + currentWord;
} else {
currentLine = currentWord;
}