void MyDialog::HandleEvent(Widget &obj, int msg, intptr_t arg1, intptr_t arg2) { Dialog::HandleEvent(obj, msg, arg1, arg2); switch (msg) { case MSG_ACTIVATE: if (obj == buttonPlay) { buttonPlay.Disable(); MoveFocusTo(&map); map.Play((int)eLevel.GetPosition()); eLevel.Disable(); Settings::showMouse = false; } else if (obj == bScores) { ShowScores(); } break; case MSG_GAMEOVER: { Settings::showMouse = true; if (hsc->CanAdd(eScore.GetInt())) { GetHiscoreName(); ShowScores(); } else { //TODO #if 0 MessageBox dlg("Message", "Game over! You lose!", NULL, NULL, "OK", NULL, NULL); dlg.Popup(this); #endif } buttonPlay.Enable(); eLevel.Enable(); nextPiece.piece = NULL; } break; case MSG_UPDATESCORE: { eLines.SetNumber((int)arg1); eScore.SetNumber((int)arg2); } break; case MSG_INCREASELEVEL: { eLevel.Increment(); } break; case MSG_NEWPIECE: { nextPiece.piece = map.GetNextPiece(); } break; }; }
EditBox* CreateEditBoxFromXML(ticpp::Element* elem, Dialog* /*dlg*/){ int tmpInt; EditBox* box = new EditBox(); box->SetName(elem->GetAttribute("NAME").c_str()); if(elem->GetAttribute("ID", &tmpInt)) box->SetID(tmpInt); if(elem->GetAttribute("X", &tmpInt)) box->SetPositionX(tmpInt); if(elem->GetAttribute("Y", &tmpInt)) box->SetPositionY(tmpInt); if(elem->GetAttribute("WIDTH", &tmpInt)) box->SetSizeX(tmpInt); if(elem->GetAttribute("HEIGHT", &tmpInt)) box->SetSizeY(tmpInt); if(elem->GetAttribute("CHARWIDTH", &tmpInt)) box->SetCharWidth(tmpInt); if(elem->GetAttribute("CHARHEIGHT", &tmpInt)) box->SetCharHeight(tmpInt); if(elem->GetAttribute("NUMBER", &tmpInt)) box->SetNumber(tmpInt); if(elem->GetAttribute("LIMITTEXT", &tmpInt)) box->SetLimitText(tmpInt); if(elem->GetAttribute("PASSWORD", &tmpInt)) box->SetPassword(tmpInt); if(elem->GetAttribute("HIDECURSOR", &tmpInt)) box->SetHideCursor(tmpInt); if(elem->GetAttribute("TEXTALIGN", &tmpInt)) box->SetTextAlign(tmpInt); if(elem->GetAttribute("MULTILINE", &tmpInt)) box->SetMultiline(tmpInt); if(elem->GetAttribute("TEXTCOLOR", &tmpInt)) box->SetTextColour(tmpInt); if(elem->GetAttribute("FONT", &tmpInt)) box->SetFont(tmpInt); box->SetTextElement(gUiRender->CreateTextWithFont(box->Font())); return box; }