Exemplo n.º 1
0
        // Constructor
        public GamePage()
        {
            InitializeComponent();

            _game = XamlGame <VertexAndIndexBuffersGame> .Create("", this);

            // Sample code to localize the ApplicationBar
            //BuildLocalizedApplicationBar();
        }
Exemplo n.º 2
0
        //-------------------------------------------------------------------------------------
        // Class constructors

        public IndexedCubeObject(VertexAndIndexBuffersGame game, Vector3 position)
            : base(game)
        {
            // Set object properties
            Position = position;

            // Have we already built the cube vertex array in a previous instance?
            if (_vertices == null)
            {
                // No, so build them now
                BuildVertices();
                // Create the index array too
                BuildIndices();
            }
        }
        //-------------------------------------------------------------------------------------
        // Class constructors

        public VertexBufferCubeObject(VertexAndIndexBuffersGame game, Vector3 position)
            : base(game)
        {
            // Set object properties
            Position = position;

            // Have we already built the cube vertex array in a previous instance?
            if (_vertices == null)
            {
                // No, so build them now
                BuildVertices();
                // Create a vertex buffer
                _vertexBuffer = new VertexBuffer(game.GraphicsDevice, typeof(VertexPositionColor), _vertices.Length, BufferUsage.WriteOnly);
                _vertexBuffer.SetData(_vertices);
            }
        }