public GamePage(string launchArguments) { this.InitializeComponent(); // Create the game. _game = XamlGame <PerspectiveGame> .Create(launchArguments, Window.Current.CoreWindow, this); }
//------------------------------------------------------------------------------------- // 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); }