예제 #1
0
        public GamePage(string launchArguments)
        {
            this.InitializeComponent();

            // Create the game.
            _game = XamlGame <GameFrameworkExampleGame> .Create(launchArguments, Window.Current.CoreWindow, this);
        }
        //-------------------------------------------------------------------------------------
        // Class constructors

        public TexturedSquareObject(GameFrameworkExampleGame game, Vector3 position, Texture2D texture, float scale)
            : base(game)
        {
            // Store parameter values
            Position      = position;
            ObjectTexture = texture;
            Scale         = new Vector3(scale);

            // 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);
        }