Esempio n. 1
0
        public Core(Vector2 screenSize, GraphicsDeviceManager graphics, ContentManager content)
        {
            GameManager.initialize(screenSize, graphics, content, this);

            graphics.PreferredBackBufferWidth = (int)screenSize.X;
            graphics.PreferredBackBufferHeight = (int)screenSize.Y;
            graphics.ApplyChanges();

            this.Cameras = new List<Camera>();
            Camera camera = new Camera(0,0,(int)screenSize.X, (int)screenSize.Y);
            this.Cameras.Add(camera);
            GameManager.currentDrawCamera = camera;

            GameManager.WorldBounds = new Rectangle(0, 0, (int)Level.LEVEL_WIDTH * Level.ROOM_WIDTH * Level.BLOCK_WIDTH, (int)Level.LEVEL_HEIGHT * Level.ROOM_HEIGHT * Level.BLOCK_HEIGHT);

            setupQuadTree();

            this.Stopwatch = new Stopwatch();
        }
Esempio n. 2
0
        public Core(Vector2 screenSize, GraphicsDeviceManager graphics, ContentManager content)
        {
            Controller.Initialize(screenSize, graphics, content, this);

            graphics.PreferredBackBufferWidth = (int)screenSize.X;
            graphics.PreferredBackBufferHeight = (int)screenSize.Y;
            graphics.SynchronizeWithVerticalRetrace = false;
            graphics.ApplyChanges();

            this.Cameras = new List<Camera>();
            Camera camera = new Camera(0,0,(int)screenSize.X, (int)screenSize.Y);
            this.Cameras.Add(camera);
            Controller.CurrentDrawCamera = camera;

            Controller.WorldBounds = new Rectangle(0, 0, 2500,2000);

            Controller.LayerController.AddLayer("base");
            SetupQuadTree();

            this.Stopwatch = new Stopwatch();
        }
Esempio n. 3
0
        private void DrawDebug(SpriteBatch spriteBatch, Camera camera, GameTime gameTime)
        {
            spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null, camera.GetTransformMatrix());
            DrawCollisionQuad(spriteBatch);
            spriteBatch.End();

            this.Stopwatch.Stop();
            DebugInfo.AddDebugItem("Draw", this.Stopwatch.ElapsedMilliseconds + " ms");
            DebugInfo.AddDebugItem("FPS", "" + Math.Round(1 / gameTime.ElapsedGameTime.TotalSeconds));

            spriteBatch.Begin();
            DebugInfo.Draw(spriteBatch);
            spriteBatch.End();
        }