/// <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();
        }
示例#2
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;

            WorldManager manager = new WorldManager(this);

            DrawComponent = new CowMouseComponent(this, manager);
            DrawComponent.Enabled = true;
            DrawComponent.Visible = true;
            Components.Add(DrawComponent);

            SideMenu = new SideMenu(this);
            SideMenu.Visible = true;
            Components.Add(SideMenu);

            fpsCounter = new FPSComponent(this);
            fpsCounter.Visible = false;
            Components.Add(fpsCounter);

            ClockViewer = new CowMouse.ClockViewer(manager.Clock, this);
            ClockViewer.Visible = true;
            Components.Add(ClockViewer);

            setupKeyBindings();

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

            base.Initialize();
        }