/// <summary> /// Adds the components. /// </summary> public void Initialize() { _assetManager = new AssetManager(Game); _assetManager.Initialize(); _frameRateCounter = new FrameRateCounter(_assetManager, _spriteBatch); _camera = new Camera(Game); _chunkManager = new ChunkManager(Game, _spriteBatch, _camera, _assetManager); _mouseManager = new MouseManager(_camera); _playingStateInterface = new PlayingStateInterface(Game, _assetManager, _spriteBatch); _playingStateInterface.Initialize(); _terrainManager = new TerrainManager(_spriteBatch, _camera, _assetManager); _chunkManager.Initialize(); _jobManager = new JobManager(_terrainManager); _buildMenuManager = new BuildMenuManager(_spriteBatch, _camera, _playingStateInterface, _assetManager, _terrainManager, _jobManager); _npcManager = new NPCManager(_camera, _assetManager, _spriteBatch); _npcManager.Initialize(); _graph = new Graph(); }
public Engine() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; this.IsMouseVisible = true; graphics.PreferredBackBufferWidth = 800; graphics.PreferredBackBufferHeight = 600; graphics.IsFullScreen = true; graphics.ApplyChanges(); Components.Add(new GameLayer(this)); bloom = new BloomComponent(this); bloom.Settings = BloomSettings.PresetSettings[0]; bloom.Settings.MixValue = 0; bloom.DebugInput = true; Components.Add(bloom); //important: add fps after bloom, else it will be blurred FrameRateCounter fps = new FrameRateCounter(this); fps.Position = new Vector2(5, 5); Components.Add(fps); Components.Add(new MessageLayer(this)); }
public Engine() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; this.IsMouseVisible = true; graphics.PreferredBackBufferWidth = 800; graphics.PreferredBackBufferHeight = 600; graphics.IsFullScreen = true; graphics.ApplyChanges(); Components.Add(new GameLayer(this)); bloom = new BloomComponent(this); bloom.Settings = BloomSettings.PresetSettings[0]; bloom.Settings.MixValue = 0; bloom.DebugInput = true; Components.Add(bloom); //important: add fps after bloom, else it will be blurred FrameRateCounter fps = new FrameRateCounter(this); fps.Position = new Vector2(5, 5); Components.Add(fps); Components.Add(new MessageLayer(this)); }
public Game1() { _graphics = new GraphicsDeviceManager(this); _graphics.GraphicsProfile = GraphicsProfile.Reach; _graphics.PreparingDeviceSettings += _graphics_PreparingDeviceSettings; _graphics.PreferMultiSampling = true; #if WINDOWS _graphics.PreferredBackBufferWidth = 1280; _graphics.PreferredBackBufferHeight = 720; IsFixedTimeStep = true; #elif WINDOWS_PHONE _graphics.PreferredBackBufferWidth = 800; _graphics.PreferredBackBufferHeight = 480; ConvertUnits.SetDisplayUnitToSimUnitRatio(16f); IsFixedTimeStep = false; #endif #if WINDOWS _graphics.IsFullScreen = false; #elif WINDOWS_PHONE _graphics.IsFullScreen = true; #endif Content.RootDirectory = "Content"; //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); }
public Game1() { _graphics = new GraphicsDeviceManager(this) { PreferMultiSampling = true, PreferredBackBufferWidth = 1600, PreferredBackBufferHeight = 900, IsFullScreen = false }; _graphics.ApplyChanges(); ConvertUnits.SetDisplayUnitToSimUnitRatio(1.0f); IsFixedTimeStep = true; //IsMouseVisible = true; Window.Title = string.Format("Warlords Revenge [Resolution {0}x{1}]", _graphics.PreferredBackBufferWidth, _graphics.PreferredBackBufferHeight); Window.ClientSizeChanged += Window_ClientSizeChanged; Window.AllowUserResizing = true; Content.RootDirectory = "Content"; //new-up components and add to Game.Components ScreenManager = new ScreenManager(this); Components.Add(ScreenManager); var frameRateCounter = new FrameRateCounter(ScreenManager) { DrawOrder = 101 }; Components.Add(frameRateCounter); }
public FarseerPhysicsGame() { Window.Title = "Farseer Samples Framework"; _graphics = new GraphicsDeviceManager(this); _graphics.PreferMultiSampling = true; #if WINDOWS || XBOX _graphics.PreferredBackBufferWidth = 1280; _graphics.PreferredBackBufferHeight = 720; ConvertUnits.SetDisplayUnitToSimUnitRatio(24f); IsFixedTimeStep = true; #elif WINDOWS_PHONE _graphics.PreferredBackBufferWidth = 800; _graphics.PreferredBackBufferHeight = 480; ConvertUnits.SetDisplayUnitToSimUnitRatio(16f); IsFixedTimeStep = false; #endif #if WINDOWS _graphics.IsFullScreen = false; #elif XBOX || WINDOWS_PHONE _graphics.IsFullScreen = true; #endif Content.RootDirectory = "Content"; //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); }
public Game1() { //graphics = new GraphicsDeviceManager(this); //Content.RootDirectory = "Content"; // Frame rate is 30 fps by default for Windows Phone. //TargetElapsedTime = TimeSpan.FromTicks(333333); // Extend battery life under lock. Window.Title = "Laby Game"; _graphics = new GraphicsDeviceManager(this); _graphics.PreferMultiSampling = true; _graphics.PreferredBackBufferWidth = 800; _graphics.PreferredBackBufferHeight = 480; ConvertUnits.SetDisplayUnitToSimUnitRatio(16f); IsFixedTimeStep = false; _graphics.IsFullScreen = true; Content.RootDirectory = "Content"; //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); }
public GameMenuLauncher() { SettingsManager.LoadSettings(); Window.Title = "Game Menu for MonoGame"; IsFixedTimeStep = true; Content.RootDirectory = "Content"; //new-up components and add to Game.Components ScreenManager = new ScreenManager(this, SettingsManager.GetResolutionScale(SettingsManager.Settings.Resolution)); Components.Add(ScreenManager); ScreenManager.graphicsInitialize(); FrameRateCounter frameRateCounter = new FrameRateCounter(ScreenManager); frameRateCounter.DrawOrder = 101; Components.Add(frameRateCounter); LogoScreen1Done = false; LogoScreen2Done = false; }
public Game() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; graphics.PreferMultiSampling = true; #if WINDOWS || XBOX graphics.PreferredBackBufferWidth = 800; graphics.PreferredBackBufferHeight = 480; ConvertUnits.SetDisplayUnitToSimUnitRatio(1f); IsFixedTimeStep = true; #elif WINDOWS_PHONE _graphics.PreferredBackBufferWidth = 800; _graphics.PreferredBackBufferHeight = 480; ConvertUnits.SetDisplayUnitToSimUnitRatio(16f); IsFixedTimeStep = false; #endif #if WINDOWS graphics.IsFullScreen = false; #elif XBOX || WINDOWS_PHONE _graphics.IsFullScreen = true; #endif ScreenManager = new ScreenManager(this); Components.Add(ScreenManager); FrameRateCounter frameRateCounter = new FrameRateCounter(ScreenManager); frameRateCounter.DrawOrder = 101; Components.Add(frameRateCounter); }
public FarseerPhysicsGame(UserControl userControl, Canvas drawingCanvas, Canvas debugCanvas, TextBlock txtFPS, TextBlock txtDebug) : base(userControl, drawingCanvas, debugCanvas, txtDebug) { TargetElapsedTime = new TimeSpan(0, 0, 0, 0, 16); IsFixedTimeStep = true; //new-up components and add to Game.Components ScreenManager = new ScreenManager(this); Components.Add(ScreenManager); if (txtFPS != null) { FrameRateCounter frameRateCounter = new FrameRateCounter(ScreenManager, txtFPS); Components.Add(frameRateCounter); } Demo1Screen demo1 = new Demo1Screen(); Demo2Screen demo2 = new Demo2Screen(); Demo3Screen demo3 = new Demo3Screen(); Demo4Screen demo4 = new Demo4Screen(); Demo5Screen demo5 = new Demo5Screen(); Demo6Screen demo6 = new Demo6Screen(); Demo7Screen demo7 = new Demo7Screen(); ScreenManager.MainMenuScreen.AddMainMenuItem(demo1.GetTitle(), demo1); ScreenManager.MainMenuScreen.AddMainMenuItem(demo2.GetTitle(), demo2); ScreenManager.MainMenuScreen.AddMainMenuItem(demo3.GetTitle(), demo3); ScreenManager.MainMenuScreen.AddMainMenuItem(demo4.GetTitle(), demo4); ScreenManager.MainMenuScreen.AddMainMenuItem(demo5.GetTitle(), demo5); ScreenManager.MainMenuScreen.AddMainMenuItem(demo6.GetTitle(), demo6); ScreenManager.MainMenuScreen.AddMainMenuItem(demo7.GetTitle(), demo7); ScreenManager.GoToMainMenu(); }
protected override void Initialize() { IsFixedTimeStep = true; IsMouseVisible = false; GameSettings.Initialize(Graphics, Game.VirtualResolution); var Services = new GameServiceContainer(); Services.AddService(typeof(IGraphicsDeviceService), Graphics); Services.AddService(typeof(ISkipContent), this); InputProvider = new UserInputProvider(); StackEngine = new StackEngine(Game, Services, InputProvider, GameSettings); if (GameSettings.Debug) { InputProvider.Handler += HandleDebugInputEvent; } InputProvider.Handler += HandleSkipInputEvent; StackEngine.OnExit += Exit; Counter = new FrameRateCounter(); SetSpeed(GameSpeed.Default); base.Initialize(); }
public FarseerPhysicsGame(UserControl userControl, Canvas drawingCanvas, Canvas debugCanvas, TextBlock txtFPS, TextBlock txtDebug) : base(userControl, drawingCanvas, debugCanvas, txtDebug) { TargetElapsedTime = new TimeSpan(0, 0, 0, 0, 16); IsFixedTimeStep = true; //new-up components and add to Game.Components ScreenManager = new ScreenManager(this); Components.Add(ScreenManager); if (txtFPS != null) { FrameRateCounter frameRateCounter = new FrameRateCounter(ScreenManager, txtFPS); Components.Add(frameRateCounter); } Demo1Screen demo1 = new Demo1Screen(); Demo2Screen demo2 = new Demo2Screen(); Demo3Screen demo3 = new Demo3Screen(); Demo4Screen demo4 = new Demo4Screen(); Demo5Screen demo5 = new Demo5Screen(); Demo6Screen demo6 = new Demo6Screen(); Demo7Screen demo7 = new Demo7Screen(); ScreenManager.MainMenuScreen.AddMainMenuItem(demo1.GetTitle(), demo1); ScreenManager.MainMenuScreen.AddMainMenuItem(demo2.GetTitle(), demo2); ScreenManager.MainMenuScreen.AddMainMenuItem(demo3.GetTitle(), demo3); ScreenManager.MainMenuScreen.AddMainMenuItem(demo4.GetTitle(), demo4); ScreenManager.MainMenuScreen.AddMainMenuItem(demo5.GetTitle(), demo5); ScreenManager.MainMenuScreen.AddMainMenuItem(demo6.GetTitle(), demo6); ScreenManager.MainMenuScreen.AddMainMenuItem(demo7.GetTitle(), demo7); ScreenManager.GoToMainMenu(); }
public GameEngine(Game game) : base(game) { game.Components.Add(this); Input = new InputManager(game); camera = new CameraManager(game); debug = new DebugDrawer(); counter = new FrameRateCounter(game); physics = new PhysicsManager(game); }
/// <summary> /// Sets the fps counter /// </summary> /// <param name="fps">Fps to be displayed</param> private void UpdateFpsCounter(int fps) { // Check if we are on another thread than UI-thread. if (FrameRateCounter.InvokeRequired) { FrameRateCounter.Invoke(new Action(() => FrameRateCounter.Text = "fps: " + fps)); return; } FrameRateCounter.Text = "fps: " + fps; }
protected override void Initialize() { _input = new InputHelper(); #if WINDOWS _counter = new FrameRateCounter(); _showFPS = false; #endif _isExiting = false; base.Initialize(); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // Setup the other component managers GraphicsManager = new GraphicsManager(this); InputManager = new InputManager(this); AudioManager = new AudioManager(this); screenManager = new ScreenManager(this); frameRateCounter = new FrameRateCounter(this); base.Initialize(); }
public void Awake() { if (buttonText == null) { buttonText = GetComponentInChildren <Text>(); } var frameController = FrameRateCounter.Instance(); frameController.currentListener = this; GetComponent <Button>().onClick.AddListener(frameController.SwitchFps); frameController.UpdateText(); }
//Drawing internal static void Draw() { //Clear the graphics device Graphics.Device.Clear(Color.Transparent); //Check if there are any post processing effects if (postProcessing.Count > 0) { //Draw to a render target Device.SetRenderTarget(target); Device.Clear(Color.Transparent); } //Begin the spritebatches spriteBatches.Begin(); //If the current game state is not null, draw it if (X.CurrentState != null) { X.CurrentState.Draw(spriteBatches); } //Draw the other components GameConsole.Draw(spriteBatches); AchievementHolder.Draw(spriteBatches); //End the spritebatches spriteBatches.End(); if (postProcessing.Count > 0) { Device.SetRenderTarget(null); Texture2D texture = target; //Apply all effects for (int i = 0; i < postProcessing.Count; i++) { texture = postProcessing[i].Apply(texture, effectBatch, Vector2.Zero); } //Draw to the screen Device.SetRenderTarget(null); effectBatch.Begin(); effectBatch.Draw(texture, Vector2.Zero, Color.White); effectBatch.End(); } //Frame rate counter FrameRateCounter.Draw(); }
public GameEngine(Game game) : base(game) { game.Components.Add(this); input = new InputEngine(game); camera = new CameraEngine(game); physics = new PhysicsEngine(game); fpsCounter = new FrameRateCounter(game); audio = new AudioEngine(game); debug = new DebugEngine(); }
public BufferedScreen(Panel panel) { _panel = panel; _context = BufferedGraphicsManager.Current; _panelGraphics = _panel.CreateGraphics(); _graphicsBuffer = _context.Allocate(_panelGraphics, _panel.DisplayRectangle); actualFramerate = new FrameRateCounter(); _drawTimer = new Timer(); _drawTimer.Interval = 10; _drawTimer.Tick += Redraw; _drawTimer.Start(); }
protected override void Initialize() { // enable multithreading Settings.VelocityConstraintsMultithreadThreshold = 64; Settings.PositionConstraintsMultithreadThreshold = 64; _input = new InputHelper(); #if WINDOWS _counter = new FrameRateCounter(); _showFPS = false; #endif _isExiting = false; base.Initialize(); }
public CowFarmGame() { _graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; _graphics.PreferredBackBufferWidth = 1200; _graphics.PreferredBackBufferHeight = 900; ScreenManager = new ScreenManager(this); Components.Add(ScreenManager); FrameRateCounter frameRateCounter = new FrameRateCounter(ScreenManager); frameRateCounter.DrawOrder = 101; Components.Add(frameRateCounter); }
// Start is called before the first frame update void Start() { _frameRateCounter = FindObjectOfType<FrameRateCounter>(); if (_frameRateCounter == null) { Debug.LogError("FrameRate Counter can not be found"); } pauseMenu.SetActive(false); pauseSettingsMenu.SetActive(false); frameRateCounterToggle.SetIsOnWithoutNotify(_frameRateCounter.IsShowing); frameRateCounterToggle.onValueChanged.AddListener(OnFramerateCounterChanged); }
private void DoTest(Test t) { var c = ChannelMgr.CreateChannel(); c.Screen.GetComponent<ScreenComp>().BackgroundColor = t.BackgroundColor; channels.Add(c); t.Initialize(Factory); t.Create(); // add framerate counter var col = TTutil.InvertColor(t.BackgroundColor); FrameRateCounter.Create(col); Factory.CreateTextlet(new Vector2(2f, 750f), t.GetType().Name, col); }
protected override void Initialize() { Window.Title = "SharpDX Framework Tester"; IsMouseVisible = true; Engine.Initialize(this); InputManager.Initialize(this); PrimitiveBatch.Initialize(this.GraphicsDevice); sceneManager = new SceneManager(this); FrameRateCounter fpsCounter = new FrameRateCounter(this); GameSystems.Add(sceneManager); GameSystems.Add(fpsCounter); base.Initialize(); }
//Update and draw protected override void Update(GameTime gameTime) { //Save the game time Time.Update(gameTime); //Update X X.Update(gameTime); //Update all components InputManager.Update(); GameConsole.Update(); AchievementHolder.Update(); FrameRateCounter.Update(); Timer.UpdateAll(); Stopwatch.UpdateAll(); base.Update(gameTime); }
protected override void Initialize() { base.Initialize(); Assets.LoadAssets(); Window.AllowUserResizing = false; //Todo: make true, fix crash. Room = new Room(ScreenWidth, ScreenHeight); GlobalGameMode = new GlobalGameMode(this); _frameRateCounter = new FrameRateCounter(this); Player.CreatePlayers(Room); UI = new UserInterface(); ProcessManager = new ProcessManager(); ProcessManager.SetProcessKeybinds(); Room.ActiveGroupName = "Group1"; GlobalKeyBinds(UI); ship = Content.Load <Model>("Ship"); landscape = Content.Load <Model>("landscape"); BasicEffect.EnableDefaultLighting(ship, true); }
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()); }
protected override void LoadContent() { FrameRateCounter = new FrameRateCounter(this, Content.Load <SpriteFont>(@"Fonts\Visitor43"), GamePlayManager.SpriteBatch); GamePlayManager.StartServices(); Components.Add(GamePlayManager.GamePlayComponentManager); GamePlayManager.UiManager.AddUiContainer(new UiContainer(GameEnvironment.ScreenRectangle, new UiControlManager())); Ground = Content.Load <Texture2D>(@"Concrete"); MazeA = Content.Load <Texture2D>(@"MazeA"); MazeB = Content.Load <Texture2D>(@"MazeB"); LightTexture = LightTextureBuilder.CreatePointLight(this.GraphicsDevice, 512); //CreateLights(LightTexture, 20); //CreateHulls(50); _compoundA = LevelFromTexture(MazeA, ref _originA); _compoundB = LevelFromTexture(MazeB, ref _originB); //_compoundB.Position += ConvertUnits.ToSimUnits( MazeBOffset); Player = new Player(new Vector2(100, 100)); KryptonEngine.Lights.Add(Player.Light); }
public Game1() { DeProfiler.Run(); graphics = new GraphicsDeviceManager(this); preferredBackBufferHeight = graphics.PreferredBackBufferHeight; preferredBackBufferWidth = graphics.PreferredBackBufferWidth; //enter stealth mode at start //graphics.PreferredBackBufferHeight = 100; //graphics.PreferredBackBufferWidth = 160; FrameRateCounter frameRate = new FrameRateCounter(this); frameRate.DrawOrder = 1; Components.Add(frameRate); Content.RootDirectory = "Content"; graphics.SynchronizeWithVerticalRetrace = true; // press f3 to set it to false at runtime showDebugKeysHelp(); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // input helper Components.Add(new Xin(this)); // fps counter fpsCounter = new FrameRateCounter(this); Components.Add(fpsCounter); fpsCounter.IsVisible = settings.fpsCounter; // state manager gameStateManager = new GameStateManager(this); Components.Add(gameStateManager); // TODO: remove this when the game menu is implemented switch (settings.gameMode) { case GameMode.AI: playState = PlayState.CreateAIGame(this); break; case GameMode.Singleplayer: playState = PlayState.CreateSinglePlayerGame(this); break; case GameMode.Multiplayer: playState = PlayState.CreateLocalMultiPlayerGame(this); break; default: Exit(); //stop the game if somehow the mode is not one of those break; } gameStateManager.ChangeState(playState); base.Initialize(); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { towerRenderer = new TowerRenderer(this); Components.Add(towerRenderer); camera = new QuakeCamera(this); Components.Add(camera); ddrawer = new DebugDrawer(this); Components.Add(ddrawer); var fpsCounter = new FrameRateCounter(this); Components.Add(fpsCounter); Components.Add(new DebugOutput(this)); player = new Player(new Vector3(0, maxPos, 0), camera as QuakeCamera); physics.AddController(player.PhysicsController); player.PhysicsController.EnableController(); base.Initialize(); }