//-------------------------------------------------------------------- int main( int p_nArgc, char* p_Argv[] ) { try { CGameWindow window; window.Show(); } catch( ... ) { throw; } }
//--------------------------------------------------------------------------------------- // メイン //--------------------------------------------------------------------------------------- int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInst, LPTSTR lpCmdLine, int iCmdShow) { // ウィンドウを作成 int nResult = EXIT_FAILURE; CGameWindow* pWnd = new CGameWindow(); if (pWnd->CreateFrame(CAPTION_NAME, // ウィンドウ キャプション WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION, 0, // ウィンドウ スタイル,拡張スタイル CW_USEDEFAULT, CW_USEDEFAULT, // ウィンドウ位置 SCREEN_WIDTH, SCREEN_HEIGHT)) { // クライアント領域サイズ pWnd->Show(iCmdShow); // ウィンドウを表示 pWnd->Update(); // ウィンドウ表示を更新 nResult = pWnd->Run(); // メッセージ ループ } delete pWnd; return nResult; }
//-------------------------------------------------------------------- int main( int p_nArgc, char* p_Argv[] ) { _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); _CrtSetBreakAlloc( 717 ); try { CGameWindow window; window.Show(); } catch( ... ) { throw; } _CrtDumpMemoryLeaks(); }
void CNewGameMenu::newGame() { int numberOfPlayers = ui.numberOfPlayersBox->value(); Difficulty difficulty = static_cast<Difficulty>(ui.difficultyComboBox->currentIndex()); QVector<QPair<QString, PlayerRole> > players; for (int i = 0; i < numberOfPlayers; ++i) { QString nick = dynamic_cast<QLineEdit*>(playerRows[i][1])->text(); if (nick.isEmpty()) nick = QString("player ") + QString::number(i); PlayerRole role = static_cast<PlayerRole>(dynamic_cast<QComboBox*>(playerRows[i][2])->currentIndex()); players << qMakePair(nick, role); } CGameWindow *newWindow = new CGameWindow(difficulty, players); newWindow->showFullScreen(); this->close(); }
LRESULT CALLBACK CGameWindow::StaticMsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) { CGameWindow* pThisWindow; if( msg == WM_NCCREATE ) { pThisWindow = (CGameWindow*)((LPCREATESTRUCT)lParam)->lpCreateParams; SetWindowLongPtr( hWnd, GWL_USERDATA, (LONG_PTR)pThisWindow ); } else { pThisWindow = (CGameWindow*)GetWindowLongPtr( hWnd, GWL_USERDATA ); if( !pThisWindow ) return DefWindowProc( hWnd, msg, wParam, lParam ); } // Call non-static msg proc pThisWindow->m_hWnd = hWnd; return pThisWindow->MsgProc( msg, wParam, lParam ); }
//--------------------------------------------------------------------------------------- // メイン //--------------------------------------------------------------------------------------- int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInst, LPTSTR lpCmdLine, int iCmdShow) { // メモリリーク検出 #if _DEBUG //_CrtDumpMemoryLeaks(); ::_CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF | _CRTDBG_ALLOC_MEM_DF); #endif // ウィンドウを作成 int nResult = EXIT_FAILURE; CGameWindow* pWnd = new CGameWindow(); if (pWnd->CreateFrame(CAPTION_NAME, // ウィンドウ キャプション WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION, 0, // ウィンドウ スタイル,拡張スタイル CW_USEDEFAULT, CW_USEDEFAULT, // ウィンドウ位置 SCREEN_WIDTH, SCREEN_HEIGHT)) { // クライアント領域サイズ pWnd->Show(iCmdShow); // ウィンドウを表示 pWnd->Update(); // ウィンドウ表示を更新 nResult = pWnd->Run(); // メッセージ ループ } delete pWnd; return nResult; }