Hi all,
Just of curiosity, how would you achieve the same goal as I do with the code below?
It feels a bit 'clumsy', but I didn't find a way to do this easier/ less code repetition.
D3DCOLOR selectedCol = D3DCOLOR_XRGB(255, 255, 0);
D3DCOLOR defCol = D3DCOLOR_XRGB(255, 255, 255);
D3DCOLOR tempCol;
switch(mCurrentMenu)
{
case MENU_MAIN:
{
// ITEMS
if(mGameStarted)
{
if(mCurrentMenuItem == 0) tempCol = selectedCol; else tempCol = defCol;
mD3d.mD3dFont.PrintLarge("Resume game", startMenuX, startMenuY + 1 * offsetMenuItem, tempCol); // 0
}
if(mCurrentMenuItem == 1) tempCol = selectedCol; else tempCol = defCol;
mD3d.mD3dFont.PrintLarge("New game", startMenuX, startMenuY + 2 * offsetMenuItem, tempCol); // 1
if(mCurrentMenuItem == 2) tempCol = selectedCol; else tempCol = defCol;
mD3d.mD3dFont.PrintLarge("Options", startMenuX, startMenuY + 3 * offsetMenuItem, tempCol); // 2
if(mCurrentMenuItem == 3) tempCol = selectedCol; else tempCol = defCol;
mD3d.mD3dFont.PrintLarge("Leaderboard", startMenuX, startMenuY + 4 * offsetMenuItem, tempCol); // 3
if(mCurrentMenuItem == 4) tempCol = selectedCol; else tempCol = defCol;
mD3d.mD3dFont.PrintLarge("Quit game", startMenuX, startMenuY + 5 * offsetMenuItem, tempCol); // 4
break;
}
}
Note; don't mind the switch has just one case for now, will be more later on