/// <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() { graphics.PreferredBackBufferHeight = GraphicsDevice.DisplayMode.Height; graphics.PreferredBackBufferWidth = GraphicsDevice.DisplayMode.Width; graphics.IsFullScreen = true; graphics.PreferMultiSampling = true; graphics.ApplyChanges(); _resolutionIndependence = new ResolutionIndependentRenderer(this); // TODO: Add your initialization logic here _resolutionIndependence.VirtualWidth = 1920; _resolutionIndependence.VirtualHeight = (int)(1920 / ((float)graphics.PreferredBackBufferWidth / graphics.PreferredBackBufferHeight));//1080; _resolutionIndependence.ScreenWidth = graphics.PreferredBackBufferWidth; _resolutionIndependence.ScreenHeight = graphics.PreferredBackBufferHeight; _resolutionIndependence.BackgroundColor = Color.Black; _resolutionIndependence.Initialize(); _camera = new Camera2D(_resolutionIndependence); _camera.Zoom = 1f; _camera.Position = new Vector2(_resolutionIndependence.VirtualWidth / 2, _resolutionIndependence.VirtualHeight / 2); _camera.RecalculateTransformationMatrices(); _screenSize = new Vector2(_resolutionIndependence.VirtualWidth, _resolutionIndependence.VirtualHeight); Art.LoadContent(Content); Sound.Load(Content); ScreenManager.Initialize(Content); ScreenManager.PushScreen(new MainMenu(), false); ScreenManager.PushScreen(new SplashScreen(), false); base.Initialize(); }
public Camera2D(ResolutionIndependentRenderer resolutionIndependence) { ResolutionIndependentRenderer = resolutionIndependence; _zoom = 0.1f; _rotation = 0.0f; _position = Vector2.Zero; }