Anh chị ơi,em muốn hỏi chút về vẽ lưới chơi cơ Caro trên Windows Phone với ạ? Em chỉ được 3X3 ô,mà k vẽ được hơn ? mong anh chị giúp?
Mã:
using System;using System.Collections.Generic;using System.Linq;using Microsoft.Xna.Framework;using Microsoft.Xna.Framework.Audio;using Microsoft.Xna.Framework.Content;using Microsoft.Xna.Framework.GamerServices;using Microsoft.Xna.Framework.Graphics;using Microsoft.Xna.Framework.Input;using Microsoft.Xna.Framework.Input.Touch;using Microsoft.Xna.Framework.Media; namespace CoCaRoXXX{ public enum CoCaRoPlayer { None, PlayerO, PlayerX } /// <summary> /// This is the main type for your game /// </summary> public class Game1 : Microsoft.Xna.Framework.Game { GraphicsDeviceManager graphics; SpriteBatch spriteBatch; Texture2D gridTexture; Rectangle gridRectangle; // Texture2D resetButton; // Rectangle resetButtonPosition; //Texture2D oPiece; // Texture2D xPiece; // Texture2D oWinner; // Texture2D xWinner; // Texture2D noWinner; // Texture2D oTurn; // Texture2D xTurn; // bool winnable; // CoCaRoPlayer winner; // CoCaRoPlayer current; //CoCaRoPlayer[,] grid; //bool touching; public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; graphics.PreferredBackBufferWidth = 480; graphics.PreferredBackBufferHeight = 800; // Frame rate is 30 fps by default for Windows Phone. TargetElapsedTime = TimeSpan.FromTicks(333333); // Extend battery life under lock. InactiveSleepTime = TimeSpan.FromSeconds(1); } /// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { base.Initialize(); } protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); gridTexture = Content.Load<Texture2D>("TicTacToe_Grid"); gridRectangle = new Rectangle(0, 0, spriteBatch.GraphicsDevice.Viewport.Width, spriteBatch.GraphicsDevice.Viewport.Height); } protected override void UnloadContent() { } protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) this.Exit(); base.Update(gameTime); } protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.Pink); spriteBatch.Begin(); DrawGrid(); spriteBatch.End(); base.Draw(gameTime); } private void DrawGrid() { spriteBatch.Draw(gridTexture, gridRectangle, Color.Black); } }}
View more random threads:
Không chỉ dừng lại ở việc sử dụng nguyên liệu cao cấp, mỗi công trình còn được "chăm sóc" bằng 4 dịch vụ xuất sắc của Tre Nghệ. Từ việc tư vấn, thiết kế đến thi công và hoàn thiện, mọi quy trình đều...
Chất Lượng và Sáng Tạo: Kiến Trúc...