Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
        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;
        }