Added reasons to assertions
This commit is contained in:
@ -72,7 +72,7 @@ std::vector<struct ShaderPassItem> UILabel::getUIRenderPasses() {
|
||||
break;
|
||||
|
||||
default:
|
||||
assertUnreachable();
|
||||
assertUnreachable("UILabel::getUIRenderPasses: Texture slot not implemented");
|
||||
}
|
||||
|
||||
item.textureSlots[it->second] = &it->first->texture;
|
||||
@ -119,7 +119,7 @@ void UILabel::rebufferQuads(const std::vector<struct UILabelText> newTexts) {
|
||||
return;
|
||||
}
|
||||
|
||||
assertTrue(newTexts.size() <= FONT_SHADER_PARTS_MAX);
|
||||
assertTrue(newTexts.size() <= FONT_SHADER_PARTS_MAX, "UILabel::rebufferQuads: Too many parts (not supported)");
|
||||
|
||||
int32_t nextTexture = 0;
|
||||
glm::vec2 position(0, 0);
|
||||
@ -161,17 +161,17 @@ void UILabel::rebufferQuads(const std::vector<struct UILabelText> newTexts) {
|
||||
realText.style = text.style;
|
||||
|
||||
// Lock the font
|
||||
assertNotNull(text.style.font);
|
||||
assertNotNull(text.style.font, "UILabel::rebufferQuads: Font cannot be null");
|
||||
realText.lockId = text.style.font->lock(TrueTypeFaceTextureStyle{
|
||||
text.style.size,
|
||||
text.style.style
|
||||
});
|
||||
assertTrue(realText.lockId != -1);
|
||||
assertTrue(realText.lockId != -1, "UILabel::rebufferQuads: Failed to lock font");
|
||||
realText.texture = text.style.font->getTexture(realText.lockId);
|
||||
|
||||
// Map texture
|
||||
if(textureMap.find(realText.texture) == textureMap.end()) {
|
||||
assertTrue(nextTexture < FONT_SHADER_TEXTURE_MAX);
|
||||
assertTrue(nextTexture < FONT_SHADER_TEXTURE_MAX, "UILabel::rebufferQuads: Too many textures (not supported)");
|
||||
textureMap[realText.texture] = nextTexture++;
|
||||
}
|
||||
|
||||
@ -252,10 +252,10 @@ void UILabel::rebufferQuads(const std::vector<struct UILabelText> newTexts) {
|
||||
}
|
||||
|
||||
// Validate characters
|
||||
assertTrue(ch >= TRUE_TYPE_CHAR_BEGIN && ch < TRUE_TYPE_CHAR_END);
|
||||
assertTrue(ch != '\r');
|
||||
assertTrue(ch != '\t');
|
||||
assertTrue(ch != '\n');
|
||||
assertTrue(ch >= TRUE_TYPE_CHAR_BEGIN && ch < TRUE_TYPE_CHAR_END, "UILabel::rebufferQuads: Character out of range");
|
||||
assertTrue(ch != '\r', "UILabel::rebufferQuads: Character cannot be a carriage return");
|
||||
assertTrue(ch != '\t', "UILabel::rebufferQuads: Character cannot be a tab");
|
||||
assertTrue(ch != '\n', "UILabel::rebufferQuads: Character cannot be a newline");
|
||||
|
||||
// Get font data.
|
||||
auto charInfo = realText.texture->getCharacterData(ch);
|
||||
@ -357,7 +357,7 @@ void UILabel::rebufferQuads(const std::vector<struct UILabelText> newTexts) {
|
||||
);
|
||||
|
||||
if(hasDecorations) {
|
||||
assertTrue(vertices.size() == decorations.size());
|
||||
assertTrue(vertices.size() == decorations.size(), "UILabel::rebufferQuads: Decoration count mismatch");
|
||||
this->meshDecorations.createBuffers(
|
||||
QUAD_VERTICE_COUNT * decorations.size(),
|
||||
QUAD_INDICE_COUNT * decorations.size()
|
||||
@ -408,8 +408,8 @@ void UILabel::rebufferQuads(const std::vector<struct UILabelText> newTexts) {
|
||||
// Finally, release the old locks
|
||||
itText = textsBuffered.begin();
|
||||
while(itText != textsBuffered.end()) {
|
||||
assertTrue(itText->lockId != -1);
|
||||
assertNotNull(itText->style.font);
|
||||
assertTrue(itText->lockId != -1, "UILabel::rebufferQuads: Lock ID cannot be -1");
|
||||
assertNotNull(itText->style.font, "UILabel::rebufferQuads: Font cannot be null");
|
||||
itText->style.font->unlock(itText->lockId);
|
||||
++itText;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ void UIRichTextLabel::onStart() {
|
||||
bufferTexts.push_back(text);
|
||||
} else if(child.nodeType == XML_NODE_TYPE_ELEMENT) {
|
||||
auto node = child.child;
|
||||
assertTrue(node->node == "font");
|
||||
assertTrue(node->node == "font", "UIRichTextLabel::onStart: Unknown node type '" + node->node + "'");
|
||||
|
||||
struct UILabelStyle style;
|
||||
if(node->attributes.contains("font")) {
|
||||
|
Reference in New Issue
Block a user