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:
Vệ sinh cá nhân là một phần quan yếu của sức khỏe nam giới. Dùng dung dịch vệ sinh mỗi ngày mang lại nhiều ích, giúp loại bỏ vi khuẩn và vi sinh vật gây hại, giúp khu vực cơ quan sinh dục luôn sạch...
Gel vệ sinh cu, bạn trai có nên...