Jump to content

  • Log In with Google      Sign In   
  • Create Account

#Actualburnt_casadilla

Posted 31 May 2013 - 01:53 AM

protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            cube = new Cube(device);

            camera = new Camera(new Vector3(0.5f, 1.5f, 0.5f), 0, GraphicsDevice.Viewport.AspectRatio, 0.5f, 100f);
            effect = new BasicEffect(GraphicsDevice);
            cubes = new DrawableList<Cube>(this, camera, effect);
            device = GraphicsDevice;
            
            for (int x = 0; x < mapCoordsX; x++)
            {
                mapX[x] = x;
            }

            for (int z = 0; z < mapCoordsZ; z++)
            {
                mapZ[z] = z;
            }

            for (int y = 0; y < mapCoordsY; y++)
            {
                mapY[y] = y;
            }

            base.Initialize();
        }

        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            cube.CreateCubeVertexBuffer();
            cube.CreateCubeIndexBuffer();
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            font = Content.Load<SpriteFont>("font");
            grass = Content.Load<Texture2D>("grass");

            // TODO: use this.Content to load your game content here
            Components.Add(cubes);

            for (int x = 0; x < 50; x++)
            {
                for (int z = 0; z < 50; z++)
                {
                    cubes.Add(new Vector3(mapX[x], 0f, mapZ[z]), Matrix.Identity, grass);
                }
            }

            string mapString = reader.ReadToEnd();
        }

Here's both of the methods. Would it make sense to put the CreateBuffer methods in the constructor of the cube? 

 

"cubes" is a drawable list made up of cubes


#1burnt_casadilla

Posted 31 May 2013 - 01:51 AM

protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            cube = new Cube(device);

            camera = new Camera(new Vector3(0.5f, 1.5f, 0.5f), 0, GraphicsDevice.Viewport.AspectRatio, 0.5f, 100f);
            effect = new BasicEffect(GraphicsDevice);
            cubes = new DrawableList<Cube>(this, camera, effect);
            device = GraphicsDevice;
            
            for (int x = 0; x < mapCoordsX; x++)
            {
                mapX[x] = x;
            }

            for (int z = 0; z < mapCoordsZ; z++)
            {
                mapZ[z] = z;
            }

            for (int y = 0; y < mapCoordsY; y++)
            {
                mapY[y] = y;
            }

            base.Initialize();
        }

        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            cube.CreateCubeVertexBuffer();
            cube.CreateCubeIndexBuffer();
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            font = Content.Load<SpriteFont>("font");
            grass = Content.Load<Texture2D>("grass");

            // TODO: use this.Content to load your game content here
            Components.Add(cubes);

            for (int x = 0; x < 50; x++)
            {
                for (int z = 0; z < 50; z++)
                {
                    cubes.Add(new Vector3(mapX[x], 0f, mapZ[z]), Matrix.Identity, grass);
                }
            }

            string mapString = reader.ReadToEnd();
        }

Here's both of the methods. Would it make sense to put the CreateBuffer methods in the constructor of the cube?


PARTNERS