Working on UI fixing
This commit is contained in:
1 parent
a4032d769e
commit
dee9615483
5 files changed
+24
-21
No files matched your search
@@ -56,12 +56,21 @@ void DialogueOverlay::draw(Renderer& renderer, const PresentationModel& model) {
|
||||
return;
|
||||
}
|
||||
|
||||
//const float W = Environment::projectionWidth;
|
||||
const float W = 1280.0;
|
||||
const float W = Environment::projectionWidth;
|
||||
|
||||
UiRect portraitRect{ 24.0f + 90, 24.0f + 16, 176.0f, 176.0f };
|
||||
UiRect textboxRect{ 30.f, -48.f, 1222.f, 340.0f };
|
||||
UiRect textboxChoiceRect{ 30.f, -90.f, 1200.f, 619.5f };
|
||||
const float nameX = 312 + 8;
|
||||
const float nameY = 232 - 38.0f;
|
||||
const float bodyX = 312 + 8;
|
||||
const float bodyY = 232 - 78.0f;
|
||||
|
||||
const float bodyMaxWidthPx = 1280.0 - nameX - 48.f - 60.f;
|
||||
|
||||
|
||||
float centeredShiftX = ((W - nameX - 48.f - 60.f) - bodyMaxWidthPx)*0.5;
|
||||
|
||||
UiRect portraitRect{ 24.0f + 90 + centeredShiftX, 24.0f + 16, 176.0f, 176.0f };
|
||||
UiRect textboxRect{ 30.f + centeredShiftX, -48.f, 1222.f, 340.0f };
|
||||
UiRect textboxChoiceRect{ 30.f + centeredShiftX, -90.f, 1200.f, 619.5f };
|
||||
|
||||
lastDialogueAdvanceRect = { portraitRect.x, portraitRect.y, textboxRect.x + textboxRect.w - portraitRect.x, textboxRect.h };
|
||||
|
||||
@@ -119,10 +128,6 @@ void DialogueOverlay::draw(Renderer& renderer, const PresentationModel& model) {
|
||||
renderer.shaderManager.PopShader();
|
||||
|
||||
|
||||
const float nameX = 312+8;
|
||||
const float nameY = 232 - 38.0f;
|
||||
const float bodyX = 312+8;
|
||||
const float bodyY = 232 - 78.0f;
|
||||
|
||||
lastChoiceRects.clear();
|
||||
|
||||
@@ -130,18 +135,17 @@ void DialogueOverlay::draw(Renderer& renderer, const PresentationModel& model) {
|
||||
|
||||
if (model.mode == PresentationMode::Choice)
|
||||
{
|
||||
nameRenderer->drawText(model.speaker, nameX+20, nameY+230, 1.0f, false, { 1.0f, 0.88f, 0.45f, 1.0f });
|
||||
nameRenderer->drawText(model.speaker, nameX+20 + centeredShiftX, nameY+230, 1.0f, false, { 1.0f, 0.88f, 0.45f, 1.0f });
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
nameRenderer->drawText(model.speaker, nameX, nameY, 1.0f, false, { 1.0f, 0.88f, 0.45f, 1.0f });
|
||||
nameRenderer->drawText(model.speaker, nameX + centeredShiftX, nameY, 1.0f, false, { 1.0f, 0.88f, 0.45f, 1.0f });
|
||||
}
|
||||
}
|
||||
|
||||
const float bodyMaxWidthPx = W - nameX - 48.f - 60.f;
|
||||
const std::string wrappedBody = wrapTextToWidth(model.visibleText, *bodyRenderer, bodyMaxWidthPx, 1.0f);
|
||||
bodyRenderer->drawText(wrappedBody, bodyX, bodyY, 1.0f, false, { 1.0f, 1.0f, 1.0f, 1.0f });
|
||||
bodyRenderer->drawText(wrappedBody, bodyX + centeredShiftX, bodyY, 1.0f, false, { 1.0f, 1.0f, 1.0f, 1.0f });
|
||||
|
||||
|
||||
if (model.mode == PresentationMode::Choice) {
|
||||
@@ -166,7 +170,7 @@ void DialogueOverlay::draw(Renderer& renderer, const PresentationModel& model) {
|
||||
|
||||
for (size_t i = 0; i < model.choices.size(); ++i) {
|
||||
const float cy = choiceStartY + (choiceHeight + choiceSpacing) * static_cast<float>(model.choices.size() - 1 - i);
|
||||
UiRect rect{ 320.f, cy, choiceWidth, choiceHeight };
|
||||
UiRect rect{ 320.f + centeredShiftX , cy, choiceWidth, choiceHeight };
|
||||
lastChoiceRects.push_back(rect);
|
||||
choiceQuads[i].rebuild(rect);
|
||||
|
||||
|
||||
Reference in new issue
Block a user