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

Add localized image support (init hebrew screen)

This commit is contained in:
Mathieu Schroeter 2019-02-05 21:54:32 +01:00
parent 352fc7ba3b
commit 7482ddb3d6
5 changed files with 79 additions and 74 deletions

BIN
resources/image/he/init.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

View File

@ -361,7 +361,7 @@ HandleEvent (const SDL_Event & event)
totalDim.y = 66;
iconDim.x = 64;
iconDim.y = 66 / 2;
g_pPixmap->Cache (CHHILI, "image/hili.png", totalDim, iconDim);
g_pPixmap->Cache (CHHILI, "hili.png", totalDim, iconDim);
}
SDL_SetWindowTitle (g_window, gettext ("Planet Blupi"));
if (g_pSound != nullptr)
@ -865,9 +865,9 @@ DoInit (int argc, char * argv[], bool & exit)
iconDim.x = 0;
iconDim.y = 0;
#if _INTRO
if (!g_pPixmap->Cache (CHBACK, "image/intro1.png", totalDim, iconDim))
if (!g_pPixmap->Cache (CHBACK, "intro1.png", totalDim, iconDim))
#else
if (!g_pPixmap->Cache (CHBACK, "image/init.png", totalDim, iconDim))
if (!g_pPixmap->Cache (CHBACK, "init.png", totalDim, iconDim))
#endif
return EXIT_FAILURE;
@ -888,7 +888,7 @@ DoInit (int argc, char * argv[], bool & exit)
totalDim.y = DIMCELY * 2 * 6;
iconDim.x = DIMCELX * 2;
iconDim.y = DIMCELY * 2;
if (!g_pPixmap->Cache (CHFLOOR, "image/floor000.png", totalDim, iconDim))
if (!g_pPixmap->Cache (CHFLOOR, "floor000.png", totalDim, iconDim))
{
InitFail ("Cache floor000.png");
return EXIT_FAILURE;
@ -898,13 +898,13 @@ DoInit (int argc, char * argv[], bool & exit)
totalDim.y = DIMOBJY * 8;
iconDim.x = DIMOBJX;
iconDim.y = DIMOBJY;
if (!g_pPixmap->Cache (CHOBJECT, "image/obj000.png", totalDim, iconDim))
if (!g_pPixmap->Cache (CHOBJECT, "obj000.png", totalDim, iconDim))
{
InitFail ("Cache obj000.png");
return EXIT_FAILURE;
}
if (!g_pPixmap->Cache (CHOBJECTo, "image/obj-o000.png", totalDim, iconDim))
if (!g_pPixmap->Cache (CHOBJECTo, "obj-o000.png", totalDim, iconDim))
{
InitFail ("Cache obj-o000.png");
return EXIT_FAILURE;
@ -914,7 +914,7 @@ DoInit (int argc, char * argv[], bool & exit)
totalDim.y = DIMBLUPIY * 23;
iconDim.x = DIMBLUPIX;
iconDim.y = DIMBLUPIY;
if (!g_pPixmap->Cache (CHBLUPI, "image/blupi.png", totalDim, iconDim))
if (!g_pPixmap->Cache (CHBLUPI, "blupi.png", totalDim, iconDim))
{
InitFail ("Cache blupi.png");
return EXIT_FAILURE;
@ -924,7 +924,7 @@ DoInit (int argc, char * argv[], bool & exit)
totalDim.y = 66;
iconDim.x = 64;
iconDim.y = 66 / 2;
if (!g_pPixmap->Cache (CHHILI, "image/hili.png", totalDim, iconDim))
if (!g_pPixmap->Cache (CHHILI, "hili.png", totalDim, iconDim))
{
InitFail ("Cache hili.png");
return EXIT_FAILURE;
@ -934,7 +934,7 @@ DoInit (int argc, char * argv[], bool & exit)
totalDim.y = DIMCELY * 2 * 5;
iconDim.x = DIMCELX * 2;
iconDim.y = DIMCELY * 2;
if (!g_pPixmap->Cache (CHFOG, "image/fog.png", totalDim, iconDim))
if (!g_pPixmap->Cache (CHFOG, "fog.png", totalDim, iconDim))
{
InitFail ("Cache fog.png");
return EXIT_FAILURE;
@ -944,7 +944,7 @@ DoInit (int argc, char * argv[], bool & exit)
totalDim.y = DIMCELY * 2 * 1;
iconDim.x = DIMCELX * 2;
iconDim.y = DIMCELY * 2;
if (!g_pPixmap->Cache (CHMASK1, "image/mask1.png", totalDim, iconDim))
if (!g_pPixmap->Cache (CHMASK1, "mask1.png", totalDim, iconDim))
{
InitFail ("Cache mask1.png");
return EXIT_FAILURE;
@ -954,7 +954,7 @@ DoInit (int argc, char * argv[], bool & exit)
totalDim.y = DIMCELY * 2 * 1;
iconDim.x = DIMCELX * 2;
iconDim.y = DIMCELY * 2;
if (!g_pPixmap->Cache (CHMASK2, "image/mask2.png", totalDim, iconDim))
if (!g_pPixmap->Cache (CHMASK2, "mask2.png", totalDim, iconDim))
{
InitFail ("Cache mask2.png");
return EXIT_FAILURE;
@ -964,7 +964,7 @@ DoInit (int argc, char * argv[], bool & exit)
totalDim.y = DIMBUTTONY * 21;
iconDim.x = DIMBUTTONX;
iconDim.y = DIMBUTTONY;
if (!g_pPixmap->Cache (CHBUTTON, "image/button00.png", totalDim, iconDim))
if (!g_pPixmap->Cache (CHBUTTON, "button00.png", totalDim, iconDim))
{
InitFail ("Cache button00.png");
return EXIT_FAILURE;
@ -974,7 +974,7 @@ DoInit (int argc, char * argv[], bool & exit)
totalDim.y = DIMJAUGEY * 4;
iconDim.x = DIMJAUGEX;
iconDim.y = DIMJAUGEY;
if (!g_pPixmap->Cache (CHJAUGE, "image/jauge.png", totalDim, iconDim))
if (!g_pPixmap->Cache (CHJAUGE, "jauge.png", totalDim, iconDim))
{
InitFail ("Cache jauge.png");
return EXIT_FAILURE;
@ -984,7 +984,7 @@ DoInit (int argc, char * argv[], bool & exit)
totalDim.y = DIMTEXTY * 16 * 3;
iconDim.x = DIMTEXTX;
iconDim.y = DIMTEXTY;
if (!g_pPixmap->Cache (CHTEXT, "image/text.png", totalDim, iconDim))
if (!g_pPixmap->Cache (CHTEXT, "text.png", totalDim, iconDim))
{
InitFail ("Cache text.png");
return EXIT_FAILURE;
@ -994,7 +994,7 @@ DoInit (int argc, char * argv[], bool & exit)
totalDim.y = DIMLITTLEY * 16;
iconDim.x = DIMLITTLEX;
iconDim.y = DIMLITTLEY;
if (!g_pPixmap->Cache (CHLITTLE, "image/little.png", totalDim, iconDim))
if (!g_pPixmap->Cache (CHLITTLE, "little.png", totalDim, iconDim))
{
InitFail ("Cache little.png");
return EXIT_FAILURE;
@ -1004,7 +1004,7 @@ DoInit (int argc, char * argv[], bool & exit)
totalDim.y = 52;
iconDim.x = 426;
iconDim.y = 52;
if (!g_pPixmap->Cache (CHBIGNUM, "image/bignum.png", totalDim, iconDim))
if (!g_pPixmap->Cache (CHBIGNUM, "bignum.png", totalDim, iconDim))
{
InitFail ("Cache bignum.png");
return EXIT_FAILURE;

View File

@ -248,7 +248,7 @@ CDecor::LoadImages ()
totalDim.y = DIMCELY * 2 * 6;
iconDim.x = DIMCELX * 2;
iconDim.y = DIMCELY * 2;
snprintf (filename, sizeof (filename), "image/floor%.3d.png", m_region);
snprintf (filename, sizeof (filename), "floor%.3d.png", m_region);
if (!m_pPixmap->Cache (CHFLOOR, filename, totalDim, iconDim))
return false;
@ -256,11 +256,11 @@ CDecor::LoadImages ()
totalDim.y = DIMOBJY * 8;
iconDim.x = DIMOBJX;
iconDim.y = DIMOBJY;
snprintf (filename, sizeof (filename), "image/obj%.3d.png", m_region);
snprintf (filename, sizeof (filename), "obj%.3d.png", m_region);
if (!m_pPixmap->Cache (CHOBJECT, filename, totalDim, iconDim))
return false;
snprintf (filename, sizeof (filename), "image/obj-o%.3d.png", m_region);
snprintf (filename, sizeof (filename), "obj-o%.3d.png", m_region);
if (!m_pPixmap->Cache (CHOBJECTo, filename, totalDim, iconDim))
return false;

View File

@ -103,8 +103,8 @@ static Phase table[] =
{
{
EV_PHASE_TESTCD,
"image/init.png",
"image/back-stars.png",
"init.png",
"back-stars.png",
CPixmap::Mode::FIX,
false,
{
@ -116,7 +116,7 @@ static Phase table[] =
{
EV_PHASE_INTRO1,
"image/intro1.png",
"intro1.png",
"",
CPixmap::Mode::FIX,
false,
@ -129,8 +129,8 @@ static Phase table[] =
{
EV_PHASE_INIT,
"image/init.png",
"image/back-stars.png",
"init.png",
"back-stars.png",
CPixmap::Mode::FIX,
false,
{
@ -178,8 +178,8 @@ static Phase table[] =
{
EV_PHASE_HISTORY0,
"image/history0.png",
"image/back-book.png",
"history0.png",
"back-book.png",
CPixmap::Mode::FIX_REVERSABLE,
true,
{
@ -203,8 +203,8 @@ static Phase table[] =
{
EV_PHASE_HISTORY1,
"image/history1.png",
"image/back-book.png",
"history1.png",
"back-book.png",
CPixmap::Mode::FIX_REVERSABLE,
true,
{
@ -228,8 +228,8 @@ static Phase table[] =
{
EV_PHASE_INFO,
"image/info%.3d.png",
"image/back-book.png",
"info%.3d.png",
"back-book.png",
CPixmap::Mode::FIX_REVERSABLE,
false,
{
@ -295,7 +295,7 @@ static Phase table[] =
{
EV_PHASE_PLAY,
"image/play.png",
"play.png",
"",
CPixmap::Mode::EXPAND_REVERSABLE,
false,
@ -326,8 +326,8 @@ static Phase table[] =
{
EV_PHASE_STOP,
"image/stop%.3d.png",
"image/back-book.png",
"stop%.3d.png",
"back-book.png",
CPixmap::Mode::FIX_REVERSABLE,
false,
{
@ -375,8 +375,8 @@ static Phase table[] =
{
EV_PHASE_HELP,
"image/help.png",
"image/back-book.png",
"help.png",
"back-book.png",
CPixmap::Mode::FIX_REVERSABLE,
true,
{
@ -418,8 +418,8 @@ static Phase table[] =
{
EV_PHASE_SETUP,
"image/setup01.png",
"image/back-setup.png",
"setup01.png",
"back-setup.png",
CPixmap::Mode::FIX,
false,
{
@ -497,8 +497,8 @@ static Phase table[] =
{
EV_PHASE_SETUPp,
"image/setup01.png",
"image/back-setup.png",
"setup01.png",
"back-setup.png",
CPixmap::Mode::FIX,
false,
{
@ -576,8 +576,8 @@ static Phase table[] =
{
EV_PHASE_READ,
"image/read.png",
"image/back-chest-r.png",
"read.png",
"back-chest-r.png",
CPixmap::Mode::FIX_REVERSABLE,
false,
{
@ -655,8 +655,8 @@ static Phase table[] =
{
EV_PHASE_WRITE,
"image/write.png",
"image/back-chest-w.png",
"write.png",
"back-chest-w.png",
CPixmap::Mode::FIX_REVERSABLE,
false,
{
@ -734,8 +734,8 @@ static Phase table[] =
{
EV_PHASE_WRITEp,
"image/write.png",
"image/back-chest-w.png",
"write.png",
"back-chest-w.png",
CPixmap::Mode::FIX_REVERSABLE,
false,
{
@ -813,8 +813,8 @@ static Phase table[] =
{
EV_PHASE_LOST,
"image/lost.png",
"image/back-lost.png",
"lost.png",
"back-lost.png",
CPixmap::Mode::FIX,
true,
{
@ -832,8 +832,8 @@ static Phase table[] =
{
EV_PHASE_WIN,
"image/win.png",
"image/back-win.png",
"win.png",
"back-win.png",
CPixmap::Mode::FIX,
true,
{
@ -851,7 +851,7 @@ static Phase table[] =
{
EV_PHASE_LASTWIN,
"image/last%.3d.png",
"last%.3d.png",
"",
CPixmap::Mode::FIX,
true,
@ -870,7 +870,7 @@ static Phase table[] =
{
EV_PHASE_BUILD,
"image/build.png",
"build.png",
"",
CPixmap::Mode::EXPAND_REVERSABLE,
true,
@ -987,8 +987,8 @@ static Phase table[] =
{
EV_PHASE_BUTTON,
"image/button.png",
"image/back-build.png",
"button.png",
"back-build.png",
CPixmap::Mode::FIX_REVERSABLE,
true,
{
@ -1209,8 +1209,8 @@ static Phase table[] =
{
EV_PHASE_TERM,
"image/term.png",
"image/back-build.png",
"term.png",
"back-build.png",
CPixmap::Mode::FIX_REVERSABLE,
true,
{
@ -1300,8 +1300,8 @@ static Phase table[] =
{
EV_PHASE_MUSIC,
"image/music.png",
"image/back-build.png",
"music.png",
"back-build.png",
CPixmap::Mode::FIX_REVERSABLE,
true,
{
@ -1385,8 +1385,8 @@ static Phase table[] =
{
EV_PHASE_REGION,
"image/region.png",
"image/back-build.png",
"region.png",
"back-build.png",
CPixmap::Mode::FIX_REVERSABLE,
true,
{
@ -1428,7 +1428,7 @@ static Phase table[] =
{
EV_PHASE_PLAYMOVIE,
"image/movie.png",
"movie.png",
"",
CPixmap::Mode::FIX,
false,
@ -1441,7 +1441,7 @@ static Phase table[] =
{
EV_PHASE_WINMOVIE,
"image/movie.png",
"movie.png",
"",
CPixmap::Mode::FIX,
false,
@ -1454,7 +1454,7 @@ static Phase table[] =
{
EV_PHASE_H0MOVIE,
"image/movie.png",
"movie.png",
"",
CPixmap::Mode::FIX,
false,
@ -1467,7 +1467,7 @@ static Phase table[] =
{
EV_PHASE_H1MOVIE,
"image/movie.png",
"movie.png",
"",
CPixmap::Mode::FIX,
false,
@ -1480,7 +1480,7 @@ static Phase table[] =
{
EV_PHASE_H2MOVIE,
"image/movie.png",
"movie.png",
"",
CPixmap::Mode::FIX,
false,
@ -1493,8 +1493,8 @@ static Phase table[] =
{
EV_PHASE_BYE,
"image/bye.png",
"image/back-bye.png",
"bye.png",
"back-bye.png",
CPixmap::Mode::FIX,
false,
{
@ -1506,7 +1506,7 @@ static Phase table[] =
{
EV_PHASE_INSERT,
"image/insert.png",
"insert.png",
"",
CPixmap::Mode::FIX,
false,
@ -1525,8 +1525,8 @@ static Phase table[] =
{
EV_PHASE_SETTINGS,
"image/setup00.png",
"image/back-setup.png",
"setup00.png",
"back-setup.png",
CPixmap::Mode::FIX,
false,
{
@ -3386,13 +3386,13 @@ CEvent::LoadBackground ()
switch (id)
{
case 0:
backWideName = "image/back-disco.png";
backWideName = "back-disco.png";
break;
case 1:
backWideName = "image/back-stars.png";
backWideName = "back-stars.png";
break;
case 2:
backWideName = "image/back-win.png";
backWideName = "back-win.png";
break;
}
}

View File

@ -329,7 +329,11 @@ CPixmap::Cache (
size_t channel, const std::string & pFilename, Point totalDim, Point iconDim,
Mode mode, std::string wideName)
{
std::string file = GetBaseDir () + pFilename;
std::string absolute;
std::string file = GetBaseDir () + "image/" + GetLocale () + "/" + pFilename;
if (!FileExists (file, file, LOCATION_ABSOLUTE))
file = GetBaseDir () + "image/" + pFilename;
SDL_Surface * surface = IMG_Load (file.c_str ());
bool blupiChSet = false;
@ -394,7 +398,8 @@ CPixmap::Cache (
{
if (!wideName.empty ())
{
std::string file = GetBaseDir () + m_SDLTextureInfo[channel].wideName;
std::string file =
GetBaseDir () + "image/" + m_SDLTextureInfo[channel].wideName;
SDL_Surface * surface = IMG_Load (file.c_str ());
SDL_Texture * texture =
SDL_CreateTextureFromSurface (g_renderer, surface);