mirror of
https://github.com/blupi-games/planetblupi
synced 2024-12-30 10:15:36 +01:00
Optimize the wide background stuff by loading only on demand
It uses less memory.
This commit is contained in:
parent
22c06ac92e
commit
39a2cf926b
@ -847,81 +847,6 @@ DoInit (int argc, char * argv[], bool & exit)
|
|||||||
g_pPixmap->DrawImage (-1, CHBACK, rcRect); // dessine le fond
|
g_pPixmap->DrawImage (-1, CHBACK, rcRect); // dessine le fond
|
||||||
g_pPixmap->Display ();
|
g_pPixmap->Display ();
|
||||||
|
|
||||||
totalDim.x = LXLOGIC ();
|
|
||||||
totalDim.y = LYLOGIC ();
|
|
||||||
iconDim.x = 0;
|
|
||||||
iconDim.y = 0;
|
|
||||||
if (!g_pPixmap->Cache (
|
|
||||||
CHBACKSTARS, "image/back-stars.png", totalDim, iconDim))
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
|
|
||||||
totalDim.x = LXLOGIC ();
|
|
||||||
totalDim.y = LYLOGIC ();
|
|
||||||
iconDim.x = 0;
|
|
||||||
iconDim.y = 0;
|
|
||||||
if (!g_pPixmap->Cache (
|
|
||||||
CHBACKBUILD, "image/back-build.png", totalDim, iconDim))
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
|
|
||||||
totalDim.x = LXLOGIC ();
|
|
||||||
totalDim.y = LYLOGIC ();
|
|
||||||
iconDim.x = 0;
|
|
||||||
iconDim.y = 0;
|
|
||||||
if (!g_pPixmap->Cache (CHBACKBOOK, "image/back-book.png", totalDim, iconDim))
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
|
|
||||||
totalDim.x = LXLOGIC ();
|
|
||||||
totalDim.y = LYLOGIC ();
|
|
||||||
iconDim.x = 0;
|
|
||||||
iconDim.y = 0;
|
|
||||||
if (!g_pPixmap->Cache (
|
|
||||||
CHBACKSETUP, "image/back-setup.png", totalDim, iconDim))
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
|
|
||||||
totalDim.x = LXLOGIC ();
|
|
||||||
totalDim.y = LYLOGIC ();
|
|
||||||
iconDim.x = 0;
|
|
||||||
iconDim.y = 0;
|
|
||||||
if (!g_pPixmap->Cache (
|
|
||||||
CHBACKCHESTR, "image/back-chest-r.png", totalDim, iconDim))
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
|
|
||||||
totalDim.x = LXLOGIC ();
|
|
||||||
totalDim.y = LYLOGIC ();
|
|
||||||
iconDim.x = 0;
|
|
||||||
iconDim.y = 0;
|
|
||||||
if (!g_pPixmap->Cache (
|
|
||||||
CHBACKCHESTW, "image/back-chest-w.png", totalDim, iconDim))
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
|
|
||||||
totalDim.x = LXLOGIC ();
|
|
||||||
totalDim.y = LYLOGIC ();
|
|
||||||
iconDim.x = 0;
|
|
||||||
iconDim.y = 0;
|
|
||||||
if (!g_pPixmap->Cache (CHBACKWIN, "image/back-win.png", totalDim, iconDim))
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
|
|
||||||
totalDim.x = LXLOGIC ();
|
|
||||||
totalDim.y = LYLOGIC ();
|
|
||||||
iconDim.x = 0;
|
|
||||||
iconDim.y = 0;
|
|
||||||
if (!g_pPixmap->Cache (CHBACKWIN0, "image/back-disco.png", totalDim, iconDim))
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
|
|
||||||
totalDim.x = LXLOGIC ();
|
|
||||||
totalDim.y = LYLOGIC ();
|
|
||||||
iconDim.x = 0;
|
|
||||||
iconDim.y = 0;
|
|
||||||
if (!g_pPixmap->Cache (CHBACKLOST, "image/back-lost.png", totalDim, iconDim))
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
|
|
||||||
totalDim.x = LXLOGIC ();
|
|
||||||
totalDim.y = LYLOGIC ();
|
|
||||||
iconDim.x = 0;
|
|
||||||
iconDim.y = 0;
|
|
||||||
if (!g_pPixmap->Cache (CHBACKBYE, "image/back-bye.png", totalDim, iconDim))
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
|
|
||||||
totalDim.x = DIMCELX * 2 * 16;
|
totalDim.x = DIMCELX * 2 * 16;
|
||||||
totalDim.y = DIMCELY * 2 * 6;
|
totalDim.y = DIMCELY * 2 * 6;
|
||||||
iconDim.x = DIMCELX * 2;
|
iconDim.x = DIMCELX * 2;
|
||||||
|
11
src/def.h
11
src/def.h
@ -67,7 +67,6 @@
|
|||||||
#define DIMLITTLEX 16 // max small char size
|
#define DIMLITTLEX 16 // max small char size
|
||||||
#define DIMLITTLEY 12
|
#define DIMLITTLEY 12
|
||||||
|
|
||||||
#define CHNONE -1
|
|
||||||
#define CHBACK 0
|
#define CHBACK 0
|
||||||
#define CHFLOOR 1
|
#define CHFLOOR 1
|
||||||
#define CHOBJECT 2
|
#define CHOBJECT 2
|
||||||
@ -84,16 +83,6 @@
|
|||||||
#define CHTEXT 13
|
#define CHTEXT 13
|
||||||
#define CHBIGNUM 14
|
#define CHBIGNUM 14
|
||||||
#define CHMASK2 15
|
#define CHMASK2 15
|
||||||
#define CHBACKBUILD 16
|
|
||||||
#define CHBACKBOOK 17
|
|
||||||
#define CHBACKCHESTR 18
|
|
||||||
#define CHBACKCHESTW 19
|
|
||||||
#define CHBACKSETUP 20
|
|
||||||
#define CHBACKBYE 21
|
|
||||||
#define CHBACKWIN 22
|
|
||||||
#define CHBACKLOST 23
|
|
||||||
#define CHBACKSTARS 24
|
|
||||||
#define CHBACKWIN0 25
|
|
||||||
|
|
||||||
#define MAX_PRIVATE_MISSIONS 20
|
#define MAX_PRIVATE_MISSIONS 20
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ static Phase table[] =
|
|||||||
{
|
{
|
||||||
EV_PHASE_TESTCD,
|
EV_PHASE_TESTCD,
|
||||||
"image/init.png",
|
"image/init.png",
|
||||||
CHBACKSTARS,
|
"image/back-stars.png",
|
||||||
CPixmap::Mode::FIX,
|
CPixmap::Mode::FIX,
|
||||||
false,
|
false,
|
||||||
{
|
{
|
||||||
@ -115,7 +115,7 @@ static Phase table[] =
|
|||||||
{
|
{
|
||||||
EV_PHASE_INTRO1,
|
EV_PHASE_INTRO1,
|
||||||
"image/intro1.png",
|
"image/intro1.png",
|
||||||
CHNONE,
|
"",
|
||||||
CPixmap::Mode::FIX,
|
CPixmap::Mode::FIX,
|
||||||
false,
|
false,
|
||||||
{
|
{
|
||||||
@ -128,7 +128,7 @@ static Phase table[] =
|
|||||||
{
|
{
|
||||||
EV_PHASE_INIT,
|
EV_PHASE_INIT,
|
||||||
"image/init.png",
|
"image/init.png",
|
||||||
CHBACKSTARS,
|
"image/back-stars.png",
|
||||||
CPixmap::Mode::FIX,
|
CPixmap::Mode::FIX,
|
||||||
false,
|
false,
|
||||||
{
|
{
|
||||||
@ -177,7 +177,7 @@ static Phase table[] =
|
|||||||
{
|
{
|
||||||
EV_PHASE_HISTORY0,
|
EV_PHASE_HISTORY0,
|
||||||
"image/history0.png",
|
"image/history0.png",
|
||||||
CHBACKBOOK,
|
"image/back-book.png",
|
||||||
CPixmap::Mode::FIX,
|
CPixmap::Mode::FIX,
|
||||||
true,
|
true,
|
||||||
{
|
{
|
||||||
@ -202,7 +202,7 @@ static Phase table[] =
|
|||||||
{
|
{
|
||||||
EV_PHASE_HISTORY1,
|
EV_PHASE_HISTORY1,
|
||||||
"image/history1.png",
|
"image/history1.png",
|
||||||
CHBACKBOOK,
|
"image/back-book.png",
|
||||||
CPixmap::Mode::FIX,
|
CPixmap::Mode::FIX,
|
||||||
true,
|
true,
|
||||||
{
|
{
|
||||||
@ -227,7 +227,7 @@ static Phase table[] =
|
|||||||
{
|
{
|
||||||
EV_PHASE_INFO,
|
EV_PHASE_INFO,
|
||||||
"image/info%.3d.png",
|
"image/info%.3d.png",
|
||||||
CHBACKBOOK,
|
"image/back-book.png",
|
||||||
CPixmap::Mode::FIX,
|
CPixmap::Mode::FIX,
|
||||||
false,
|
false,
|
||||||
{
|
{
|
||||||
@ -294,7 +294,7 @@ static Phase table[] =
|
|||||||
{
|
{
|
||||||
EV_PHASE_PLAY,
|
EV_PHASE_PLAY,
|
||||||
"image/play.png",
|
"image/play.png",
|
||||||
CHNONE,
|
"",
|
||||||
CPixmap::Mode::EXPAND,
|
CPixmap::Mode::EXPAND,
|
||||||
false,
|
false,
|
||||||
{
|
{
|
||||||
@ -325,7 +325,7 @@ static Phase table[] =
|
|||||||
{
|
{
|
||||||
EV_PHASE_STOP,
|
EV_PHASE_STOP,
|
||||||
"image/stop%.3d.png",
|
"image/stop%.3d.png",
|
||||||
CHBACKBOOK,
|
"image/back-book.png",
|
||||||
CPixmap::Mode::FIX,
|
CPixmap::Mode::FIX,
|
||||||
false,
|
false,
|
||||||
{
|
{
|
||||||
@ -374,7 +374,7 @@ static Phase table[] =
|
|||||||
{
|
{
|
||||||
EV_PHASE_HELP,
|
EV_PHASE_HELP,
|
||||||
"image/help.png",
|
"image/help.png",
|
||||||
CHBACKBOOK,
|
"image/back-book.png",
|
||||||
CPixmap::Mode::FIX,
|
CPixmap::Mode::FIX,
|
||||||
true,
|
true,
|
||||||
{
|
{
|
||||||
@ -417,7 +417,7 @@ static Phase table[] =
|
|||||||
{
|
{
|
||||||
EV_PHASE_SETUP,
|
EV_PHASE_SETUP,
|
||||||
"image/setup01.png",
|
"image/setup01.png",
|
||||||
CHBACKSETUP,
|
"image/back-setup.png",
|
||||||
CPixmap::Mode::FIX,
|
CPixmap::Mode::FIX,
|
||||||
false,
|
false,
|
||||||
{
|
{
|
||||||
@ -496,7 +496,7 @@ static Phase table[] =
|
|||||||
{
|
{
|
||||||
EV_PHASE_SETUPp,
|
EV_PHASE_SETUPp,
|
||||||
"image/setup01.png",
|
"image/setup01.png",
|
||||||
CHBACKSETUP,
|
"image/back-setup.png",
|
||||||
CPixmap::Mode::FIX,
|
CPixmap::Mode::FIX,
|
||||||
false,
|
false,
|
||||||
{
|
{
|
||||||
@ -575,7 +575,7 @@ static Phase table[] =
|
|||||||
{
|
{
|
||||||
EV_PHASE_READ,
|
EV_PHASE_READ,
|
||||||
"image/read.png",
|
"image/read.png",
|
||||||
CHBACKCHESTR,
|
"image/back-chest-r.png",
|
||||||
CPixmap::Mode::FIX,
|
CPixmap::Mode::FIX,
|
||||||
false,
|
false,
|
||||||
{
|
{
|
||||||
@ -654,7 +654,7 @@ static Phase table[] =
|
|||||||
{
|
{
|
||||||
EV_PHASE_WRITE,
|
EV_PHASE_WRITE,
|
||||||
"image/write.png",
|
"image/write.png",
|
||||||
CHBACKCHESTW,
|
"image/back-chest-w.png",
|
||||||
CPixmap::Mode::FIX,
|
CPixmap::Mode::FIX,
|
||||||
false,
|
false,
|
||||||
{
|
{
|
||||||
@ -733,7 +733,7 @@ static Phase table[] =
|
|||||||
{
|
{
|
||||||
EV_PHASE_WRITEp,
|
EV_PHASE_WRITEp,
|
||||||
"image/write.png",
|
"image/write.png",
|
||||||
CHBACKCHESTW,
|
"image/back-chest-w.png",
|
||||||
CPixmap::Mode::FIX,
|
CPixmap::Mode::FIX,
|
||||||
false,
|
false,
|
||||||
{
|
{
|
||||||
@ -812,7 +812,7 @@ static Phase table[] =
|
|||||||
{
|
{
|
||||||
EV_PHASE_LOST,
|
EV_PHASE_LOST,
|
||||||
"image/lost.png",
|
"image/lost.png",
|
||||||
CHBACKLOST,
|
"image/back-lost.png",
|
||||||
CPixmap::Mode::FIX,
|
CPixmap::Mode::FIX,
|
||||||
true,
|
true,
|
||||||
{
|
{
|
||||||
@ -831,7 +831,7 @@ static Phase table[] =
|
|||||||
{
|
{
|
||||||
EV_PHASE_WIN,
|
EV_PHASE_WIN,
|
||||||
"image/win.png",
|
"image/win.png",
|
||||||
CHBACKWIN,
|
"image/back-win.png",
|
||||||
CPixmap::Mode::FIX,
|
CPixmap::Mode::FIX,
|
||||||
true,
|
true,
|
||||||
{
|
{
|
||||||
@ -850,7 +850,7 @@ static Phase table[] =
|
|||||||
{
|
{
|
||||||
EV_PHASE_LASTWIN,
|
EV_PHASE_LASTWIN,
|
||||||
"image/last%.3d.png",
|
"image/last%.3d.png",
|
||||||
CHNONE,
|
"",
|
||||||
CPixmap::Mode::FIX,
|
CPixmap::Mode::FIX,
|
||||||
true,
|
true,
|
||||||
{
|
{
|
||||||
@ -869,7 +869,7 @@ static Phase table[] =
|
|||||||
{
|
{
|
||||||
EV_PHASE_BUILD,
|
EV_PHASE_BUILD,
|
||||||
"image/build.png",
|
"image/build.png",
|
||||||
CHNONE,
|
"",
|
||||||
CPixmap::Mode::EXPAND,
|
CPixmap::Mode::EXPAND,
|
||||||
true,
|
true,
|
||||||
{
|
{
|
||||||
@ -986,7 +986,7 @@ static Phase table[] =
|
|||||||
{
|
{
|
||||||
EV_PHASE_BUTTON,
|
EV_PHASE_BUTTON,
|
||||||
"image/button.png",
|
"image/button.png",
|
||||||
CHBACKBUILD,
|
"image/back-build.png",
|
||||||
CPixmap::Mode::FIX,
|
CPixmap::Mode::FIX,
|
||||||
true,
|
true,
|
||||||
{
|
{
|
||||||
@ -1208,7 +1208,7 @@ static Phase table[] =
|
|||||||
{
|
{
|
||||||
EV_PHASE_TERM,
|
EV_PHASE_TERM,
|
||||||
"image/term.png",
|
"image/term.png",
|
||||||
CHBACKBUILD,
|
"image/back-build.png",
|
||||||
CPixmap::Mode::FIX,
|
CPixmap::Mode::FIX,
|
||||||
true,
|
true,
|
||||||
{
|
{
|
||||||
@ -1299,7 +1299,7 @@ static Phase table[] =
|
|||||||
{
|
{
|
||||||
EV_PHASE_MUSIC,
|
EV_PHASE_MUSIC,
|
||||||
"image/music.png",
|
"image/music.png",
|
||||||
CHBACKBUILD,
|
"image/back-build.png",
|
||||||
CPixmap::Mode::FIX,
|
CPixmap::Mode::FIX,
|
||||||
true,
|
true,
|
||||||
{
|
{
|
||||||
@ -1384,7 +1384,7 @@ static Phase table[] =
|
|||||||
{
|
{
|
||||||
EV_PHASE_REGION,
|
EV_PHASE_REGION,
|
||||||
"image/region.png",
|
"image/region.png",
|
||||||
CHBACKBUILD,
|
"image/back-build.png",
|
||||||
CPixmap::Mode::FIX,
|
CPixmap::Mode::FIX,
|
||||||
true,
|
true,
|
||||||
{
|
{
|
||||||
@ -1427,7 +1427,7 @@ static Phase table[] =
|
|||||||
{
|
{
|
||||||
EV_PHASE_PLAYMOVIE,
|
EV_PHASE_PLAYMOVIE,
|
||||||
"image/movie.png",
|
"image/movie.png",
|
||||||
CHNONE,
|
"",
|
||||||
CPixmap::Mode::FIX,
|
CPixmap::Mode::FIX,
|
||||||
false,
|
false,
|
||||||
{
|
{
|
||||||
@ -1440,7 +1440,7 @@ static Phase table[] =
|
|||||||
{
|
{
|
||||||
EV_PHASE_WINMOVIE,
|
EV_PHASE_WINMOVIE,
|
||||||
"image/movie.png",
|
"image/movie.png",
|
||||||
CHNONE,
|
"",
|
||||||
CPixmap::Mode::FIX,
|
CPixmap::Mode::FIX,
|
||||||
false,
|
false,
|
||||||
{
|
{
|
||||||
@ -1453,7 +1453,7 @@ static Phase table[] =
|
|||||||
{
|
{
|
||||||
EV_PHASE_H0MOVIE,
|
EV_PHASE_H0MOVIE,
|
||||||
"image/movie.png",
|
"image/movie.png",
|
||||||
CHNONE,
|
"",
|
||||||
CPixmap::Mode::FIX,
|
CPixmap::Mode::FIX,
|
||||||
false,
|
false,
|
||||||
{
|
{
|
||||||
@ -1466,7 +1466,7 @@ static Phase table[] =
|
|||||||
{
|
{
|
||||||
EV_PHASE_H1MOVIE,
|
EV_PHASE_H1MOVIE,
|
||||||
"image/movie.png",
|
"image/movie.png",
|
||||||
CHNONE,
|
"",
|
||||||
CPixmap::Mode::FIX,
|
CPixmap::Mode::FIX,
|
||||||
false,
|
false,
|
||||||
{
|
{
|
||||||
@ -1479,7 +1479,7 @@ static Phase table[] =
|
|||||||
{
|
{
|
||||||
EV_PHASE_H2MOVIE,
|
EV_PHASE_H2MOVIE,
|
||||||
"image/movie.png",
|
"image/movie.png",
|
||||||
CHNONE,
|
"",
|
||||||
CPixmap::Mode::FIX,
|
CPixmap::Mode::FIX,
|
||||||
false,
|
false,
|
||||||
{
|
{
|
||||||
@ -1492,7 +1492,7 @@ static Phase table[] =
|
|||||||
{
|
{
|
||||||
EV_PHASE_BYE,
|
EV_PHASE_BYE,
|
||||||
"image/bye.png",
|
"image/bye.png",
|
||||||
CHBACKBYE,
|
"image/back-bye.png",
|
||||||
CPixmap::Mode::FIX,
|
CPixmap::Mode::FIX,
|
||||||
false,
|
false,
|
||||||
{
|
{
|
||||||
@ -1505,7 +1505,7 @@ static Phase table[] =
|
|||||||
{
|
{
|
||||||
EV_PHASE_INSERT,
|
EV_PHASE_INSERT,
|
||||||
"image/insert.png",
|
"image/insert.png",
|
||||||
CHNONE,
|
"",
|
||||||
CPixmap::Mode::FIX,
|
CPixmap::Mode::FIX,
|
||||||
false,
|
false,
|
||||||
{
|
{
|
||||||
@ -1524,7 +1524,7 @@ static Phase table[] =
|
|||||||
{
|
{
|
||||||
EV_PHASE_SETTINGS,
|
EV_PHASE_SETTINGS,
|
||||||
"image/setup00.png",
|
"image/setup00.png",
|
||||||
CHBACKSETUP,
|
"image/back-setup.png",
|
||||||
CPixmap::Mode::FIX,
|
CPixmap::Mode::FIX,
|
||||||
false,
|
false,
|
||||||
{
|
{
|
||||||
@ -2203,8 +2203,7 @@ CEvent::DrawButtons ()
|
|||||||
SetEnable (EV_BUTTON8, !g_restoreMidi && mid && ogg);
|
SetEnable (EV_BUTTON8, !g_restoreMidi && mid && ogg);
|
||||||
|
|
||||||
table[m_index].buttons[4].toolTips[0] =
|
table[m_index].buttons[4].toolTips[0] =
|
||||||
g_bFullScreen ? gettext ("Desktop mode")
|
g_bFullScreen ? gettext ("Desktop mode") : gettext ("Reduce window size");
|
||||||
: gettext ("Reduce window size");
|
|
||||||
table[m_index].buttons[5].toolTips[0] =
|
table[m_index].buttons[5].toolTips[0] =
|
||||||
g_bFullScreen ? gettext ("Legacy mode (640x480)")
|
g_bFullScreen ? gettext ("Legacy mode (640x480)")
|
||||||
: gettext ("Increase window size");
|
: gettext ("Increase window size");
|
||||||
@ -3312,7 +3311,7 @@ CEvent::ChangePhase (Uint32 phase)
|
|||||||
m_phase = phase; // change phase
|
m_phase = phase; // change phase
|
||||||
m_index = index;
|
m_index = index;
|
||||||
|
|
||||||
auto backWide = table[m_index].chBackWide;
|
auto backWideName = table[m_index].backWideName;
|
||||||
|
|
||||||
filename = table[m_index].backName;
|
filename = table[m_index].backName;
|
||||||
if (filename.find ("%.3d") != std::string::npos)
|
if (filename.find ("%.3d") != std::string::npos)
|
||||||
@ -3325,23 +3324,24 @@ CEvent::ChangePhase (Uint32 phase)
|
|||||||
switch (id)
|
switch (id)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
backWide = CHBACKWIN0;
|
backWideName = "image/back-disco.png";
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
backWide = CHBACKSTARS;
|
backWideName = "image/back-stars.png";
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
backWide = CHBACKWIN;
|
backWideName = "image/back-win.png";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
totalDim.x = LXLOGIC ();
|
totalDim.x = LXLOGIC ();
|
||||||
totalDim.y = LYLOGIC ();
|
totalDim.y = LYLOGIC ();
|
||||||
iconDim.x = 0;
|
iconDim.x = 0;
|
||||||
iconDim.y = 0;
|
iconDim.y = 0;
|
||||||
if (!m_pPixmap->Cache (
|
if (!m_pPixmap->Cache (
|
||||||
CHBACK, filename, totalDim, iconDim, table[m_index].mode, backWide))
|
CHBACK, filename, totalDim, iconDim, table[m_index].mode, backWideName))
|
||||||
{
|
{
|
||||||
WaitMouse (false);
|
WaitMouse (false);
|
||||||
m_tryInsertCount = 40;
|
m_tryInsertCount = 40;
|
||||||
|
@ -44,7 +44,7 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
Uint32 phase;
|
Uint32 phase;
|
||||||
char backName[20];
|
char backName[20];
|
||||||
Sint32 chBackWide;
|
std::string backWideName;
|
||||||
CPixmap::Mode mode;
|
CPixmap::Mode mode;
|
||||||
Sint32 bCDrom;
|
Sint32 bCDrom;
|
||||||
Button buttons[MAXBUTTON];
|
Button buttons[MAXBUTTON];
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <SDL_image.h>
|
||||||
|
|
||||||
#include "kitchensink/kitchensink.h"
|
#include "kitchensink/kitchensink.h"
|
||||||
|
|
||||||
#include "blupi.h"
|
#include "blupi.h"
|
||||||
@ -70,6 +72,12 @@ CMovie::fileCloseMovie ()
|
|||||||
m_videoTex = nullptr;
|
m_videoTex = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this->backTexture)
|
||||||
|
{
|
||||||
|
SDL_DestroyTexture (this->backTexture);
|
||||||
|
this->backTexture = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_player)
|
if (m_player)
|
||||||
{
|
{
|
||||||
SDL_CloseAudioDevice (m_audioDev);
|
SDL_CloseAudioDevice (m_audioDev);
|
||||||
@ -141,15 +149,20 @@ CMovie::fileOpenMovie (const std::string & pFilename)
|
|||||||
if (m_videoTex == nullptr)
|
if (m_videoTex == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
this->chBackWide = CHNONE;
|
std::string backWideName = "";
|
||||||
if (Display::getDisplay ().isWide ())
|
if (Display::getDisplay ().isWide ())
|
||||||
{
|
{
|
||||||
if (path.rfind ("win005.mkv") != std::string::npos)
|
if (path.rfind ("win005.mkv") != std::string::npos)
|
||||||
this->chBackWide = CHBACKWIN0;
|
backWideName = "image/back-disco.png";
|
||||||
else if (path.rfind ("win129.mkv") != std::string::npos)
|
else if (path.rfind ("win129.mkv") != std::string::npos)
|
||||||
this->chBackWide = CHBACKSTARS;
|
backWideName = "image/back-stars.png";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string file = GetBaseDir () + backWideName;
|
||||||
|
SDL_Surface * surface = IMG_Load (file.c_str ());
|
||||||
|
this->backTexture = SDL_CreateTextureFromSurface (g_renderer, surface);
|
||||||
|
SDL_FreeSurface (surface);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -191,8 +204,7 @@ CMovie::CMovie (CPixmap * pixmap)
|
|||||||
|
|
||||||
memset (m_audiobuf, 0, sizeof (m_audiobuf));
|
memset (m_audiobuf, 0, sizeof (m_audiobuf));
|
||||||
|
|
||||||
this->chBackWide = CHNONE;
|
this->rw_ops = nullptr;
|
||||||
this->rw_ops = nullptr;
|
|
||||||
|
|
||||||
m_ret = 0;
|
m_ret = 0;
|
||||||
}
|
}
|
||||||
@ -310,22 +322,14 @@ CMovie::Render ()
|
|||||||
this->starting = false;
|
this->starting = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->chBackWide == CHNONE)
|
if (!this->backTexture)
|
||||||
{
|
{
|
||||||
// Clear screen with black
|
// Clear screen with black
|
||||||
SDL_SetRenderDrawColor (g_renderer, 0, 0, 0, 255);
|
SDL_SetRenderDrawColor (g_renderer, 0, 0, 0, 255);
|
||||||
SDL_RenderClear (g_renderer);
|
SDL_RenderClear (g_renderer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
SDL_RenderCopy (g_renderer, this->backTexture, nullptr, nullptr);
|
||||||
SDL_Rect rect;
|
|
||||||
rect.x = 0;
|
|
||||||
rect.y = 0;
|
|
||||||
rect.w = LXIMAGE ();
|
|
||||||
rect.h = LYIMAGE ();
|
|
||||||
auto texture = this->pixmap->getTexture (chBackWide);
|
|
||||||
SDL_RenderCopy (g_renderer, texture, &rect, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Refresh videotexture and render it
|
// Refresh videotexture and render it
|
||||||
Kit_GetPlayerVideoData (m_player, m_videoTex);
|
Kit_GetPlayerVideoData (m_player, m_videoTex);
|
||||||
|
@ -57,10 +57,10 @@ protected:
|
|||||||
Kit_Source * m_movie;
|
Kit_Source * m_movie;
|
||||||
Kit_Player * m_player;
|
Kit_Player * m_player;
|
||||||
SDL_Texture * m_videoTex;
|
SDL_Texture * m_videoTex;
|
||||||
|
SDL_Texture * backTexture;
|
||||||
Sint32 m_ret;
|
Sint32 m_ret;
|
||||||
SDL_AudioDeviceID m_audioDev;
|
SDL_AudioDeviceID m_audioDev;
|
||||||
SDL_RWops * rw_ops;
|
SDL_RWops * rw_ops;
|
||||||
int chBackWide;
|
|
||||||
|
|
||||||
char m_audiobuf[AUDIOBUFFER_SIZE];
|
char m_audiobuf[AUDIOBUFFER_SIZE];
|
||||||
bool m_bEnable;
|
bool m_bEnable;
|
||||||
|
@ -305,7 +305,7 @@ CPixmap::Cache (size_t channel, Point totalDim)
|
|||||||
bool
|
bool
|
||||||
CPixmap::Cache (
|
CPixmap::Cache (
|
||||||
size_t channel, const std::string & pFilename, Point totalDim, Point iconDim,
|
size_t channel, const std::string & pFilename, Point totalDim, Point iconDim,
|
||||||
Mode mode, size_t chBackWide)
|
Mode mode, std::string wideName)
|
||||||
{
|
{
|
||||||
std::string file = GetBaseDir () + pFilename;
|
std::string file = GetBaseDir () + pFilename;
|
||||||
SDL_Surface * surface = IMG_Load (file.c_str ());
|
SDL_Surface * surface = IMG_Load (file.c_str ());
|
||||||
@ -363,14 +363,15 @@ CPixmap::Cache (
|
|||||||
{
|
{
|
||||||
if (channel == CHBACK && (ow < LXIMAGE () || oh < LYIMAGE ()))
|
if (channel == CHBACK && (ow < LXIMAGE () || oh < LYIMAGE ()))
|
||||||
{
|
{
|
||||||
if (chBackWide > 0)
|
if (!wideName.empty ())
|
||||||
{
|
{
|
||||||
Rect srcRect;
|
std::string file = GetBaseDir () + wideName;
|
||||||
srcRect.left = 0;
|
SDL_Surface * surface = IMG_Load (file.c_str ());
|
||||||
srcRect.right = LXIMAGE ();
|
SDL_Texture * texture =
|
||||||
srcRect.top = 0;
|
SDL_CreateTextureFromSurface (g_renderer, surface);
|
||||||
srcRect.bottom = LYIMAGE ();
|
SDL_FreeSurface (surface);
|
||||||
this->DrawImage (-1, chBackWide, srcRect);
|
SDL_RenderCopy (g_renderer, texture, nullptr, nullptr);
|
||||||
|
SDL_DestroyTexture (texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_Rect dst;
|
SDL_Rect dst;
|
||||||
|
@ -66,7 +66,7 @@ public:
|
|||||||
bool Cache (size_t channel, Point totalDim);
|
bool Cache (size_t channel, Point totalDim);
|
||||||
bool Cache (
|
bool Cache (
|
||||||
size_t channel, const std::string & pFilename, Point totalDim,
|
size_t channel, const std::string & pFilename, Point totalDim,
|
||||||
Point iconDim, Mode mode = FIX, size_t chBackWide = CHNONE);
|
Point iconDim, Mode mode = FIX, std::string wideName = "");
|
||||||
bool Cache (size_t channel, const std::string & pFilename, Point totalDim);
|
bool Cache (size_t channel, const std::string & pFilename, Point totalDim);
|
||||||
bool Cache (size_t channel, SDL_Surface * surface, Point totalDim);
|
bool Cache (size_t channel, SDL_Surface * surface, Point totalDim);
|
||||||
SDL_Texture * getTexture (size_t channel);
|
SDL_Texture * getTexture (size_t channel);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user