Display 480 x 800 QVGA 320 x 480

  • Slides: 60
Download presentation

Display 480 x 800 QVGA 320 x 480 HVGA Capacitive touch 4 or more

Display 480 x 800 QVGA 320 x 480 HVGA Capacitive touch 4 or more contact points Sensors A-GPS, Accelerometer, Compass Camera 5 mega pixels or more Dedicated camera button Hardware buttons Start, Search, Back Multimedia Common detailed specs Codec acceleration Memory 256 MB RAM or more 8 GB Flash or more GPU Direct. X 9 acceleration CPU ARMv 7 Cortex/Scorpion or better 1 G

Initialize Update Draw Load. Content

Initialize Update Draw Load. Content

// Game World Texture 2 D cloud. Texture; Vector 2 cloud. Position;

// Game World Texture 2 D cloud. Texture; Vector 2 cloud. Position;

protected override void Load. Content() { sprite. Batch = new Sprite. Batch(Graphics. Device); cloud.

protected override void Load. Content() { sprite. Batch = new Sprite. Batch(Graphics. Device); cloud. Position = new Vector 2(0, 0); cloud. Texture = Content. Load<Texture 2 D>("Cloud"); }

protected override void Draw(Game. Time game. Time) { Graphics. Device. Clear(Color. Cornflower. Blue); sprite.

protected override void Draw(Game. Time game. Time) { Graphics. Device. Clear(Color. Cornflower. Blue); sprite. Batch. Begin(); sprite. Batch. Draw(cloud. Texture, cloud. Position, Color. White); sprite. Batch. End(); base. Draw(game. Time); }

Display. Orientation. Portrait | Display. Orientation. Landscape. Left | Display. Orientation. Landscape. Right;

Display. Orientation. Portrait | Display. Orientation. Landscape. Left | Display. Orientation. Landscape. Right;

new Event. Handler<Event. Args>(Window_Orientation. Changed); . . . void Window_Orientation. Changed(object sender, Event. Args

new Event. Handler<Event. Args>(Window_Orientation. Changed); . . . void Window_Orientation. Changed(object sender, Event. Args e) { if (Window. Current. Orientation == Display. Orientation. Portrait) { // gone to portrait orientation } }

graphics. Preferred. Back. Buffer. Width = 240; graphics. Preferred. Back. Buffer. Height = 400;

graphics. Preferred. Back. Buffer. Width = 240; graphics. Preferred. Back. Buffer. Height = 400;

true;

true;

protected override void Initialize() { graphics. Supported. Orientations = Display. Orientation. Landscape. Left ;

protected override void Initialize() { graphics. Supported. Orientations = Display. Orientation. Landscape. Left ; graphics. Is. Full. Screen = true; graphics. Preferred. Back. Buffer. Width = 800; graphics. Preferred. Back. Buffer. Height = 480; }

Vector 2 cloud. Speed = new Vector 2(1. 5 f, 0); protected override void

Vector 2 cloud. Speed = new Vector 2(1. 5 f, 0); protected override void Update(Game. Time game. Time) { cloud. Position += cloud. Speed; base. Update(game. Time); }

interface ISprite { void Draw(Cloud. Game game); void Update(Cloud. Game game); } // Game

interface ISprite { void Draw(Cloud. Game game); void Update(Cloud. Game game); } // Game World List<ISprite> game. Sprites = new List<ISprite>();

class Cloud : Cloud. Game. ISprite { public Texture 2 D Cloud. Texture; public

class Cloud : Cloud. Game. ISprite { public Texture 2 D Cloud. Texture; public Vector 2 Cloud. Position; public Vector 2 Cloud. Speed; public void Draw(Cloud. Game game). . . public void Update(Cloud. Game game). . . public Cloud(Texture 2 D in. Texture, Vector 2 in. Position, Vector 2 in. Speed). . . }

Vector 2 position = new Vector 2(rand. Next(Graphics. Device. Viewport. Width), rand. Next(Graphics. Device.

Vector 2 position = new Vector 2(rand. Next(Graphics. Device. Viewport. Width), rand. Next(Graphics. Device. Viewport. Height)); Vector 2 speed = new Vector 2(rand. Next(0, 100) / 100 f, 0); Cloud c = new Cloud( cloud. Texture, position, speed); game. Sprites. Add(c);

protected override void Update(Game. Time game. Time) { foreach (ISprite sprite in game. Sprites)

protected override void Update(Game. Time game. Time) { foreach (ISprite sprite in game. Sprites) sprite. Update(this); base. Update(game. Time); }

Touch. Collection Touches; protected override void Update(Game. Time game. Time) { Touch. Panel. Get.

Touch. Collection Touches; protected override void Update(Game. Time game. Time) { Touch. Panel. Get. State(); foreach (ISprite sprite in game. Sprites) sprite. Update(this); }

foreach (Touch. Location touch in game. Touches) { if (touch. State == Touch. Location.

foreach (Touch. Location touch in game. Touches) { if (touch. State == Touch. Location. State. Pressed) { if ( Cloud. Contains(touch. Position) ) { Burst = true; return; } } }

public bool Cloud. Contains(Vector 2 pos) { if (pos. X < Cloud. Position. X)

public bool Cloud. Contains(Vector 2 pos) { if (pos. X < Cloud. Position. X) return false; if (pos. X > (Cloud. Position. X + Cloud. Texture. Width)) return false; if (pos. Y < Cloud. Position. Y) return false; if (pos. Y > (Cloud. Position. Y + Cloud. Texture. Height)) return false; return true; }

public Sound. Effect Cloud. Pop. Sound; . . . Sound. Effect Cloud. Pop. Sound

public Sound. Effect Cloud. Pop. Sound; . . . Sound. Effect Cloud. Pop. Sound = Content. Load<Sound. Effect>("Pop"); . . .

Touch. Panel. Enabled. Gestures = Gesture. Type. Flick;

Touch. Panel. Enabled. Gestures = Gesture. Type. Flick;

while (Touch. Panel. Is. Gesture. Available) { Gesture. Sample gesture = Touch. Panel. Read.

while (Touch. Panel. Is. Gesture. Available) { Gesture. Sample gesture = Touch. Panel. Read. Gesture(); if (gesture. Gesture. Type == Gesture. Type. Flick) { water. Cloud. Speed = gesture. Delta / 100 f; } }

using Microsoft. Devices. Sensors;

using Microsoft. Devices. Sensors;

Accelerometer accel; private void start. Accelerometer() { accel = new Accelerometer(); accel. Reading. Changed

Accelerometer accel; private void start. Accelerometer() { accel = new Accelerometer(); accel. Reading. Changed += new Event. Handler <Accelerometer. Reading. Event. Args> (accel_Reading. Changed); accel. Start(); }

Vector 3 accel. Reading; void accel_Reading. Changed(object sender, Accelerometer. Reading. Event. Args e) {

Vector 3 accel. Reading; void accel_Reading. Changed(object sender, Accelerometer. Reading. Event. Args e) { lock (this) { accel. Reading. X = (float)e. X; accel. Reading. Y = (float)e. Y; accel. Reading. Z = (float)e. Z; } }

Vector 3 get. Acc. Reading() { Vector 3 result; lock (this) { result =

Vector 3 get. Acc. Reading() { Vector 3 result; lock (this) { result = new Vector 3(accel. Reading. X, accel. Reading. Y, accel. Reading. Z); } return result; }

Vector 3 acceleration = game. get. Acc. Reading(); Cloud. Speed. X -= acceleration. Y

Vector 3 acceleration = game. get. Acc. Reading(); Cloud. Speed. X -= acceleration. Y * 0. 1 f; Cloud. Position += Cloud. Speed;

void wc_Open. Read. Completed(object sender, Open. Read. Completed. Event. Args e) { if (e.

void wc_Open. Read. Completed(object sender, Open. Read. Completed. Event. Args e) { if (e. Error == null) { map. Image = Texture 2 D. From. Stream(graphics. Graphics. Device, e. Result); } }

http: //create. msdn. com http: //pubcenter. microsoft. com http: //robmiles. com

http: //create. msdn. com http: //pubcenter. microsoft. com http: //robmiles. com