本文整理汇总了C++中MainMenu类的典型用法代码示例。如果您正苦于以下问题:C++ MainMenu类的具体用法?C++ MainMenu怎么用?C++ MainMenu使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MainMenu类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
MainMenu mainmenu;
mainmenu.display();
return 0;
}
示例2: mousePressEvent
void ItemScene::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
if(this->sceneType == MenuDisplay)
{
cout << "Width: " << this->sceneRect().width() << endl;
QList<QGraphicsView*> parentViews = this->views();
cout << parentViews.size() << endl;
MainMenu* view = (MainMenu*)parentViews.at(0);
int viewPosX, viewPosY, viewWidth, viewHeight, imagePosX, imagePosY, imageWidth, imageHeight;
viewPosX = view->getPosition()->x();
viewPosY = view->getPosition()->y();
viewWidth = view->width();
viewHeight = view->height();
imagePosX = this->imageDisplay->imageFileItem->pos().x();
imagePosY = this->imageDisplay->imageFileItem->pos().y();
imageWidth = this->imageDisplay->imageFileItem->boundingRect().width();
imageHeight = this->imageDisplay->imageFileItem->boundingRect().height();
if( (viewPosX + viewWidth >= imagePosX || viewPosX + viewWidth >= imagePosX + imageWidth ) &&
(viewPosY <= imagePosY || viewPosY <= imagePosY + imageHeight) )
{
QPointF position(viewPosX + event->scenePos().x(), viewPosY + event->scenePos().y());
this->imageDisplay->addSelectionMarker(position);
}
}
update();
QGraphicsScene::mousePressEvent(event);
}
示例3: tr
void MainWindow::on_btnLogin_clicked()
{
QSqlQueryModel *model = new QSqlQueryModel;
model->setQuery("SELECT * FROM users");
model->setHeaderData(0, Qt::Horizontal, tr("Name"));
model->setHeaderData(0, Qt::Horizontal, tr("Password"));
model->setHeaderData(0, Qt::Horizontal, tr("Type"));
QString username = ui->txtUserName->text();
QString password = ui->txtPassWord->text();
bool success = loginManager->Login(username, password);
if (success)
{
MainMenu *menu = new MainMenu(0, loginManager);
menu->show();
this->destroy();
//QTableView *view = new QTableView;
//view->setWindowTitle("Users");
//view->resizeColumnsToContents();
//view->resizeRowsToContents();
//view->setModel(model);
//view->show();
//view->resize(640, 480);
}
}
示例4: MainMenu
void Game::initializeGame()
{
std::cout<<"\n\n BOOT UP: LOADING SPRITES: "; //Loading Text
MainMenu* MenuState = new MainMenu();
MenuState->Init(this);
states.push_back(MenuState);
LevelHome* StateHome = new LevelHome();
StateHome->Init(this);
states.push_back(StateHome);
LevelOne* StateOne = new LevelOne();
StateOne->Init(this);
states.push_back(StateOne);
LevelTwo* StateTwo = new LevelTwo();
StateTwo->Init(this);
states.push_back(StateTwo);
LevelThree* StateThree = new LevelThree();
StateThree->Init(this);
states.push_back(StateThree);
UIState* UI = new UIState();
UI->Init(this);
states.push_back(UI);
MessageState* Msg = new MessageState();
Msg->Init(this);
states.push_back(Msg);
}
示例5: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainMenu w;
w.show();
return a.exec();
}
示例6:
void MainMenu::on_pushButton_4_clicked()
{
MainMenu *m = DataModel::getMainmenu();
m->hide();
collectionGUI *c = DataModel::getCollectiongui();
c->show();
}
示例7: main
int main() {
MainMenu start;
start.initComponents();
start.run();
return 0;
}
示例8: main
int main()
{
//Declare Variables
char wasd = ' '; // Holds player's movement
char *loc = 0; // Holds player location
char **arrMap1; // For allocating memory
int locX = 0; // Holds X location
int locY = 0; // Holds Y location
int turn = 0; // Holds turns taken
int menuIn = 0; // Holds menu input
int debug[0]; // Converts char to int for debug file
bool isGameRunning = true; // Checks if game is still running
bool action = false; // Checks if player is fighting
//Define objects
Player p;
Map map1;
MainMenu menu;
//Allocate instances
Speechbox *sB = new Playerbox();
Playerbox *pB = new Playerbox();
Pickupbox *pU = new Pickupbox();
//Build FileStream object
FileStream f;
//Display menu and prompt for choice
f.readFile("Main.mnu", 0, 0);
cin >> menuIn;
//If 3, display help screen
if(menuIn == 3)
{
system("cls");
f.readFile("help.mnu", 0, 0);
cout << "\nPress Enter to start game\n";
_getch();
system("cls");
}
//If 4, exit and don,t bother set or output
else if(menuIn == 4){ cout << "\nGoodbye!\n"; exit(EXIT_SUCCESS); }
//If not 3, set and output menu
menu.setInN(menuIn);
menu.outMenu(menuIn);
//If load game fail, prompt
if(menu.getIsCodeGood() == false)
{
//Prompt for user info
cin >> p;
//Prompt for map properties
cin >> map1;
}
示例9: MainMenu
void GameScene::Update(void * params, Game * game)
{
game->keyboard.UpdateState();
if(game->keyboard.IsKeyPressed(SDLK_y))
character.NextAnimation();
if(game->keyboard.IsKeyPressed(SDLK_w))
character.SetCurrentDirection(0);
if(game->keyboard.IsKeyPressed(SDLK_s))
character.SetCurrentDirection(1);
if(game->keyboard.IsKeyPressed(SDLK_a))
character.SetCurrentDirection(2);
if(game->keyboard.IsKeyPressed(SDLK_d))
character.SetCurrentDirection(3);
if(game->keyboard.IsKeyDown(SDLK_q))
game->Kill();
if(game->keyboard.IsKeyPressed(SDLK_ESCAPE))
{
MainMenu * menu = new MainMenu();
menu->AddMenuItem("Quit");
menu->AddMenuItem("Continue");
game->PushScene(menu);
}
if(game->keyboard.IsKeyDown(SDLK_RIGHT))
{
currentBackground.Move(-1.0f,0.0f);
character.SetCurrentDirection(3);
character.StepAnimation();
}
if(game->keyboard.IsKeyDown(SDLK_LEFT))
{
currentBackground.Move(1.0f,0.0f);
character.SetCurrentDirection(2);
character.StepAnimation();
}
if(game->keyboard.IsKeyDown(SDLK_UP))
{
currentBackground.Move(0.0f,1.0f);
character.SetCurrentDirection(0);
character.StepAnimation();
}
if(game->keyboard.IsKeyDown(SDLK_DOWN))
{
currentBackground.Move(0.0f,-1.0f);
character.SetCurrentDirection(1);
character.StepAnimation();
}
}
示例10: main
int main()
{
// this outputs the title of the app
// and initialises the MathsOp pointer declared privately
// an example of multitasking for the programmer
MainMenu *mainMenu = new MainMenu();
mainMenu->showOptions();
// free resources allocated dynamically
delete mainMenu;
return 0;
}
示例11: PegAppInitialize
/*--------------------------------------------------------------------------*/
void PegAppInitialize(PegPresentationManager *pPresent)
{
printf("err0\n");
pPresent->Screen()->SetPalette(0, 255, PegCustomPalette); /* use custom palette */
pPresent->SetColor(PCI_NORMAL, NEWMENU_BACKGRANOUD_COLOR);
printf("error1\n");
pPresent->Draw();
printf("error2\n");
/*Set default font size (only English)*/
PegTextThing::SetDefaultFont(PEG_PROMPT_FONT,&Arial14);
PegTextThing::SetDefaultFont(PEG_TBUTTON_FONT,&Arial12);
//gbCurrentLanguage = 1;
/*
if(0 == gbCurrentLanguage)
{
PegTextThing::SetDefaultFont(PEG_PROMPT_FONT,&Arial14);
PegTextThing::SetDefaultFont(PEG_TBUTTON_FONT,&Arial12);
}
else if(1 == gbCurrentLanguage)
{
PegTextThing::SetDefaultFont(PEG_PROMPT_FONT,&heiti14);
PegTextThing::SetDefaultFont(PEG_TBUTTON_FONT,&heiti12);
}
*/
printf("error3\n");
MainMenu *pWin = new MainMenu(20, 20);
printf("error4\n");
ToolTip * pToolTip = new ToolTip(0, 0, NULL);
pWin->SetToolTipWnd(pToolTip);
printf("err111\n");
TVHelpWnd * pTVHelpWnd = new TVHelpWnd(pWin->mReal.wLeft + 400, pWin->mReal.wTop);
pWin->SetHelpWnd(pTVHelpWnd);
/*set translucency*/
pPresent->Add(pTVHelpWnd);
pPresent->Add(pToolTip, FALSE);
pPresent->Add(pWin);
pWin->ProcessUpDownKey();
PegMessage tmpMsg;
tmpMsg.pTarget = pToolTip;
tmpMsg.pSource = pPresent;
tmpMsg.wType = PM_SHOW;
pPresent->Message(tmpMsg);
}
示例12: ShowMenu
void Game::ShowMenu() {
MainMenu mainMenu;
MainMenu::MenuResult result=mainMenu.Show(_mainWindow);
if(result == MainMenu::Exit) {
_gameState = Game::Exiting;
}
if(result == MainMenu::newGame) {
_gameState = Game::newGame;
}
if(result == MainMenu::joinGame) {
_gameState = Game::joinGame;
}
}
示例13: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainMenu w;
QRect screenGeometry = QApplication::desktop()->screenGeometry();
int x = (screenGeometry.width()-w.width()) / 2;
int y = (screenGeometry.height()-w.height()) / 2;
w.move(x, y);
w.show();
return a.exec();
}
示例14: execSyncV
void MainMenuBase::execSyncV( FieldContainer &oFrom,
ConstFieldMaskArg whichField,
AspectOffsetStore &oOffsets,
ConstFieldMaskArg syncMode,
const UInt32 uiSyncInfo)
{
MainMenu *pThis = static_cast<MainMenu *>(this);
pThis->execSync(static_cast<MainMenu *>(&oFrom),
whichField,
oOffsets,
syncMode,
uiSyncInfo);
}
示例15: main
int main(int argc, char* argv[]) {
if(argc > 1) {
// TODO we should have cla's for testing purposes
}
// Creats the main menu to start the game
MainMenu menu;
// Displays main menu
do print_menu_clr("screen_main");
while (!menu.get_input());
return 0;
}