/* static */ void Game::GameLoop() { if (_networking && !_network_server) { PerformanceMeasurer::SetInactive(PFE_GAMESCRIPT); return; } if (Game::instance == NULL) { PerformanceMeasurer::SetInactive(PFE_GAMESCRIPT); return; } PerformanceMeasurer framerate(PFE_GAMESCRIPT); Game::frame_counter++; Backup<CompanyByte> cur_company(_current_company, FILE_LINE); cur_company.Change(OWNER_DEITY); Game::instance->GameLoop(); cur_company.Restore(); /* Occasionally collect garbage */ if ((Game::frame_counter & 255) == 0) { Game::instance->CollectGarbage(); } }
inline constexpr bool is_valid_video_mode(unsigned _height, int _rate, bool progressive, bool hd) { return height(construct_video_mode(_height, _rate, progressive, hd)) == _height && framerate(construct_video_mode(_height, _rate, progressive, hd)) == _rate && is_progressive(construct_video_mode(_height, _rate, progressive, hd)) && is_hd(construct_video_mode(_height, _rate, progressive, hd)); }
TranscodeProcess *DlnaYouTubeVideo::getTranscodeProcess() { FfmpegTranscoding* transcodeProcess = new FfmpegTranscoding(log()); transcodeProcess->setUrl(m_streamUrl); transcodeProcess->setLengthInSeconds(getLengthInSeconds()); transcodeProcess->setFormat(transcodeFormat); transcodeProcess->setBitrate(bitrate()); transcodeProcess->setAudioLanguages(audioLanguages()); transcodeProcess->setSubtitleLanguages(subtitleLanguages()); transcodeProcess->setFrameRate(framerate()); transcodeProcess->setAudioChannelCount(channelCount()); transcodeProcess->setAudioSampleRate(samplerate()); return transcodeProcess; }
static void DrawSurfaceToScreen() { PerformanceMeasurer framerate(PFE_VIDEO); int n = _num_dirty_rects; if (n == 0) return; _num_dirty_rects = 0; if (n > MAX_DIRTY_RECTS) { blit(_allegro_screen, screen, 0, 0, 0, 0, _allegro_screen->w, _allegro_screen->h); return; } for (int i = 0; i < n; i++) { blit(_allegro_screen, screen, _dirty_rects[i].x, _dirty_rects[i].y, _dirty_rects[i].x, _dirty_rects[i].y, _dirty_rects[i].width, _dirty_rects[i].height); } }
/** * Animate all tiles in the animated tile list, i.e.\ call AnimateTile on them. */ void AnimateAnimatedTiles() { PerformanceAccumulator framerate(PFE_GL_LANDSCAPE); const TileIndex *ti = _animated_tiles.data(); while (ti < _animated_tiles.data() + _animated_tiles.size()) { const TileIndex curr = *ti; AnimateTile(curr); /* During the AnimateTile call, DeleteAnimatedTile could have been called, * deleting an element we've already processed and pushing the rest one * slot to the left. We can detect this by checking whether the index * in the current slot has changed - if it has, an element has been deleted, * and we should process the current slot again instead of going forward. * NOTE: this will still break if more than one animated tile is being * deleted during the same AnimateTile call, but no code seems to * be doing this anyway. */ if (*ti == curr) ++ti; } }
static void DrawSurfaceToScreen() { PerformanceMeasurer framerate(PFE_VIDEO); int n = _num_dirty_rects; if (n == 0) return; _num_dirty_rects = 0; if (n > MAX_DIRTY_RECTS) { if (_sdl_screen != _sdl_realscreen) { SDL_CALL SDL_BlitSurface(_sdl_screen, NULL, _sdl_realscreen, NULL); } SDL_CALL SDL_UpdateRect(_sdl_realscreen, 0, 0, 0, 0); } else { if (_sdl_screen != _sdl_realscreen) { for (int i = 0; i < n; i++) { SDL_CALL SDL_BlitSurface(_sdl_screen, &_dirty_rects[i], _sdl_realscreen, &_dirty_rects[i]); } } SDL_CALL SDL_UpdateRects(_sdl_realscreen, n, _dirty_rects); } }