public FrameRateCounter(ScreenManager screenManager) : base(screenManager.Game) { _screenManager = screenManager; _format = new NumberFormatInfo(); _format.NumberDecimalSeparator = "."; }
public FarseerPhysicsGame() { Window.Title = "Farseer Physics Engine Samples Framework"; _graphics = new GraphicsDeviceManager(this); _graphics.SynchronizeWithVerticalRetrace = false; TargetElapsedTime = new TimeSpan(0, 0, 0, 0, 10); IsFixedTimeStep = true; #if !XBOX //windowed _graphics.PreferredBackBufferWidth = 1024; _graphics.PreferredBackBufferHeight = 768; _graphics.IsFullScreen = false; //fullscreen //_graphics.PreferredBackBufferWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width; //_graphics.PreferredBackBufferHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height; //_graphics.IsFullScreen = true; IsMouseVisible = true; #else _graphics.PreferredBackBufferWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width; _graphics.PreferredBackBufferHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height; _graphics.IsFullScreen = true; #endif //Set window defaults. Parent game can override in constructor Window.AllowUserResizing = true; Window.ClientSizeChanged += Window_ClientSizeChanged; //new-up components and add to Game.Components _screenManager = new ScreenManager(this); Components.Add(_screenManager); FrameRateCounter frameRateCounter = new FrameRateCounter(_screenManager); frameRateCounter.DrawOrder = 101; Components.Add(frameRateCounter); _screenManager.AddScreen(new MainMenuScreen()); }