本文整理汇总了C++中CMouse::RightButtonDown方法的典型用法代码示例。如果您正苦于以下问题:C++ CMouse::RightButtonDown方法的具体用法?C++ CMouse::RightButtonDown怎么用?C++ CMouse::RightButtonDown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMouse
的用法示例。
在下文中一共展示了CMouse::RightButtonDown方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WinMain
//.........这里部分代码省略.........
gTimerFPS.Initialize();
//game timer for update
CTimer timerGame;
timerGame.Initialize();
//define events for changing game states
//*************************************************************************
//g_pStateIntro->AddTransitionEvent(EVENT_GO_PLAY1, g_pStatePlay1);
//g_pStatePlay1->AddTransitionEvent(EVENT_GO_CREDITS, g_pStateCredits);
g_pStateIntro->AddTransitionEvent(EVENT_GO_MAIN, g_pStateMain);
g_pStateMain->AddTransitionEvent(EVENT_GO_PLAY1, g_pStatePlay1);
g_pStateMain->AddTransitionEvent(EVENT_GO_HELP, g_pStateHelp);
g_pStateMain->AddTransitionEvent(EVENT_GO_CREDITS, g_pStateCredits);
g_pStatePlay1->AddTransitionEvent(EVENT_GO_QUIT, g_pStateQuit);
//g_pStatePlay1->AddTransitionEvent(EVENT_GO_MAIN, g_pStateMain);
g_pStateHelp->AddTransitionEvent(EVENT_GO_MAIN, g_pStateMain);
g_pStateCredits->AddTransitionEvent(EVENT_GO_QUIT, g_pStateQuit);
g_pCurrent = g_pStatePlay1;// g_pStateIntro;
// enter the main loop
//************************************** M A I N L O O P *****************
MSG msg;
pLog->Log("Entering Main Control Loop");
float timeDiff = 0.0f;
g_pCurrent->Activate(gameData, cfg, con);
while(g_bRunning)
{
DWORD starting_point = GetTickCount();
::Sleep(0);
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
if (msg.message == WM_QUIT)
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
//manage frame count determination
gLoopCount++;
if(gTimerFPS.getTimer(1.0) == true){
gameData.m_FPS = static_cast<float>(gLoopCount);
gLoopCount = 0;
gSecondCount++;
if(gSecondCount > 30){ //log every 30 seconds
gSecondCount = 0;
if(cfg.LogDebugInfo == true)
pLog->Log("FPS",gameData.m_FPS);
}
}
//stores mouse button status for use in other classes
gameData.m_bLeftMouseDown = mouse.LeftButtonDown();
gameData.m_bRightMouseDown = mouse.RightButtonDown();
//update
g_pLast = g_pCurrent;
g_pNext = g_pCurrent->Update(timerGame.getTimeDifference(), gameData, cfg, con);
if(g_pNext == g_pStateQuit)
g_bRunning = false;
else if(NULL != g_pNext)
{
if(g_pNext != g_pLast){
g_pLast->Deactivate(gameData, cfg, con);
g_pCurrent = g_pNext;
g_pCurrent->Activate(gameData, cfg, con);
}
}
//render
g_pCurrent->Render(con, gameData, cfg);
// check the 'escape' key
if(g_bRunning == false){
gExitProgram = true;
PostMessage(hWnd, WM_DESTROY, 0, 0);
}
}
pLog->Log("Exited main loop");
// clean up DirectX and COM
con.CleanupDirectX();
Shutdown();
pLog->Log("DirectX Cleaned Up");
pLog->Log("Shutdown complete!");
pLog->Log("***************************************");
pLog->Log(" Program Terminated Normally");
pLog->Log("***************************************");
return static_cast<int>(msg.wParam);
}