void Update(void) // Perform Motion Updates Here { // Color fading background ////////////////////////////////////////////////////////////////////////// /* static float color = 0.0f; static float color2 = 0.3f; color += 0.0005f; color2 += 0.00005f; if (color > 0.5f) {color = 0.0f; color2 = 0.3f; } //if (color2 > 0.7f) color = 0.3f; glClearColor(0.0f, color, color2, 0.0f); */ ////////////////////////////////////////////////////////////////////////// ProcessKeys(); // update sound ////////////////////////////////////////////////////////////////////////// SokobanSoundManager::Instance().Update(); g_camera->Update(); }
int WINAPI WinMain( HINSTANCE hInstance, // Instance HINSTANCE hPrevInstance, // Previous Instance LPSTR lpCmdLine, // Command Line Parameters int nCmdShow) // Window Show State { MSG msg; // Windows Message Structure BOOL done=FALSE; // Bool Variable To Exit Loop // Ask The User Which Screen Mode They Prefer if (MessageBox(NULL,"Would You Like To Run In Fullscreen Mode?", "Start FullScreen?",MB_YESNO|MB_ICONQUESTION)==IDNO) { fullscreen=FALSE; // Windowed Mode } InitVars(); // Initialize Variables // Create Our OpenGL Window if (!CreateGLWindow("Magic Room",640,480,16,fullscreen)) { return 0; // Quit If Window Was Not Created } while(!done) // Loop That Runs While done=FALSE { if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) // Is There A Message Waiting? { if (msg.message==WM_QUIT) // Have We Received A Quit Message? { done=TRUE; // If So done=TRUE } else // If Not, Deal With Window Messages { TranslateMessage(&msg); // Translate The Message DispatchMessage(&msg); // Dispatch The Message } } else // If There Are No Messages if (active) { // Draw The Scene. Watch For ESC Key And Quit Messages From DrawGLScene() if (keys[VK_ESCAPE]) // Active? Was There A Quit Received? { done=TRUE; // ESC or DrawGLScene Signalled A Quit } else // Not Time To Quit, Update Screen { idle(); // Advance Simulation DrawGLScene(); // Draw Scene SwapBuffers(hDC); // Swap Buffers (Double Buffering) } if (!ProcessKeys()) return 0; } } // Shutdown KillGLWindow(); // Kill The Window glDeleteTextures(4,texture); return (msg.wParam); // Exit The Program }
void CPlayerController::Update(double deltaTime) { m_movedLThisFrame = false; m_movedRThisFrame = false; m_movedUpThisFrame = false; m_movedDownThisFrame = false; if (!m_player) return; ProcessKeys(); }
int _tmain(int argc, char **argv) { int i; TCHAR lpStr[80]; for (i = 0; i < 80; i++) lpEmpty[i] = lpHeader[i] = _T(' '); lpEmpty[79] = _T('\0'); /* Initialize global variables */ hInst = 0 /* FIXME: which value? [used with LoadString(hInst, ..., ..., ...)] */; if (LoadString(hInst, IDS_COLUMN_NUMBER, lpStr, 80)) { columnRightPositions[0] = _tcslen(lpStr) + 3; _tcsncpy(&lpHeader[2], lpStr, _tcslen(lpStr)); } if (LoadString(hInst, IDS_COLUMN_IMAGENAME, lpStr, 80)) { columnRightPositions[1] = columnRightPositions[0] + _tcslen(lpStr) + 3; _tcsncpy(&lpHeader[columnRightPositions[0] + 2], lpStr, _tcslen(lpStr)); } if (LoadString(hInst, IDS_COLUMN_PID, lpStr, 80)) { columnRightPositions[2] = columnRightPositions[1] + _tcslen(lpStr) + 3; _tcsncpy(&lpHeader[columnRightPositions[1] + 2], lpStr, _tcslen(lpStr)); } if (LoadString(hInst, IDS_COLUMN_CPU, lpStr, 80)) { columnRightPositions[3] = columnRightPositions[2] + _tcslen(lpStr) + 3; _tcsncpy(&lpHeader[columnRightPositions[2] + 2], lpStr, _tcslen(lpStr)); } if (LoadString(hInst, IDS_COLUMN_MEM, lpStr, 80)) { columnRightPositions[4] = columnRightPositions[3] + _tcslen(lpStr) + 3; _tcsncpy(&lpHeader[columnRightPositions[3] + 2], lpStr, _tcslen(lpStr)); } if (LoadString(hInst, IDS_COLUMN_PF, lpStr, 80)) { columnRightPositions[5] = columnRightPositions[4] + _tcslen(lpStr) + 3; _tcsncpy(&lpHeader[columnRightPositions[4] + 2], lpStr, _tcslen(lpStr)); } for (i = 0; i < columnRightPositions[5]; i++) lpSeparator[i] = _T('-'); lpHeader[0] = _T('|'); lpSeparator[0] = _T('+'); for (i = 0; i < 6; i++) { lpHeader[columnRightPositions[i]] = _T('|'); lpSeparator[columnRightPositions[i]] = _T('+'); } lpSeparator[columnRightPositions[5] + 1] = _T('\0'); lpHeader[columnRightPositions[5] + 1] = _T('\0'); if (!LoadString(hInst, IDS_APP_TITLE, lpTitle, 80)) lpTitle[0] = _T('\0'); if (!LoadString(hInst, IDS_COLUMN_MEM_UNIT, lpMemUnit, 3)) lpMemUnit[0] = _T('\0'); if (!LoadString(hInst, IDS_MENU, lpMenu, 80)) lpMenu[0] = _T('\0'); if (!LoadString(hInst, IDS_IDLE_PROCESS, lpIdleProcess, 80)) lpIdleProcess[0] = _T('\0'); if (LoadString(hInst, IDS_MENU_QUIT, lpStr, 2)) KEY_QUIT = lpStr[0]; if (LoadString(hInst, IDS_MENU_KILL_PROCESS, lpStr, 2)) KEY_KILL = lpStr[0]; if (LoadString(hInst, IDS_YES, lpStr, 2)) KEY_YES = lpStr[0]; if (LoadString(hInst, IDS_NO, lpStr, 2)) KEY_NO = lpStr[0]; GetInputOutputHandles(); if (hStdin == INVALID_HANDLE_VALUE || hStdout == INVALID_HANDLE_VALUE) { if (LoadString(hInst, IDS_CTM_GENERAL_ERR1, lpStr, 80)) _tprintf(lpStr); return -1; } if (GetConsoleMode(hStdin, &inConMode) == 0) { if (LoadString(hInst, IDS_CTM_GENERAL_ERR2, lpStr, 80)) _tprintf(lpStr); return -1; } if (GetConsoleMode(hStdout, &outConMode) == 0) { if (LoadString(hInst, IDS_CTM_GENERAL_ERR3, lpStr, 80)) _tprintf(lpStr); return -1; } SetConsoleMode(hStdin, 0); //FIXME: Should check for error! SetConsoleMode(hStdout, 0); //FIXME: Should check for error! PerfInit(); while (1) { DWORD numEvents; PerfDataRefresh(); DisplayScreen(); /* WaitForSingleObject for console handles is not implemented in ROS */ WaitForSingleObject(hStdin, 1000); GetNumberOfConsoleInputEvents(hStdin, &numEvents); if (numEvents > 0) { if (ProcessKeys(numEvents) == TRUE) break; } } RestoreConsole(); return 0; }
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { MSG msg; BOOL done = FALSE; if (MessageBox(NULL,"Would You Like To Run In Fullscreen Mode?", "Start FullScreen?",MB_YESNO|MB_ICONQUESTION)==IDNO) fullscreen = FALSE; InitVars(); // Create Our OpenGL Window if (!CreateGLWindow("Arkanoid",640,480,16,fullscreen)) { return 0; } srand(time(NULL)); while(!done) { if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) { if (msg.message == WM_QUIT) { done = TRUE; } else { TranslateMessage(&msg); DispatchMessage(&msg); } } else if (active) { if (keys[VK_ESCAPE]) done = TRUE; if (keys[78] && (gof)) { done = TRUE; gof = false; } // 78 -- n, 89 -- y if (keys[89] && (gof)) { gameOver = TRUE; flag = 0;/*TogglePause();*/ idle(); DrawGLScene(); SwapBuffers(hDC); gof = false; } else { if ( keys[VK_SPACE] ) { bflag = true;} if(bflag){ if (keys[VK_PAUSE]){ TogglePause(); } if(pause) { DrawGLScene(); SwapBuffers(hDC); } else{ idle(); DrawGLScene(); SwapBuffers(hDC); } } else { DrawLoadScreen (); SwapBuffers(hDC); } } if (!ProcessKeys()) return 0; } } // Shutdown KillGLWindow(); glDeleteTextures(4,texture); return (msg.wParam); }
void LayoutManager::OnKeyUp(Key key) { ProcessKeys(Msg::KEYUP, key); std::cout << "OnKeyUp" << std::endl; }
void LayoutManager::OnKeyDown(Key key) { ProcessKeys(Msg::KEYDOWN, key); std::cout << "OnKeyDown" << std::endl; }