Working on UI fixing
This commit is contained in:
parent
a4032d769e
commit
dee9615483
@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
|
||||
<title>Bishkek Witcher</title>
|
||||
<title>Shadow Over Bishkek</title>
|
||||
<style>
|
||||
body, html {
|
||||
margin: 0; padding: 0; width: 100%; height: 100%;
|
||||
|
||||
@ -224,6 +224,7 @@ namespace ZL
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
uniInteriorParams.navigationJsonPaths = {
|
||||
"resources/navigation/uni_interior4_unlocked_n2.json", //0
|
||||
@ -872,7 +873,7 @@ namespace ZL
|
||||
|
||||
break;
|
||||
case SDLK_e:
|
||||
currentLocation->dialogueSystem.startCutscene("lection_cutscene001"); //.startDialogue("test_cutscene_pan_dialogue");
|
||||
//currentLocation->dialogueSystem.startCutscene("lection_cutscene001"); //.startDialogue("test_cutscene_pan_dialogue");
|
||||
break;
|
||||
|
||||
|
||||
|
||||
@ -89,8 +89,6 @@ namespace ZL {
|
||||
hudRoot = loadUiFromFile("resources/w/ui/hud_step0.json", renderer, zipFile);
|
||||
hudStep1Root = loadUiFromFile("resources/w/ui/hud_step1.json", renderer, zipFile);
|
||||
hudStep2Root = loadUiFromFile("resources/w/ui/hud_step2.json", renderer, zipFile);
|
||||
hudStep1Root = loadUiFromFile("resources/w/ui/hud_uni_int_step11.json", renderer, zipFile);
|
||||
hudStep2Root = loadUiFromFile("resources/w/ui/hud_uni_int_step11.json", renderer, zipFile);
|
||||
hudStep3Root = loadUiFromFile("resources/w/ui/hud_step3.json", renderer, zipFile);
|
||||
hudStep4Root = loadUiFromFile("resources/w/ui/hud_step4.json", renderer, zipFile);
|
||||
hudStep5aRoot = loadUiFromFile("resources/w/ui/hud_step5a.json", renderer, zipFile);
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -175,7 +175,7 @@ extern "C" int SDL_main(int argc, char* argv[]) {
|
||||
|
||||
|
||||
ZL::Environment::window = SDL_CreateWindow(
|
||||
"Bishkek Witcher Game",
|
||||
"Shadow Over Bishkek",
|
||||
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
|
||||
ZL::Environment::width, ZL::Environment::height,
|
||||
SDL_WINDOW_FULLSCREEN | SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN
|
||||
@ -263,7 +263,7 @@ int main(int argc, char *argv[]) {
|
||||
#endif
|
||||
|
||||
ZL::Environment::window = SDL_CreateWindow(
|
||||
"Bishkek Witcher Game",
|
||||
"Shadow Over Bishkek",
|
||||
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
||||
ZL::Environment::width, ZL::Environment::height,
|
||||
windowFlags
|
||||
|
||||
Loading…
Reference in New Issue
Block a user