コード例 #1
0
        // Constructor
        public GamePage()
        {
            InitializeComponent();

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

            // Sample code to localize the ApplicationBar
            //BuildLocalizedApplicationBar();
        }
コード例 #2
0
        //-------------------------------------------------------------------------------------
        // Class constructors

        public TexturedSquareObject(PerspectiveGame game, Texture2D texture)
            : base(game)
        {
            // Store parameter values
            Position      = new Vector3(GameHelper.RandomNext(-5.0f, 5.0f), GameHelper.RandomNext(-5.0f, 5.0f), GameHelper.RandomNext(-100, 0));
            ObjectTexture = texture;
            Scale         = new Vector3(0.5f);

            // Create and initialize the vertices
            _vertices = new VertexPositionTexture[4];

            // Set the vertex positions for a unit size square
            _vertices[0].Position = new Vector3(-0.5f, -0.5f, 0);
            _vertices[1].Position = new Vector3(-0.5f, 0.5f, 0);
            _vertices[2].Position = new Vector3(0.5f, -0.5f, 0);
            _vertices[3].Position = new Vector3(0.5f, 0.5f, 0);
            // Set the texture coordinates to display the entire texture
            _vertices[0].TextureCoordinate = new Vector2(0, 1);
            _vertices[1].TextureCoordinate = new Vector2(0, 0);
            _vertices[2].TextureCoordinate = new Vector2(1, 1);
            _vertices[3].TextureCoordinate = new Vector2(1, 0);
        }