Added JPEG support for track preview image (= bg img Track Select)
Added specific JPEG bg images for netwok menus Fixed GoldStone preview image and converted to JPEG git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@3082 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 9592b813517bb1a71c56935f2eebb2501be77515 Former-commit-id: 05132b1de8d0681037333d38eb5eadb8b534892c
This commit is contained in:
parent
bd58f7a9f0
commit
c59e978b4d
4 changed files with 71 additions and 33 deletions
|
@ -973,6 +973,7 @@ MACRO(ADD_SD_DEFINITIONS)
|
|||
ENDMACRO(ADD_SD_DEFINITIONS)
|
||||
|
||||
MACRO(SD_INSTALL_CAR CARNAME)
|
||||
|
||||
SET(SDIC_FILES ${CARNAME}.xml ${ARGN})
|
||||
|
||||
FILE(GLOB FILES_ACC *.acc)
|
||||
|
@ -983,9 +984,11 @@ MACRO(SD_INSTALL_CAR CARNAME)
|
|||
SET(SDIC_FILES ${SDIC_FILES} ${FILES_ACC} ${FILES_RGB} ${FILES_PNG} ${FILES_JPG} ${FILES_WAV})
|
||||
|
||||
SD_INSTALL_FILES(DATA cars/${CARNAME} FILES ${SDIC_FILES})
|
||||
|
||||
ENDMACRO(SD_INSTALL_CAR CARNAME)
|
||||
|
||||
MACRO(SD_INSTALL_TRACK TRACKNAME CATEGORY)
|
||||
|
||||
SET(SDIT_FILES ${TRACKNAME}.xml ${ARGN})
|
||||
|
||||
FILE(GLOB FILES_ACC *.acc)
|
||||
|
@ -993,9 +996,10 @@ MACRO(SD_INSTALL_TRACK TRACKNAME CATEGORY)
|
|||
FILE(GLOB FILES_PNG *.png)
|
||||
FILE(GLOB FILES_JPG *.jpg)
|
||||
FILE(GLOB FILES_RGB *.rgb)
|
||||
SET(SDIT_FILES ${SDIT_FILES} ${FILES_PNG} ${FILES_RGB} ${FILES_AC} ${FILES_ACC})
|
||||
SET(SDIT_FILES ${SDIT_FILES} ${FILES_AC} ${FILES_ACC} ${FILES_RGB} ${FILES_PNG} ${FILES_JPG})
|
||||
|
||||
SD_INSTALL_FILES(DATA tracks/${CATEGORY}/${TRACKNAME} FILES ${SDIT_FILES})
|
||||
|
||||
ENDMACRO(SD_INSTALL_TRACK TRACKNAME CATEGORY)
|
||||
|
||||
# Data/Lib/Bin/Include files installation (with user settings registration for data files)
|
||||
|
|
|
@ -157,26 +157,38 @@ onChangeCarCategory(void * pData)
|
|||
|
||||
}
|
||||
|
||||
std::string GetTrackImagePath(const char *pszCategory,const char *pszTrack)
|
||||
std::string GetTrackPreviewFileName(const char *pszCategory, const char *pszTrack)
|
||||
{
|
||||
char buf[1024];
|
||||
snprintf(buf,1024, "tracks/%s/%s/%s.png", pszCategory,pszTrack,pszTrack);
|
||||
char buf[256];
|
||||
|
||||
std::string str = buf;
|
||||
return str;
|
||||
// Try JPEG first.
|
||||
snprintf(buf, sizeof(buf), "tracks/%s/%s/%s.jpg", pszCategory, pszTrack, pszTrack);
|
||||
buf[255] = 0; /* snprinf manual is not clear about that ... */
|
||||
|
||||
// Then PNG if not found.
|
||||
if (!GfFileExists(buf))
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "tracks/%s/%s/%s.png", pszCategory, pszTrack, pszTrack);
|
||||
buf[255] = 0; /* snprinf manual is not clear about that ... */
|
||||
}
|
||||
|
||||
std::string GetOutlineFileName(const char *pszCategory,const char *pszTrack)
|
||||
// Then fallback.
|
||||
if (!GfFileExists(buf))
|
||||
strncpy(buf, "data/img/splash-networkrace.jpg", sizeof(buf));
|
||||
|
||||
return std::string(buf);
|
||||
}
|
||||
|
||||
std::string GetTrackOutlineFileName(const char *pszCategory,const char *pszTrack)
|
||||
{
|
||||
char buf[1024];
|
||||
snprintf(buf,1024, "tracks/%s/%s/outline.png", pszCategory,pszTrack);
|
||||
char buf[256];
|
||||
|
||||
snprintf(buf, sizeof(buf), "tracks/%s/%s/outline.png", pszCategory, pszTrack);
|
||||
|
||||
if (!ulFileExists(buf))
|
||||
snprintf(buf,1024, "data/img/transparent.png");
|
||||
if (!GfFileExists(buf))
|
||||
strncpy(buf, "data/img/transparent.png", sizeof(buf));
|
||||
|
||||
std::string str = buf;
|
||||
return str;
|
||||
return std::string(buf);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -211,8 +223,10 @@ UpdateNetworkPlayers()
|
|||
sprintf(buf, "%i", laps);
|
||||
GfuiLabelSetText(racemanMenuHdle,g_lapsHd,buf);
|
||||
|
||||
GfuiScreenAddBgImg(racemanMenuHdle,GetTrackImagePath(strCategory.c_str(),strTrackPath.c_str()).c_str());
|
||||
GfuiStaticImageSet(racemanMenuHdle, g_OutlineId,GetOutlineFileName(strCategory.c_str(),strTrackPath.c_str()).c_str());
|
||||
GfuiScreenAddBgImg(racemanMenuHdle,
|
||||
GetTrackPreviewFileName(strCategory.c_str(),strTrackPath.c_str()).c_str());
|
||||
GfuiStaticImageSet(racemanMenuHdle, g_OutlineId,
|
||||
GetTrackOutlineFileName(strCategory.c_str(),strTrackPath.c_str()).c_str());
|
||||
|
||||
// Update category info
|
||||
std::string strCarCat;
|
||||
|
@ -384,7 +398,7 @@ void CheckDriversCategory()
|
|||
}
|
||||
|
||||
void
|
||||
GufiHostServerIdle(void)
|
||||
HostServerIdle(void)
|
||||
{
|
||||
GfuiIdle();
|
||||
if (IsServer())
|
||||
|
@ -410,11 +424,14 @@ GufiHostServerIdle(void)
|
|||
|
||||
GfelPostRedisplay();
|
||||
}
|
||||
|
||||
/* Let CPU take breath (and fans stay at low and quiet speed) */
|
||||
GfuiSleep(0.001);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
GufiClientIdle(void)
|
||||
ClientIdle(void)
|
||||
{
|
||||
GfuiIdle();
|
||||
if (IsClient())
|
||||
|
@ -444,6 +461,9 @@ GufiClientIdle(void)
|
|||
|
||||
GfelPostRedisplay();
|
||||
}
|
||||
|
||||
/* Let CPU take breath (and fans stay at low and quiet speed) */
|
||||
GfuiSleep(0.001);
|
||||
}
|
||||
|
||||
void NetworkRaceInfo()
|
||||
|
@ -473,7 +493,7 @@ void NetworkDisplay(void)
|
|||
|
||||
static void OnActivateNetworkClient(void *)
|
||||
{
|
||||
GfelSetIdleCB(GufiClientIdle);
|
||||
GfelSetIdleCB(ClientIdle);
|
||||
}
|
||||
|
||||
|
||||
|
@ -491,7 +511,7 @@ static void OnActivateNetworkHost(void *)
|
|||
ReInfo->params = GfParmReadFileLocal("config/raceman/networkrace.xml",GFPARM_RMODE_REREAD);
|
||||
assert(ReInfo->params);
|
||||
ReInfo->_reName = GfParmGetStr(ReInfo->params, RM_SECT_HEADER, RM_ATTR_NAME, "");
|
||||
GfelSetIdleCB(GufiHostServerIdle);
|
||||
GfelSetIdleCB(HostServerIdle);
|
||||
GetServer()->SetRefreshDisplay(true);
|
||||
}
|
||||
|
||||
|
@ -702,7 +722,7 @@ reNetworkClientConnectMenu(void * /* dummy */)
|
|||
|
||||
UpdateNetworkPlayers();
|
||||
GfuiScreenActivate(racemanMenuHdle);
|
||||
GfelSetIdleCB(GufiClientIdle);
|
||||
GfelSetIdleCB(ClientIdle);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -75,15 +75,27 @@ rmtsFreeLists(void *vl)
|
|||
|
||||
static char*
|
||||
rmtsGetPreviewFileName(char* previewNameBuf, unsigned previewNameBufSize)
|
||||
{
|
||||
// Try JPEG first.
|
||||
snprintf(previewNameBuf, previewNameBufSize, "tracks/%s/%s/%s.jpg", CategoryList->name,
|
||||
((tFList*)CategoryList->userData)->name, ((tFList*)CategoryList->userData)->name);
|
||||
previewNameBuf[previewNameBufSize-1] = 0; /* snprinf manual is not clear about that ... */
|
||||
|
||||
// Then PNG if not found.
|
||||
if (!GfFileExists(previewNameBuf))
|
||||
{
|
||||
snprintf(previewNameBuf, previewNameBufSize, "tracks/%s/%s/%s.png", CategoryList->name,
|
||||
((tFList*)CategoryList->userData)->name, ((tFList*)CategoryList->userData)->name);
|
||||
previewNameBuf[previewNameBufSize-1] = 0; /* snprinf manual is not clear about that ... */
|
||||
if (!ulFileExists(previewNameBuf))
|
||||
{
|
||||
snprintf(previewNameBuf,previewNameBufSize,"data/img/splash-trackselect.png");
|
||||
|
||||
}
|
||||
|
||||
// Then fallback.
|
||||
if (!GfFileExists(previewNameBuf))
|
||||
{
|
||||
snprintf(previewNameBuf,previewNameBufSize,"data/img/splash-trackselect.jpg");
|
||||
previewNameBuf[previewNameBufSize-1] = 0; /* snprinf manual is not clear about that ... */
|
||||
}
|
||||
|
||||
return previewNameBuf;
|
||||
}
|
||||
|
||||
|
@ -93,11 +105,13 @@ rmtsGetOutlineFileName(char* outlineNameBuf, unsigned outlineNameBufSize)
|
|||
snprintf(outlineNameBuf, outlineNameBufSize, "tracks/%s/%s/outline.png", CategoryList->name,
|
||||
((tFList*)CategoryList->userData)->name);
|
||||
outlineNameBuf[outlineNameBufSize-1] = 0; /* snprinf manual is not clear about that ... */
|
||||
if (!ulFileExists(outlineNameBuf))
|
||||
|
||||
if (!GfFileExists(outlineNameBuf))
|
||||
{
|
||||
snprintf(outlineNameBuf,outlineNameBufSize,"data/img/transparent.png");
|
||||
|
||||
outlineNameBuf[outlineNameBufSize-1] = 0; /* snprinf manual is not clear about that ... */
|
||||
}
|
||||
|
||||
return outlineNameBuf;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<attstr name="name" val="Online Race"/>
|
||||
<attstr name="description" val="Online Race"/>
|
||||
<attnum name="priority" val="10"/>
|
||||
<attstr name="menu image" val="data/img/splash-networkrace.png"/>
|
||||
<attstr name="menu image" val="data/img/splash-networkrace.jpg"/>
|
||||
</section>
|
||||
|
||||
<section name="Tracks">
|
||||
|
|
Loading…
Reference in a new issue