Working on UI part
This commit is contained in:
1 parent
6c8fcf17b6
commit
0da1ae124c
17 files changed
+221
-42
No files matched your search
@@ -7,6 +7,12 @@
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
|
||||
namespace ZL
|
||||
{
|
||||
extern float x;
|
||||
extern float y;
|
||||
}
|
||||
|
||||
namespace ZL::Dialogue {
|
||||
|
||||
void DialogueOverlay::TexturedQuad::rebuild(const UiRect& newRect) {
|
||||
@@ -161,8 +167,10 @@ void DialogueOverlay::drawDialogue(Renderer& renderer, const PresentationModel&
|
||||
const float W = Environment::projectionWidth;
|
||||
// const float H = Environment::projectionHeight;
|
||||
|
||||
const UiRect portraitRect{ 24.0f, 24.0f, 182.0f, 182.0f };
|
||||
const UiRect textboxRect{ 220.0f, 24.0f, max(200.0f, W - 244.0f), 182.0f };
|
||||
UiRect portraitRect{ 24.0f+90, 24.0f+16, 176.0f, 176.0f };
|
||||
//const UiRect textboxRect{ 220.0f, 24.0f, max(200.0f, W - 244.0f), 182.0f };
|
||||
UiRect textboxRect{ 30.f, -48.f, 1222.f, 340.0f };
|
||||
|
||||
|
||||
lastDialogueAdvanceRect = { portraitRect.x, portraitRect.y, textboxRect.x + textboxRect.w - portraitRect.x, textboxRect.h };
|
||||
lastCutsceneAdvanceRect = {};
|
||||
@@ -187,27 +195,27 @@ void DialogueOverlay::drawDialogue(Renderer& renderer, const PresentationModel&
|
||||
renderer.PushProjectionMatrix(0.0f, W, 0.0f, Environment::projectionHeight, -10.0f, 10.0f);
|
||||
renderer.PushMatrix();
|
||||
renderer.LoadIdentity();
|
||||
renderer.RenderUniform1f("uAlpha", 1.0f);
|
||||
|
||||
drawQuad(renderer, textboxQuad, textboxTexture);
|
||||
drawQuad(renderer, portraitQuad, model.portraitPath.empty() ? portraitFrameTexture : loadTextureCached(model.portraitPath));
|
||||
drawQuad(renderer, portraitQuad, portraitFrameTexture);
|
||||
//drawQuad(renderer, portraitQuad, model.portraitPath.empty() ? portraitFrameTexture : loadTextureCached(model.portraitPath));
|
||||
drawQuad(renderer, portraitQuad, loadTextureCached(model.portraitPath));
|
||||
|
||||
renderer.PopMatrix();
|
||||
renderer.PopProjectionMatrix();
|
||||
renderer.shaderManager.PopShader();
|
||||
|
||||
const float nameX = textboxRect.x + 24.0f;
|
||||
const float nameY = textboxRect.y + textboxRect.h - 38.0f;
|
||||
const float bodyX = textboxRect.x + 24.0f;
|
||||
const float bodyY = textboxRect.y + textboxRect.h - 78.0f;
|
||||
const float nameX = 312;
|
||||
const float nameY = 232 - 38.0f;
|
||||
const float bodyX = 312;
|
||||
const float bodyY = 232 - 78.0f;
|
||||
|
||||
if (!model.speaker.empty()) {
|
||||
nameRenderer->drawText(model.speaker, nameX, nameY, 1.0f, false, { 1.0f, 0.88f, 0.45f, 1.0f });
|
||||
}
|
||||
|
||||
|
||||
const float bodyTextScale = 1.0f;
|
||||
const float bodyMaxWidthPx = textboxRect.w - 48.0f;
|
||||
const float bodyMaxWidthPx = W - nameX - 48.f-x;
|
||||
|
||||
const std::string wrappedBody = wrapTextToWidth(model.visibleText, *bodyRenderer, bodyMaxWidthPx, bodyTextScale);
|
||||
bodyRenderer->drawText(wrappedBody, bodyX, bodyY, bodyTextScale, false, { 1.0f, 1.0f, 1.0f, 1.0f });
|
||||
|
||||
Reference in new issue
Block a user