1
0
mirror of https://github.com/blupi-games/planetblupi synced 2024-12-30 10:15:36 +01:00

Continue fixing positions for right2left layout (hebrew)

This commit is contained in:
Mathieu Schroeter 2019-02-02 13:55:52 +01:00
parent 908383e29a
commit 94df6a2210
2 changed files with 72 additions and 23 deletions

View File

@ -2426,14 +2426,18 @@ CEvent::DrawButtons ()
{ {
Term * pTerm = m_pDecor->GetTerminated (); Term * pTerm = m_pDecor->GetTerminated ();
DrawTextCenter ( auto x = (10 + 134) / 2 + LXOFFSET ();
gettext ("Ending conditions"), (10 + 134) / 2 + LXOFFSET (), 20); if (IsRightReading ())
x = LXIMAGE () - x;
DrawTextCenter (gettext ("Ending conditions"), x, 20);
pos.x = 170 + 42 * 2 + 4 + LXOFFSET (); pos.x = 170 + 42 * 2 + 4 + LXOFFSET ();
pos.y = 30 + 12 + 42 * 4; pos.y = 30 + 12 + 42 * 4;
snprintf ( snprintf (
text, sizeof (text), gettext ("Lost if less than %d Blupi"), text, sizeof (text), gettext ("Lost if less than %d Blupi"),
pTerm->nbMinBlupi); pTerm->nbMinBlupi);
if (IsRightReading ())
pos.x = LXIMAGE () - pos.x;
DrawText (m_pPixmap, pos, text); DrawText (m_pPixmap, pos, text);
pos.x = 170 + 42 * 2 + 4 + LXOFFSET (); pos.x = 170 + 42 * 2 + 4 + LXOFFSET ();
@ -2441,22 +2445,37 @@ CEvent::DrawButtons ()
snprintf ( snprintf (
text, sizeof (text), gettext ("Impossible to win if less than %d Blupi"), text, sizeof (text), gettext ("Impossible to win if less than %d Blupi"),
pTerm->nbMaxBlupi); pTerm->nbMaxBlupi);
if (IsRightReading ())
pos.x = LXIMAGE () - pos.x;
DrawText (m_pPixmap, pos, text); DrawText (m_pPixmap, pos, text);
} }
// Dessine les textes pour les choix des boutons. // Dessine les textes pour les choix des boutons.
if (m_phase == EV_PHASE_BUTTON) if (m_phase == EV_PHASE_BUTTON)
DrawTextCenter ( {
gettext ("Available buttons"), (10 + 134) / 2 + LXOFFSET (), 20); auto x = (10 + 134) / 2 + LXOFFSET ();
if (IsRightReading ())
x = LXIMAGE () - x;
DrawTextCenter (gettext ("Available buttons"), x, 20);
}
// Dessine les textes pour le choix des musiques. // Dessine les textes pour le choix des musiques.
if (m_phase == EV_PHASE_MUSIC) if (m_phase == EV_PHASE_MUSIC)
DrawTextCenter (gettext ("Music choice"), (10 + 134) / 2 + LXOFFSET (), 20); {
auto x = (10 + 134) / 2 + LXOFFSET ();
if (IsRightReading ())
x = LXIMAGE () - x;
DrawTextCenter (gettext ("Music choice"), x, 20);
}
// Dessine les textes pour le choix de la région. // Dessine les textes pour le choix de la région.
if (m_phase == EV_PHASE_REGION) if (m_phase == EV_PHASE_REGION)
DrawTextCenter ( {
gettext ("Scenery choice"), (10 + 134) / 2 + LXOFFSET (), 20); auto x = (10 + 134) / 2 + LXOFFSET ();
if (IsRightReading ())
x = LXIMAGE () - x;
DrawTextCenter (gettext ("Scenery choice"), x, 20);
}
// Ajoute "Mission numéro". // Ajoute "Mission numéro".
if (m_phase == EV_PHASE_INFO) if (m_phase == EV_PHASE_INFO)
@ -2478,6 +2497,8 @@ CEvent::DrawButtons ()
pos.x -= 100; pos.x -= 100;
if (m_bPrivate) if (m_bPrivate)
pos.y += 14; pos.y += 14;
if (IsRightReading ())
pos.x = LXIMAGE () - pos.x;
DrawText (m_pPixmap, pos, res, FONTSLIM); DrawText (m_pPixmap, pos, res, FONTSLIM);
} }
@ -2494,6 +2515,8 @@ CEvent::DrawButtons ()
pos.x -= 100; pos.x -= 100;
if (m_bPrivate) if (m_bPrivate)
pos.y += 14; pos.y += 14;
if (IsRightReading ())
pos.x = LXIMAGE () - pos.x;
DrawText (m_pPixmap, pos, text, FONTRED); DrawText (m_pPixmap, pos, text, FONTRED);
} }
@ -2510,6 +2533,8 @@ CEvent::DrawButtons ()
pos.x -= 100; pos.x -= 100;
if (m_bPrivate) if (m_bPrivate)
pos.y += 14; pos.y += 14;
if (IsRightReading ())
pos.x = LXIMAGE () - pos.x;
DrawText (m_pPixmap, pos, text, FONTRED); DrawText (m_pPixmap, pos, text, FONTRED);
} }
@ -2526,6 +2551,7 @@ CEvent::DrawButtons ()
world = m_private; world = m_private;
lg = GetBignumWidth (world + 1); lg = GetBignumWidth (world + 1);
lg = IsRightReading () ? -lg : lg;
pos.x = (140 + 270) / 2 - lg / 2 + LXOFFSET (); pos.x = (140 + 270) / 2 - lg / 2 + LXOFFSET ();
pos.y = 100; pos.y = 100;
if (m_bSchool) if (m_bSchool)
@ -2534,6 +2560,8 @@ CEvent::DrawButtons ()
pos.x -= 135; pos.x -= 135;
if (m_bPrivate) if (m_bPrivate)
pos.y = 115; pos.y = 115;
if (IsRightReading ())
pos.x = LXIMAGE () - pos.x;
DrawBignum (m_pPixmap, pos, world + 1); DrawBignum (m_pPixmap, pos, world + 1);
} }
@ -2542,6 +2570,7 @@ CEvent::DrawButtons ()
{ {
if (!m_bSchool) if (!m_bSchool)
{ {
std::string text;
if (m_pDecor->GetSkill () == 0) if (m_pDecor->GetSkill () == 0)
{ {
if (m_bPrivate) if (m_bPrivate)
@ -2555,10 +2584,9 @@ CEvent::DrawButtons ()
pos.y = 230 + 13; pos.y = 230 + 13;
} }
pos.x += LXOFFSET (); pos.x += LXOFFSET ();
DrawText (m_pPixmap, pos, gettext ("Easy"), FONTSLIM); text = gettext ("Easy");
} }
else if (m_pDecor->GetSkill () == 1)
if (m_pDecor->GetSkill () == 1)
{ {
if (m_bPrivate) if (m_bPrivate)
{ {
@ -2571,8 +2599,12 @@ CEvent::DrawButtons ()
pos.y = 230 + 42 + 13; pos.y = 230 + 42 + 13;
} }
pos.x += LXOFFSET (); pos.x += LXOFFSET ();
DrawText (m_pPixmap, pos, gettext ("Difficult"), FONTSLIM); text = gettext ("Difficult");
} }
if (IsRightReading ())
pos.x = LXIMAGE () - pos.x;
DrawText (m_pPixmap, pos, text.c_str (), FONTSLIM);
} }
} }
@ -2614,6 +2646,8 @@ CEvent::DrawButtons ()
pos.x = 60 + LXOFFSET (); pos.x = 60 + LXOFFSET ();
pos.y = 443; pos.y = 443;
if (IsRightReading ())
pos.x = LXIMAGE () - pos.x;
DrawText (m_pPixmap, pos, list[GetWorld () % 5]); DrawText (m_pPixmap, pos, list[GetWorld () % 5]);
} }
@ -2628,6 +2662,8 @@ CEvent::DrawButtons ()
pos.x = 60 + LXOFFSET (); pos.x = 60 + LXOFFSET ();
pos.y = 443; pos.y = 443;
if (IsRightReading ())
pos.x = LXIMAGE () - pos.x;
DrawText (m_pPixmap, pos, list[GetWorld () % 5]); DrawText (m_pPixmap, pos, list[GetWorld () % 5]);
} }
@ -2645,6 +2681,8 @@ CEvent::DrawButtons ()
pos.x = 60 + LXOFFSET (); pos.x = 60 + LXOFFSET ();
pos.y = 443; pos.y = 443;
if (IsRightReading ())
pos.x = LXIMAGE () - pos.x;
DrawText (m_pPixmap, pos, text); DrawText (m_pPixmap, pos, text);
} }
@ -2661,18 +2699,21 @@ CEvent::DrawButtons ()
snprintf (res, sizeof (res), "x%d", m_speed); snprintf (res, sizeof (res), "x%d", m_speed);
lg = GetTextWidth (res); lg = GetTextWidth (res);
lg = IsRightReading () ? -lg : lg;
pos.x = (54 + 40) - lg / 2 + LXOFFSET (); pos.x = (54 + 40) - lg / 2 + LXOFFSET ();
pos.y = 330 - 20; pos.y = 330 - 20;
DrawText (m_pPixmap, pos, res); DrawText (m_pPixmap, pos, res);
snprintf (res, sizeof (res), "%d", m_pSound->GetAudioVolume ()); snprintf (res, sizeof (res), "%d", m_pSound->GetAudioVolume ());
lg = GetTextWidth (res); lg = GetTextWidth (res);
lg = IsRightReading () ? -lg : lg;
pos.x = (284 + 40) - lg / 2 + LXOFFSET (); pos.x = (284 + 40) - lg / 2 + LXOFFSET ();
pos.y = 330 - 20; pos.y = 330 - 20;
DrawText (m_pPixmap, pos, res); DrawText (m_pPixmap, pos, res);
snprintf (res, sizeof (res), "%d", m_pSound->GetMidiVolume ()); snprintf (res, sizeof (res), "%d", m_pSound->GetMidiVolume ());
lg = GetTextWidth (res); lg = GetTextWidth (res);
lg = IsRightReading () ? -lg : lg;
pos.x = (399 + 40) - lg / 2 + LXOFFSET (); pos.x = (399 + 40) - lg / 2 + LXOFFSET ();
pos.y = 330 - 20; pos.y = 330 - 20;
DrawText (m_pPixmap, pos, res); DrawText (m_pPixmap, pos, res);
@ -2681,6 +2722,7 @@ CEvent::DrawButtons ()
if (m_pMovie->GetEnable () && m_bMovie) if (m_pMovie->GetEnable () && m_bMovie)
text = gettext ("Yes"); text = gettext ("Yes");
lg = GetTextWidth (text); lg = GetTextWidth (text);
lg = IsRightReading () ? -lg : lg;
pos.x = (514 + 40) - lg / 2 + LXOFFSET (); pos.x = (514 + 40) - lg / 2 + LXOFFSET ();
pos.y = 330 - 20; pos.y = 330 - 20;
DrawText (m_pPixmap, pos, text); DrawText (m_pPixmap, pos, text);
@ -2690,6 +2732,7 @@ CEvent::DrawButtons ()
else else
snprintf (res, sizeof (res), "%d", m_scrollSpeed); snprintf (res, sizeof (res), "%d", m_scrollSpeed);
lg = GetTextWidth (res); lg = GetTextWidth (res);
lg = IsRightReading () ? -lg : lg;
pos.x = (169 + 40) - lg / 2 + LXOFFSET (); pos.x = (169 + 40) - lg / 2 + LXOFFSET ();
pos.y = 330 - 20; pos.y = 330 - 20;
DrawText (m_pPixmap, pos, res); DrawText (m_pPixmap, pos, res);
@ -2733,6 +2776,7 @@ CEvent::DrawButtons ()
lang = "עברי"; lang = "עברי";
lg = GetTextWidth (lang.c_str ()); lg = GetTextWidth (lang.c_str ());
lg = IsRightReading () ? -lg : lg;
pos.x = (54 + 40) - lg / 2 + LXOFFSET (); pos.x = (54 + 40) - lg / 2 + LXOFFSET ();
pos.y = 330 - 20; pos.y = 330 - 20;
DrawText (m_pPixmap, pos, lang.c_str ()); DrawText (m_pPixmap, pos, lang.c_str ());
@ -2740,6 +2784,7 @@ CEvent::DrawButtons ()
const char * text = const char * text =
g_bFullScreen ? gettext ("Fullscreen") : gettext ("Windowed"); g_bFullScreen ? gettext ("Fullscreen") : gettext ("Windowed");
lg = GetTextWidth (text); lg = GetTextWidth (text);
lg = IsRightReading () ? -lg : lg;
pos.x = (169 + 40) - lg / 2 + LXOFFSET (); pos.x = (169 + 40) - lg / 2 + LXOFFSET ();
pos.y = 330 - 20; pos.y = 330 - 20;
DrawText (m_pPixmap, pos, text); DrawText (m_pPixmap, pos, text);
@ -2752,12 +2797,14 @@ CEvent::DrawButtons ()
g_zoom == 2 ? gettext ("Legacy") : gettext ("Desktop")); g_zoom == 2 ? gettext ("Legacy") : gettext ("Desktop"));
lg = GetTextWidth (res); lg = GetTextWidth (res);
lg = IsRightReading () ? -lg : lg;
pos.x = (284 + 40) - lg / 2 + LXOFFSET (); pos.x = (284 + 40) - lg / 2 + LXOFFSET ();
pos.y = 330 - 20; pos.y = 330 - 20;
DrawText (m_pPixmap, pos, res); DrawText (m_pPixmap, pos, res);
text = (g_restoreMidi && mid) || !ogg ? gettext ("Midi") : gettext ("Ogg"); text = (g_restoreMidi && mid) || !ogg ? gettext ("Midi") : gettext ("Ogg");
lg = GetTextWidth (text); lg = GetTextWidth (text);
lg = IsRightReading () ? -lg : lg;
pos.x = (399 + 40) - lg / 2 + LXOFFSET (); pos.x = (399 + 40) - lg / 2 + LXOFFSET ();
pos.y = 330 - 20; pos.y = 330 - 20;
DrawText (m_pPixmap, pos, text); DrawText (m_pPixmap, pos, text);
@ -2767,6 +2814,7 @@ CEvent::DrawButtons ()
? (g_renderQuality ? gettext ("Anti-aliasing") : gettext ("Aliasing")) ? (g_renderQuality ? gettext ("Anti-aliasing") : gettext ("Aliasing"))
: gettext ("Not available"); : gettext ("Not available");
lg = GetTextWidth (text); lg = GetTextWidth (text);
lg = IsRightReading () ? -lg : lg;
pos.x = (514 + 40) - lg / 2 + LXOFFSET (); pos.x = (514 + 40) - lg / 2 + LXOFFSET ();
pos.y = 330 - 20; pos.y = 330 - 20;
DrawText (m_pPixmap, pos, text); DrawText (m_pPixmap, pos, text);
@ -2779,6 +2827,7 @@ CEvent::DrawButtons ()
text = gettext ("You have played Planet Blupi."); text = gettext ("You have played Planet Blupi.");
lg = GetTextWidth (text); lg = GetTextWidth (text);
lg = IsRightReading () ? -lg : lg;
pos.x = LXIMAGE () / 2 - lg / 2; pos.x = LXIMAGE () / 2 - lg / 2;
pos.y = 20; pos.y = 20;
DrawText (m_pPixmap, pos, text); DrawText (m_pPixmap, pos, text);
@ -2786,6 +2835,7 @@ CEvent::DrawButtons ()
text = gettext ("We hope you have had as much fun playing the game as we " text = gettext ("We hope you have had as much fun playing the game as we "
"had making it !"); "had making it !");
lg = GetTextWidth (text); lg = GetTextWidth (text);
lg = IsRightReading () ? -lg : lg;
pos.x = LXIMAGE () / 2 - lg / 2; pos.x = LXIMAGE () / 2 - lg / 2;
pos.y = 40; pos.y = 40;
DrawText (m_pPixmap, pos, text); DrawText (m_pPixmap, pos, text);
@ -2811,6 +2861,8 @@ CEvent::DrawButtons ()
for (size_t i = 0; i < countof (libs); ++i) for (size_t i = 0; i < countof (libs); ++i)
{ {
pos.x = 30 + LXOFFSET (); pos.x = 30 + LXOFFSET ();
if (IsRightReading ())
pos.x = LXIMAGE () - pos.x;
pos.y = 120 + i * 20; pos.y = 120 + i * 20;
DrawText (m_pPixmap, pos, libs[i].c_str ()); DrawText (m_pPixmap, pos, libs[i].c_str ());
} }
@ -2818,12 +2870,14 @@ CEvent::DrawButtons ()
text = gettext ("This game is an original creation of Epsitec SA, CH-1400 " text = gettext ("This game is an original creation of Epsitec SA, CH-1400 "
"Yverdon-les-Bains"); "Yverdon-les-Bains");
lg = GetTextWidth (text); lg = GetTextWidth (text);
lg = IsRightReading () ? -lg : lg;
pos.x = LXIMAGE () / 2 - lg / 2; pos.x = LXIMAGE () / 2 - lg / 2;
pos.y = 430; pos.y = 430;
DrawText (m_pPixmap, pos, text); DrawText (m_pPixmap, pos, text);
text = gettext ("http://www.blupi.org info@blupi.org"); text = gettext ("http://www.blupi.org info@blupi.org");
lg = GetTextWidth (text); lg = GetTextWidth (text);
lg = IsRightReading () ? -lg : lg;
pos.x = LXIMAGE () / 2 - lg / 2; pos.x = LXIMAGE () / 2 - lg / 2;
pos.y = 450; pos.y = 450;
DrawText (m_pPixmap, pos, text); DrawText (m_pPixmap, pos, text);

View File

@ -187,6 +187,9 @@ DrawText (CPixmap * pPixmap, Point pos, const char * pText, Sint32 font)
rank = GetOffset (pText); rank = GetOffset (pText);
auto inc = rank > 127; auto inc = rank > 127;
if (IsRightReading ())
pos.x += -GetCharWidth (pText, font);
if (font != FONTLITTLE) if (font != FONTLITTLE)
{ {
rank += 256 * font; rank += 256 * font;
@ -195,20 +198,12 @@ DrawText (CPixmap * pPixmap, Point pos, const char * pText, Sint32 font)
else else
pPixmap->DrawIcon (-1, CHLITTLE, rank, pos); pPixmap->DrawIcon (-1, CHLITTLE, rank, pos);
if (IsRightReading ()) if (!IsRightReading ())
{
if (inc)
pText++;
pText++;
pos.x += -GetCharWidth (pText, font);
}
else
{
pos.x += GetCharWidth (pText, font); pos.x += GetCharWidth (pText, font);
if (inc)
pText++; if (inc)
pText++; pText++;
} pText++;
} }
} }