Пример #1
0
        /// <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()
        {
            Tile.TileVisualOffsetX = 0;
            Tile.TileVisualOffsetY = 48;

            mapVisualizer = new TileMapManagerExtension(this, @"Textures\TileSets\TileSheet");
            mapComponent  = new TileMapComponent <InGameObject>(this, mapVisualizer);
            Components.Add(mapComponent);

            fpsComponent = new FPSComponent(this);
            Components.Add(fpsComponent);

            Window.AllowUserResizing  = true;
            Window.ClientSizeChanged += new EventHandler <EventArgs>(Window_ClientSizeChanged);

            preferredWindowedWidth  = graphics.PreferredBackBufferWidth;
            preferredWindowedHeight = graphics.PreferredBackBufferHeight;

            if (hyperDrive)
            {
                this.IsFixedTimeStep = false;
                this.graphics.SynchronizeWithVerticalRetrace = false;
                this.graphics.ApplyChanges();
            }

            base.Initialize();
        }
 public TileMapComponent(Game1 game, TileMapManagerExtension map)
     : base(game)
 {
     this.mapManager = map;
 }