public Matches() { _gameTime = new GameTime(); _matchManager = new MatchManager(); _updateLoop = new HighFrequencyTimer(GlobalConfiguration.UPDATE_INTERVAL, id => Update(id)); _updateLoop.Start(); }
// private constructor since this should be a singleton private Game() { _locker = new object(); ScreenConfiguration = new ScreenConfiguration(); Configuration = new GameConfigurationManager(); RegistrationHandler = new RegistrationHandler(); RuntimeConfiguration = new RuntimeConfiguration(); DRAW_AFTER = Configuration.gameConfig.DRAW_INTERVAL / Configuration.gameConfig.UPDATE_INTERVAL; _drawFPS = 1000 / Configuration.gameConfig.DRAW_INTERVAL; _gameLoop = new HighFrequencyTimer(1000 / Configuration.gameConfig.UPDATE_INTERVAL, id => Update(id), () => { }, () => { }, (fps) => { _actualFPS = fps; }); _gameTime = new GameTime(); _world = new World(); GameHandler = new GameHandler(_world); _payloadManager = new PayloadManager(); UserHandler = new UserHandler(GameHandler); ConnectionManager = new ConnectionManager(UserHandler, _locker); _gameLoop.Start(); }
private void InitHighFrequencyTimerGameLoop() { gameLoop = new HighFrequencyTimer(62.5, id => GameLoopTick(id), () => { }, () => { }, (fps) => { actualFps = fps; }); gameLoop.Start(); }