I've implemented the circular image list in my project. Here is irrlicht forum link where I've downloaded this code:
http://irrlicht.sourceforge.net/phpBB2 ... ctureflow
I loaded this circular image list over an Image. If I click an item in this circular list, the image beneath this list has to change its color(for each element clicked, the image has to change to a corresponding color). I stored the rgb values of the color for each element in a database table.
This is my code:
Code: Select all
void CTeamSelectState::MouseEvent(CGameManager* pManager)
{
if (pManager->getMouse() == EMIE_LMOUSE_PRESSED_DOWN )
{
Theme1Color = QueryColorFromTable(playerCty->getSelected()+1);
}
if(pManager->getMouse() == EMIE_RMOUSE_PRESSED_DOWN)
{
Theme1Color = QueryColorFromTable(playerCty->getSelected()-1);
}
}
Code: Select all
QueryColorFromTable()
Code: Select all
SColorf CTeamSelectState::QueryColorFromTable(s32 id)
{
irr::core::array<irr::core::stringc> result;
core::stringc queryStr;
queryStr = L"Select primaryThemeColor FROM Team WHERE Name = '";
switch(id)
{
case 0:
queryStr += L"Aus";
break;
case 1:
queryStr += L"Eng'";
break;
case 2:
queryStr += L"Ind'";
break;
case 3:
queryStr += L"New Zealand'";
break;
case 4:
queryStr += L"Pak'";
break;
default:
queryStr += L"Aus'";
}
//queryStr += id;
//queryStr += L" ";
SColorf temp;
result = SQLdb.Query(queryStr);
temp = parseTextValueAsSColorf(result[0]);
return temp;
}