private void ScreenSizeChanged(object sender, EventArgs args) { ResolutionIndependentRenderer.SetResolution(Setup.GameWindow.ClientBounds.Width, Setup.GameWindow.ClientBounds.Height, false); ResolutionIndependentRenderer.SetVirtualResolution(Setup.GameWindow.ClientBounds.Width, Setup.GameWindow.ClientBounds.Height); //ResolutionIndependentRenderer.Init(ref graphics); Scene.ImGUI_RenderTarget = new RenderTarget2D(Setup.GraphicsDevice, Setup.graphics.PreferredBackBufferWidth, Setup.graphics.PreferredBackBufferHeight, false, Setup.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24); Light.RenderTarget2D = new RenderTarget2D(Setup.GraphicsDevice, Setup.graphics.PreferredBackBufferWidth, Setup.graphics.PreferredBackBufferHeight, false, Setup.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24); Light.ShadowMap = new RenderTarget2D(Setup.GraphicsDevice, Setup.graphics.PreferredBackBufferWidth, Setup.graphics.PreferredBackBufferHeight, false, Setup.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.None); //Depth is not needed SceneManager.SceneTexPtr = Scene.GuiRenderer.BindTexture(Light.RenderTarget2D); }
public override void Update(GameTime gameTime) { gameObject.Name = "Camera Controller"; gameObject.ShouldBeDeleted = false; gameObject.ShouldBeRemoved = false; Setup.Camera.Position = gameObject.Transform.Position; Setup.Camera.Rotation = gameObject.Transform.Rotation; gameObject.Transform.Scale = Vector2.One; Setup.Camera.Zoom = CameraZoom; if (Dirty && !FN_Editor.EditorScene.IsThisTheEditor) { Dirty = false; ResolutionIndependentRenderer.SetVirtualResolution(TargetResolution.X, TargetResolution.Y); ResolutionIndependentRenderer.SetResolution(ScreenSize.X, ScreenSize.Y, IsFullScreen); ResolutionIndependentRenderer.Init(ref Setup.graphics); } }
private void ImportantIntialization() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); /////////Camera And Resolution Independent Renderer/////// -> Mandatory Camera = new Camera2D(); Camera.Zoom = 1f; Setup.Initialize(graphics, Content, spriteBatch, Window, Camera, this); ResolutionIndependentRenderer.Init(ref graphics); ResolutionIndependentRenderer.SetVirtualResolution(1366, 768); ResolutionIndependentRenderer.SetResolution(1366, 768, false); PrevRes = new Vector2(1366, 768); Exiting += SerializeBeforeExit; AppDomain.CurrentDomain.UnhandledException += CleanUp; Window.ClientSizeChanged += ScreenSizeChanged; }