Game Development Reference
In-Depth Information
else if (buttonFlags == MB_OK)
{
numButtons = 1;
}
int btnWidth = (int)((float) g_pApp->GetScreenSize().x * 0.15f);
int btnHeight = (int)((float) g_pApp->GetScreenSize().y * 0.037f);
int border = (int)((float) g_pApp->GetScreenSize().x * 0.043f);
m_Width = std::max(msgWidth + 2 * border, btnWidth + 2 * border);
m_Height = msgHeight + (numButtons * (btnHeight+border) ) + (2 * border);
m_PosX = (g_pApp->GetScreenSize().x -m_Width)/2;
m_PosY = (g_pApp->GetScreenSize().y -m_Height)/2;
m_UI.SetLocation( m_PosX, m_PosY );
m_UI.SetSize( m_Width, m_Height );
m_UI.SetBackgroundColors(g_Gray40);
int iY = border;
int iX = (m_Width - msgWidth) / 2;
m_UI.AddStatic( 0, msg.c_str(), iX, iY, msgWidth, msgHeight);
iX = (m_Width - btnWidth) / 2;
iY = m_Height - btnHeight - border;
buttonFlags &= 0xF;
if ( (buttonFlags == MB_ABORTRETRYIGNORE) ||
(buttonFlags == MB_CANCELTRYCONTINUE) )
{
// The message box contains three push buttons:
// Cancel, Try Again, Continue.
// This is the new standard over Abort,Retry,Ignore
m_UI.AddButton( IDCONTINUE, g_pApp->GetString(IDS_CONTINUE).c_str(),
iX, iY - (2*border), btnWidth, btnHeight );
m_UI.AddButton( IDTRYAGAIN, g_pApp->GetString(IDS_TRYAGAIN).c_str(),
iX, iY - border, btnWidth, btnHeight );
m_UI.AddButton( IDCANCEL, g_pApp->GetString(IDS_CANCEL).c_str(),
iX, iY, btnWidth, btnHeight );
}
else if (buttonFlags == MB_OKCANCEL)
{
//The message box contains two push buttons: OK and Cancel.
Search WWH ::




Custom Search