mirror of
https://github.com/blupi-games/planetblupi
synced 2024-12-30 10:15:36 +01:00
Continue right2left layout and reading
This commit is contained in:
parent
743f460402
commit
3cd52b699d
@ -1538,7 +1538,7 @@ term:
|
||||
const auto text = GetResHili (posMouse);
|
||||
if (text)
|
||||
{
|
||||
posMouse.x += 10;
|
||||
posMouse.x += IsRightReading () ? 0 : 10;
|
||||
posMouse.y += 20;
|
||||
DrawText (m_pPixmap, posMouse, text);
|
||||
}
|
||||
@ -1843,7 +1843,8 @@ CDecor::CelOkForAction (
|
||||
GetFloor (cel, channel, icon);
|
||||
if ( // mine ?
|
||||
action == EV_ACTION_BUILD4 &&
|
||||
((!g_restoreBugs && !m_decorMem[cel.x / 2][cel.y / 2].flagged) || // fixed
|
||||
((!g_restoreBugs &&
|
||||
!m_decorMem[cel.x / 2][cel.y / 2].flagged) || // fixed
|
||||
(g_restoreBugs && (channel != CHFLOOR || icon != 71)))) // funny bug
|
||||
{
|
||||
error = Errors::GROUND; // sol pas adéquat
|
||||
@ -3504,4 +3505,4 @@ void
|
||||
CDecor::InvalidateGrounds ()
|
||||
{
|
||||
m_bGroundRedraw = true;
|
||||
}
|
||||
}
|
||||
|
@ -2294,28 +2294,30 @@ CEvent::DrawButtons ()
|
||||
}
|
||||
m_menu.Draw ();
|
||||
|
||||
auto offset = IsRightReading () ? POSDRAWX + DIMDRAWX : 0;
|
||||
|
||||
// Dessine la rose des vents.
|
||||
if (!m_bPause && !m_bDemoPlay)
|
||||
{
|
||||
DrawTextCenter (gettext ("N"), (10 + 134) / 2, 17);
|
||||
DrawTextCenter (gettext ("S"), (10 + 134) / 2, 126);
|
||||
DrawTextCenter (gettext ("W"), 14, 70);
|
||||
DrawTextCenter (gettext ("E"), 129, 70);
|
||||
DrawTextCenter (gettext ("N"), (10 + 134) / 2 + offset, 17);
|
||||
DrawTextCenter (gettext ("S"), (10 + 134) / 2 + offset, 126);
|
||||
DrawTextCenter (gettext ("W"), 14 + offset, 70);
|
||||
DrawTextCenter (gettext ("E"), 129 + offset, 70);
|
||||
}
|
||||
|
||||
// Dessine la pause.
|
||||
if (m_bPause)
|
||||
DrawTextCenter (gettext ("Game paused"), (10 + 134) / 2, 20);
|
||||
DrawTextCenter (gettext ("Game paused"), (10 + 134) / 2 + offset, 20);
|
||||
else
|
||||
{
|
||||
if (m_bDemoRec) // recording demo ?
|
||||
DrawTextCenter (gettext ("REC"), (10 + 38) / 2, 20, FONTRED);
|
||||
DrawTextCenter (gettext ("REC"), (10 + 38) / 2 + offset, 20, FONTRED);
|
||||
if (m_bDemoPlay) // playing demo ?
|
||||
DrawTextCenter (gettext ("Demo"), (10 + 134) / 2, 20, FONTRED);
|
||||
DrawTextCenter (gettext ("Demo"), (10 + 134) / 2 + offset, 20, FONTRED);
|
||||
}
|
||||
|
||||
// Dessine la vitesse.
|
||||
pos.x = 64;
|
||||
pos.x = IsRightReading () ? LXIMAGE () - 64 : 64;
|
||||
pos.y = LYIMAGE () - 15;
|
||||
rect.left = pos.x;
|
||||
rect.right = pos.x + 20;
|
||||
@ -3117,7 +3119,7 @@ CEvent::EventButtons (const SDL_Event & event, Point pos)
|
||||
{
|
||||
snprintf (m_textToolTips, sizeof (m_textToolTips), "%s", text);
|
||||
lg = GetTextWidth (m_textToolTips);
|
||||
pos.x += IsRightReading () ? -10 : 10;
|
||||
pos.x += IsRightReading () ? 0 : 10;
|
||||
pos.y += 20;
|
||||
if (pos.x > LXIMAGE () + (IsRightReading () ? 0 : -lg))
|
||||
pos.x = LXIMAGE () - lg;
|
||||
|
34
src/text.cxx
34
src/text.cxx
@ -180,10 +180,34 @@ GetCharWidth (const char *& c, Sint32 font)
|
||||
void
|
||||
DrawText (CPixmap * pPixmap, Point pos, const char * pText, Sint32 font)
|
||||
{
|
||||
Sint32 rank;
|
||||
Sint32 rank;
|
||||
bool isNumber = false;
|
||||
int numberSize = 0;
|
||||
const char * it = nullptr;
|
||||
int skip = 0;
|
||||
|
||||
while (*pText != '\0')
|
||||
while (*pText != '\0' || skip)
|
||||
{
|
||||
if (IsRightReading () && numberSize == 0)
|
||||
{
|
||||
it = pText;
|
||||
isNumber = *pText >= '0' && *pText <= '9';
|
||||
if (isNumber)
|
||||
{
|
||||
while (*pText >= '0' && *pText <= '9')
|
||||
++pText;
|
||||
|
||||
numberSize = pText - it;
|
||||
skip = numberSize - 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (numberSize)
|
||||
{
|
||||
pText = it + numberSize - 1;
|
||||
numberSize--;
|
||||
}
|
||||
|
||||
rank = GetOffset (pText);
|
||||
auto inc = rank > 127;
|
||||
|
||||
@ -201,6 +225,12 @@ DrawText (CPixmap * pPixmap, Point pos, const char * pText, Sint32 font)
|
||||
if (!IsRightReading ())
|
||||
pos.x += GetCharWidth (pText, font);
|
||||
|
||||
if (!numberSize && skip > 0)
|
||||
{
|
||||
pText += skip;
|
||||
skip = 0;
|
||||
}
|
||||
|
||||
if (inc)
|
||||
pText++;
|
||||
pText++;
|
||||
|
Loading…
x
Reference in New Issue
Block a user