Scene change support

This commit is contained in:
2023-06-30 07:33:22 -07:00
parent ee7963fb1a
commit af3b0751f7
24 changed files with 163 additions and 20 deletions

View File

@ -10,6 +10,7 @@ target_sources(${DAWN_TARGET_NAME}
UIComponent.cpp
UIComponentRenderable.cpp
UIImage.cpp
UIEmpty.cpp
UIBorder.cpp
)

View File

@ -0,0 +1,15 @@
// Copyright (c) 2023 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#include "UIEmpty.hpp"
using namespace Dawn;
UIEmpty::UIEmpty(SceneItem *item) : UIComponent(item) { }
float_t UIEmpty::getContentWidth() { return 0.0f; }
float_t UIEmpty::getContentHeight() { return 0.0f; }
float_t UIEmpty::getChildOffsetX() { return 0.0f; }
float_t UIEmpty::getChildOffsetY() { return 0.0f; }

View File

@ -0,0 +1,18 @@
// Copyright (c) 2023 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "UIComponent.hpp"
namespace Dawn {
class UIEmpty : public UIComponent {
public:
UIEmpty(SceneItem *item);
float_t getContentWidth() override;
float_t getContentHeight() override;
float_t getChildOffsetX() override;
float_t getChildOffsetY() override;
};
}

View File

@ -211,7 +211,9 @@ void UILabel::rebufferQuads(const std::vector<struct UILabelText> newTexts) {
// Now, iterate each character
for(int32_t i = 0; i < len; i++) {
char ch = text.text[i];
std::u32string::value_type ch = text.text[i];
// FT_ULong ch = text.text[i];
char c = text.text[i];
// Handle special characters
if(ch == '\n') {
@ -228,8 +230,7 @@ void UILabel::rebufferQuads(const std::vector<struct UILabelText> newTexts) {
assertTrue(ch != '\n');
// Get font data.
FT_ULong c = ch;
auto charInfo = realText.texture->getCharacterData(c);
auto charInfo = realText.texture->getCharacterData(ch);
// Word wrapping
if(