protected override void Initialize(XnaRenderer renderer) { renderer.SetResolution(1024, 768, false); TextureBook.AddSpriteSheet(@"textures\snake"); _world = new TileGrid(20, 20); _world.GetRandomEmptyTile().ContainsFood = true; _camera = new Camera2D(new Vector2(_world.Size.Width / 2, _world.Size.Height / 2), new Vector2(_world.Size.Width, _world.Size.Height)); _snake = new Snake(this, _world); _snake.Place(_world.GetTile(10, 10)); _txtBox = new TextBox(); _txtBox.Text = "5"; _txtBox.TextScale = 5; _txtBox.AutoSize = true; _txtBox.TextColor = Color.Black; _txtBox.Position = new Vector2(0, 0); UserInterface.SetResolution(600, 480); this.UserInterface.AddChild(_txtBox); }
protected override void Initialize(XnaRenderer renderer) { _camera = new Camera2D(new Vector2(50, 50), new Vector2(100, 100)); renderer.SetResolution(800, 600, false); _vertexData[0].Position = new Vector3(0, 0, 0); _vertexData[0].TextureCoordinate = new Vector2(0, 0); _vertexData[0].Color = Color.White; _vertexData[1].Position = new Vector3(1, 0, 0); _vertexData[1].TextureCoordinate = new Vector2(1, 0); _vertexData[1].Color = Color.White; _vertexData[2].Position = new Vector3(0, 1, 0); _vertexData[2].TextureCoordinate = new Vector2(0, 1); _vertexData[2].Color = Color.White; _vertexData[3].Position = new Vector3(1, 1, 0); _vertexData[3].TextureCoordinate = new Vector2(1, 1); _vertexData[3].Color = Color.White; _indexData[0] = 0; _indexData[1] = 1; _indexData[2] = 2; _indexData[3] = 2; _indexData[4] = 1; _indexData[5] = 3; TextureBook.AddSpriteSheet(@"Textures\spritesheet1"); _stickmanAnimation.AddFrame(TextureBook.GetTexture(@"Textures\spritesheet1.man2"), 1000); _stickmanAnimation.AddFrame(TextureBook.GetTexture(@"Textures\spritesheet1.man1"), 500); _stickmanAnimation.AddFrame(TextureBook.GetTexture(@"Textures\spritesheet1.man3"), 500); _stickmanAnimation.AddFrame(TextureBook.GetTexture(@"Textures\spritesheet1.man4"), 500); _stickmanAnimation.AddFrame(TextureBook.GetTexture(@"Textures\spritesheet1.man5"), 500); _stickmanAnimation.Loop = true; }