Пример #1
0
        /// <summary>
        /// Load your graphics content.
        /// </summary>
        protected override void LoadContent()
        {
            // load all of the models that will appear on the table:
            for (int i = 0; i < ModelFilenames.Length; i++)
            {
                // load the actual model, using ModelFilenames to determine what
                // file to load.
                models[i] = Content.Load <Model>(ModelFilenames[i]);

                // create an array of matrices to hold the absolute bone transforms,
                // calculate them, and copy them in.
                modelAbsoluteBoneTransforms[i] = new Matrix[models[i].Bones.Count];
                models[i].CopyAbsoluteBoneTransformsTo(
                    modelAbsoluteBoneTransforms[i]);
            }

            // now that we've loaded in the models that will sit on the table, go
            // through the same procedure for the table itself.
            table = Content.Load <Model>("Table");
            tableAbsoluteBoneTransforms = new Matrix[table.Bones.Count];
            table.CopyAbsoluteBoneTransformsTo(tableAbsoluteBoneTransforms);

            // create a spritebatch and load the font, which we'll use to draw the
            // models' names.
            spriteBatch = new SpriteBatch(graphics.GraphicsDevice);
            spriteFont  = Content.Load <SpriteFont>("hudFont");

            // calculate the projection matrix now that the graphics device is created.
            projectionMatrix = Matrix.CreatePerspectiveFieldOfView(
                MathHelper.PiOver4, GraphicsDevice.Viewport.AspectRatio, .01f, 1000);

            // Initialize the renderer for our bounding spheres
            BoundingSphereRenderer.Initialize(GraphicsDevice, 45);
        }
Пример #2
0
        protected override void Initialize()
        {
            Global.game           = this;
            Global.networkManager = new NetworkManager();
            Global.graphics       = graphics;
            Global.graphics.GraphicsDevice.DepthStencilState = DepthStencilState.Default;
            Global.viewPort  = Global.graphics.GraphicsDevice.Viewport.Bounds;
            Global.titleSafe = GetTitleSafeArea(.85f);
            axisReference    = new Axis_Reference(GraphicsDevice, 1.0f);
            BoundingSphereRenderer.Initialize(GraphicsDevice, 45);
            Global.heatmapKills       = new Heatmap(Color.Black);
            Global.heatmapDeaths      = new Heatmap(Color.Red);
            Global.heatmapUsedJetpack = new Heatmap(Color.Green);

            this.IsMouseVisible = true;
            base.Initialize();
        }