INT_PTR VDDialogCaptureCropping::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: OnInit(); return TRUE; case WM_COMMAND: switch(LOWORD(wParam)) { case IDOK: { ClippingControlBounds ccb; SendMessage(GetDlgItem(mhdlg, IDC_BORDERS), CCM_GETCLIPBOUNDS, 0, (LPARAM)&ccb); mFilterSetup.mCropRect.left = ccb.x1; mFilterSetup.mCropRect.top = ccb.y1; mFilterSetup.mCropRect.right = ccb.x2; mFilterSetup.mCropRect.bottom = ccb.y2; OnCleanup(); End(TRUE); } return TRUE; case IDCANCEL: OnCleanup(); End(FALSE); return TRUE; } break; case WM_TIMER: break; case WM_USER+100: vdsynchronized(mDisplayBufferLock) { IVDClippingControl *pCC = VDGetIClippingControl((VDGUIHandle)GetDlgItem(mhdlg, IDC_BORDERS)); if (mLastFrameWidth != mDisplayBuffer.w || mLastFrameHeight != mDisplayBuffer.h) { mLastFrameWidth = mDisplayBuffer.w; mLastFrameHeight = mDisplayBuffer.h; vdrect32 r; pCC->GetClipBounds(r); pCC->SetBitmapSize(mDisplayBuffer.w, mDisplayBuffer.h); Layout(); pCC->SetClipBounds(r); } pCC->BlitFrame(&mDisplayBuffer); } break; } return FALSE; }
int App::OnExecute() { if(OnInit() == false) { return -1; } controller->Initialize(); SDL_Event Event; while(running) { Scene* scene = controller->GetCurrentScene(); if (scene == NULL) { break; } if(SDL_PollEvent(&Event)) { OnEvent(scene, &Event); } OnLoop(scene); OnRender(scene); } OnCleanup(); return 0; }
int OnExecute() { if (OnInit() == false) { return -1; } SDL_Event Event; while(Running) { if (g_engine) { for (int x = 0; x < 5 && SDL_WaitEventTimeout(&Event, 10); ++x) { if(!g_engine->IsPaused()) OnEvent(&Event); } if(!g_engine->IsPaused()) OnUpdate(); } } OnCleanup(); return 0; };
int CApp::OnExecute(){ if (OnInit() == false){ return -1; } SDL_Event Event; while(Running){ while(SDL_PollEvent(&Event)){ OnEvent(&Event); } OnLoop(); OnRender(); } OnCleanup(); return 0; }
//------------------------------------------------------------------------------ int CApp::OnExecute() { if(OnInit() == false) { return -1; } SDL_Event Event; while(Running) { if(AIenabled && CurrentPlayer && GameState == GAME_STATE_RUNNING) { GameClick(AIMove()); } while(SDL_PollEvent(&Event)) { OnEvent(&Event); } OnLoop(); OnRender(); } OnCleanup(); return 0; }
void Object::Destroy() { App::Application.CurrentRoom->RemoveObject(this); int x = App::Application.CurrentRoom->GetXTile(X); int y = App::Application.CurrentRoom->GetYTile(Y); App::Application.CurrentRoom->LeaveTile(this, y, x); OnCleanup(); }
///////////////////////////////////////////////////////////////////// // // Function: Execute // // Description: // ///////////////////////////////////////////////////////////////////// UINT BOINCCABase::Execute() { UINT uiReturnValue = 0; OnInitialize(); if ( TRUE == MsiGetMode( m_hMSIHandle, MSIRUNMODE_SCHEDULED ) ) { uiReturnValue = OnInstall(); } else if ( TRUE == MsiGetMode( m_hMSIHandle, MSIRUNMODE_COMMIT ) ) { uiReturnValue = OnCommit(); } else if ( TRUE == MsiGetMode( m_hMSIHandle, MSIRUNMODE_ROLLBACK ) ) { uiReturnValue = OnRollback(); } else { uiReturnValue = OnExecution(); } OnCleanup(); return uiReturnValue; }
int CApp::OnExecute(int argc, char **argv) { if(OnInit(argc, argv) == false) { return -1; } SDL_Event Event; bool calculatedFrame; while(Running) { //BulletManager::Step(); while(SDL_PollEvent(&Event)) { OnEvent(&Event); } calculatedFrame= false; while ((SDL_GetTicks() - GameBaseTime) > GameTickLength) { gameTime = SDL_GetTicks() / 1000.0f; GameBaseTime += GameTickLength; OnUpdate(); calculatedFrame = true; } BulletManager::Step(); OnDraw(); } OnCleanup(); return 0; }
//============================================================================= bool CArea::OnLoad(char* File) { OnCleanup(); FILE* FileHandle = fopen(File, "r"); if(FileHandle == NULL) { return false; } char TilesetFile[255]; fscanf(FileHandle, "%s\n", TilesetFile); printf("----------\n"); printf("FileHandle: %d\n", FileHandle); printf("TilesetFile: %s\n", TilesetFile); if((Surf_Tileset = CSurface::OnLoad(TilesetFile)) == false) { fclose(FileHandle); return false; } fscanf(FileHandle, "%d\n", &AreaSize); printf("----------\n"); printf("FileHandle: %d\n", FileHandle); printf("AreaSize: %d\n", AreaSize); for(int X = 0;X < AreaSize;X++) { for(int Y = 0;Y < AreaSize;Y++) { char MapFile[255]; fscanf(FileHandle, "%s ", MapFile); printf("----------\n"); printf("FileHandle: %d\n", FileHandle); printf("MapFile: %s\n", MapFile); CMap tempMap; if(tempMap.OnLoad(MapFile) == false) { fclose(FileHandle); return false; } tempMap.Surf_Tileset = Surf_Tileset; MapList.push_back(tempMap); } fscanf(FileHandle, "\n"); } fclose(FileHandle); return true; }
//============================================================================= bool Area::OnLoad(char* File) { //clears area resources OnCleanup(); //opens File FILE* FileHandle = fopen(File, "r"); //kicks back if file is empty if(FileHandle == NULL) { return false; } char TilesetFile[255]; //reads .maps file fscanf(FileHandle, "%s\n", TilesetFile); if((Surf_Tileset = Surface::OnLoad(TilesetFile)) == false) { fclose(FileHandle); return false; } //reads area size from .area fscanf(FileHandle, "%d\n", &AreaSize); //runs through each tile in the area for(int X = 0;X < AreaSize;X++) { for(int Y = 0;Y < AreaSize;Y++) { char MapFile[255]; fscanf(FileHandle, "%s ", MapFile); Map tempMap; if(tempMap.OnLoad(MapFile) == false) { fclose(FileHandle); return false; } tempMap.Surf_Tileset = Surf_Tileset; MapList.push_back(tempMap); } fscanf(FileHandle, "\n"); } fclose(FileHandle); return true; }
//============================================================================= bool CArea::OnLoad(char* File) { OnCleanup(); FILE* FileHandle; errno_t err = fopen_s(&FileHandle, File, "r"); if(FileHandle == NULL || err != 0) { debug("Error: Couldn't open area file."); return false; } char TilesetFile[255]; // Load tileset picture to a surface fscanf_s(FileHandle, "%s\n", TilesetFile); if((Surf_Tileset = CSurface::OnLoad(TilesetFile)) == false) { fclose(FileHandle); debug("Error: Couldn't load tileset for area."); return false; } // Load maps to CAreas MapList int numberOfMaps; fscanf_s(FileHandle, "%d\n", &numberOfMaps); for(int X = 0;X < numberOfMaps;X++) { char MapFile[255]; fscanf_s(FileHandle, "%s ", MapFile); // Load map's tileset into map's Tilelist CMap tempMap(X); if(tempMap.OnLoad(MapFile) == false) { fclose(FileHandle); debug("Error: Couldn't load tilset for map."); return false; } tempMap.Surf_Tileset = Surf_Tileset; MapList.push_back(tempMap); fscanf_s(FileHandle, "\n"); } fclose(FileHandle); std::string filename = File; debug("Loaded area " + filename, 2); return true; }
//Main Loop for the whole application int MainApp::OnExecute() { //Did we initilize correcrlt if(OnInit() == false) { return -1; } SDL_Event Event; //holding for events from SDL //While we are running while (Running) { //check we did not hit our max millisecond Hz if(!MainRenderTarget.FrameRateControl.TargetRateHit()) { //Get latest events while (SDL_PollEvent(&Event)) { //Update Events OnEvent(&Event); } //Update game logic OnLoop(); //Draw OnRender(); //MainRenderTarget.Render(); } else { //if we reached our target Hz sleep for one millisecond Sleep(1); } } //clean everything up OnCleanup(); return 0; }
int Gravity::OnExecute() { if (OnInit() == false) { cerr << "Failed to initialize." << endl; return -1; } SDL_Event Event; while (isRunning) { while (SDL_PollEvent(&Event)) { OnEvent(&Event); } OnLoop(); OnRender(); } OnCleanup(); return 0; }
int SDLApp::OnExecute() { if (!OnInit()) return -1; SDL_Event Event; while(Running) { while(SDL_PollEvent(&Event)) { OnEvent(&Event); } //OnLoop(); //OnRender(); } OnCleanup(); return 0; }
int AscentApp::OnExecute() { if (!OnInit()) return -1; SDL_Event event; while (running) { Uint32 lstart = SDL_GetTicks(); while (SDL_PollEvent(&event)) OnEvent(&event); OnLoop(); OnRender(); Uint32 lend = SDL_GetTicks(); if ((lend - lstart) < LOOP_TIME) SDL_Delay(LOOP_TIME - (lend - lstart)); } OnCleanup(); return 0; }
//------------------------------------------------------------------------------ int CMenu::OnExecute() { Running = 1; if(OnInit() == false) { return -1; } SDL_Event Event; while(Running==1) { while(SDL_PollEvent(&Event)) { OnEvent(&Event); } OnLoop(); OnRender(); } OnCleanup(); return Running; }
int Field::OnExecute() { if(OnInit() == false) return -1; SDL_Event Event; int ticks, delta_ticks, delay_time; bool opponent_move = true, ball_move_x = true, ball_move_y = true; while(Running) { ticks = SDL_GetTicks(); while(SDL_PollEvent(&Event)) OnEvent(&Event); OnLoop(&opponent_move, &ball_move_x, &ball_move_y); OnRender(); delta_ticks = SDL_GetTicks() - ticks; delay_time = (100/6) - delta_ticks; if(delay_time > 0) { SDL_Delay(delay_time); } } OnCleanup(); return 0; }
int SFMLApp::OnExecute(void) { //main program function if(!OnInit()) return -1; sf::Event Event; while(m_running) { while(m_mainWindow.pollEvent(Event)) { OnEvent(Event); } OnUpdate(); OnRender(); } OnCleanup(); return 0; }
int Game::OnExecute(char* argv[]) { if (OnInit() == false) return -1; printf("Go Engine Go!\n\n"); SDL_Event event; while (StillBreathing) { while (SDL_PollEvent(&event)) OnEvent(&event); OnLoop(); OnRender(); } OnCleanup(); return 0; }
int GFX::OnExecute() { if(OnInit() == false) return -1; while (m_app->IsOpened()) { sf::Event e; while (m_app->GetEvent(e)) OnEvent(e); OnLoop(); OnRender(); while (m_app->GetEvent(e)) OnEvent(e); } OnCleanup(); return 1; }
int game::OnExecute() { if(OnInit() == false) { return -1; } if(LoadContent() == false) { return -1; } while(Running) { while(SDL_PollEvent(&Event)) { OnEvent(&Event); } OnLoop(); OnRender(); } OnCleanup(); return 0; }
/** * @brief Main application loop; runs until program exit. * * @return 0 if no error, -1 otherwise. */ int MazeSolverApp::OnExecute() { SDL_Event Event; if(OnInit() == false) { return -1; } OnRender(); while (running) { while(SDL_PollEvent(&Event)) { OnEvent(&Event); } } OnCleanup(); return 0; }
bool CSimultaneousOfAction::OnLoop() { if (_actionList.size() < 1) return true; size_t __count = 0; for (list<pair<CActionBaseClass*, bool> >::iterator it = _actionList.begin(); it != _actionList.end();){ if (!(*it).second){ if (_skip || _allSkip) (*it).first->SetSkip(); if ((*it).first->OnLoop()){ if (_actionList.size() < 1){// if run to load script command _skip = false; return true; } (*it).second = true; __count++; } } else __count++; ++it; } _skip = false; if (_actionList.size() == __count){ if (IsDelete()) OnCleanup(); return true; } return false; }
int CApp::Execute() { if (!OnInit()) return -1; //jokela::Timer timer(FPS); SDL_Event Event; //timer.Start(); while (Running) { while (SDL_PollEvent(&Event)) { OnEvent(&Event); } if (true/*timer.ReadyForNextFrame()*/) { OnLoop(); OnRender(); } } OnCleanup(); return 0; }
SDLWrapper::~SDLWrapper( ) { OnCleanup( ); }
MusicSound::~MusicSound() { OnCleanup(); }
//============================================================================= bool CArea::OnLoad(char* File) { OnCleanup(); FILE* FileHandle = fopen(File, "r"); if(FileHandle == NULL) { return false; } char PassablesFile[255]; char ImpassablesFile[255]; fscanf(FileHandle, "%255s\n", PassablesFile); fscanf(FileHandle, "%255s\n", ImpassablesFile); if((Surf_Tileset_Passables = CSurface::OnLoad(PassablesFile)) == false) { fclose(FileHandle); return false; } if((Surf_Tileset_Impassables = CSurface::OnLoad(ImpassablesFile)) == false) { fclose(FileHandle); return false; } fscanf(FileHandle, "%d:%d\n", &areaWidth, &areaHeight); // I added the MapWidth and MapHeight here for the sake of adding enemies in CMap::OnLoad() int ID = 0; int MapWidth = MAP_WIDTH * TILE_SIZE; int MapHeight = MAP_HEIGHT * TILE_SIZE; for(int Y = 0; Y < areaHeight; Y++) { for(int X = 0; X < areaWidth; X++) { char MapFile[255]; fscanf(FileHandle, "%s255 ", MapFile); int nX = ((ID % areaWidth) * MapWidth); int nY = ((ID / areaWidth) * MapHeight); CMap tempMap; if(tempMap.OnLoad(MapFile, nX, nY) == false) { fclose(FileHandle); return false; } tempMap.Surf_Tileset_Passables = Surf_Tileset_Passables; tempMap.Surf_Tileset_Impassables = Surf_Tileset_Impassables; MapList.push_back(tempMap); ID++; } fscanf(FileHandle, "\n"); } fclose(FileHandle); return true; }
Weapon::~Weapon() { OnCleanup(); }
virtual void OnUserQuit(userrec* user, const std::string &message, const std::string &oper_message) { OnCleanup(TYPE_USER, user); }
CApp::~CApp() { OnCleanup(); }