free phone! graphics, pick one technology browser, maps control

30

Upload: candice-short

Post on 18-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Free Phone! Graphics, pick one technology Browser, Maps Control
Page 2: Free Phone! Graphics, pick one technology Browser, Maps Control

Building Windows Phone Applications with Microsoft Silverlight and XNA

Rob CameronArchitect EvangelistMicrosoft

WPH-306

Page 3: Free Phone! Graphics, pick one technology Browser, Maps Control

Stay to the End to Win!

Free Phone!

Page 4: Free Phone! Graphics, pick one technology Browser, Maps Control

Silverlight and XNA on Windows Phone 7 RTMXNA Game Studio or Silverlight: which product is right for me?

Graphics, pick one technologySilverlight

Declarative XAMLRetained modeControls, user friendly

XNAGPU AcceleratedImmediate mode, very low level

Browser, Maps Control

Page 5: Free Phone! Graphics, pick one technology Browser, Maps Control

Silverlight and XNA on Windows Phone 7 RTMXNA Game Studio or Silverlight: which product is right for me?

Everything but graphics, mix and matchXNA framework

Audio and microphoneMedia playbackInputGamerServices, etc…

SilverlightHttpWebRequest

Page 6: Free Phone! Graphics, pick one technology Browser, Maps Control

Writing a Game for Windows Phone 7?

XNA is the likely choice

But what about…UI and controls? WebBrowser integration?Video playback?SpriteFont

Large character setsDynamic glyphs – cloud, user input

Page 7: Free Phone! Graphics, pick one technology Browser, Maps Control

Writing a Rich Connected App for Windows Phone 7?

Silverlight is the way to go

But what about…Drawing 3D ContentComplex scenes, high entity countsTexturing and effects?Using the hardware scaler?

Page 8: Free Phone! Graphics, pick one technology Browser, Maps Control

XNA Shared Graphics

XNA 3D graphics within your Silverlight app!

Silverlight app modelApplication classPhoneApplicationPage and Navigation

XNA Rendering takes over entire displaySetSharingMode(bool enableXna)Graphics operations only valid while shared rendering is enabled

Page 9: Free Phone! Graphics, pick one technology Browser, Maps Control

XNA Shared Graphics

XNA SharedGraphicsDeviceManagerManages Direct3D device sharing with Silverlight

GPU resource managementSilverlight evicts resources when using XNA GraphicsXNA APIs allow manual resource managementMaximize free memory, minimize repeat loading of content

Page 10: Free Phone! Graphics, pick one technology Browser, Maps Control

demo

XNA Shared Rendering

Rob CameronArchitect EvangelistDPE

Page 11: Free Phone! Graphics, pick one technology Browser, Maps Control

What About “Game”?

Microsoft.Xna.Framework.GameXNA cross-platform application abstractionGame “Heartbeat” methodsApplication lifetime eventsContentManager

System.Windows.Application does many of these already

New GameTimer type for Update/Draw events

Page 12: Free Phone! Graphics, pick one technology Browser, Maps Control

Microsoft.Xna.Framework.GameTimer

// A snapshot of the game timing state. // The values provided are solely based// on game time and not real time.public sealed class GameTimerEventArgs : EventArgs { //… public TimeSpan ElapsedTime { get; internal set; public bool IsRunningSlowly { get; internal set; public TimeSpan TotalTime { get; internal set; } }

public sealed class GameTimer : IDisposable { public GameTimer();  public event EventHandler<GameTimerEventArgs> Draw; public event EventHandler<EventArgs> FrameAction; public event EventHandler<GameTimerEventArgs> Update;  public int FrameActionOrder { get; set; } public TimeSpan UpdateInterval { get; set; } public int UpdateOrder { get; set; } public int DrawOrder { get; set; }  public static void ResetElapsedTime(); public static void SuppressFrame();  public void Start(); public void Stop(); public void Dispose(); }

Page 13: Free Phone! Graphics, pick one technology Browser, Maps Control

XNA Shared RenderingReplacing “Game” functionality

Rob CameronArchitect EvangelistDPE demo

Page 14: Free Phone! Graphics, pick one technology Browser, Maps Control

But Can I Mix XNA 3D and Silverlight?

GREAT Question!

Page 15: Free Phone! Graphics, pick one technology Browser, Maps Control

UIElementRenderer

Silverlight Page is still active when using XNA Shared Rendering

UIElementRenderer renders a UIElement to a Texture2D

Use the texture how you want!UI, controls, and inputTexture modelsImposters/Billboards

Page 16: Free Phone! Graphics, pick one technology Browser, Maps Control

UIElementRenderer Uses

Single-use render targetDraw international text, place it where you wantBackground image creationEffect/Transition from Silverlight to XNA

Per-frame render targetDraw entire page along with 3D renderingDraw a few controls for a pause menuHUD/Status Bar

Page 17: Free Phone! Graphics, pick one technology Browser, Maps Control

XNA Shared RenderingUsing UIElementRenderer to drawSilverlight controls within an XNA sceneRob CameronArchitect EvangelistDPE demo

Page 18: Free Phone! Graphics, pick one technology Browser, Maps Control

Input with UIElementRenderer

Use Silverlight inputCanvas + Manipulations is handy

Or use XNA TouchPanel for input

Recommendation – don’t use both at the same timeInput focus management problemsIf SL handles a button press, XNA TouchPanel isn’t notified

Page 19: Free Phone! Graphics, pick one technology Browser, Maps Control

Advanced Use Cases

Navigation across pages while using XNA rendering

Multiple UIElementRenderers – reduce overdraw

TextBox and software keyboard

Page 20: Free Phone! Graphics, pick one technology Browser, Maps Control

XNA Shared RenderingPutting it all together: XNA rendering, Silverlight navigation, advanced use casesRob CameronArchitect EvangelistDPE demo

Page 21: Free Phone! Graphics, pick one technology Browser, Maps Control

Advanced Use Cases

MediaElement

Camera capture preview and VideoBrush

Page 22: Free Phone! Graphics, pick one technology Browser, Maps Control

XNA Shared RenderingVideo and Camera:MediaElement and camera previewRob CameronArchitect EvangelistDPE demo

Page 23: Free Phone! Graphics, pick one technology Browser, Maps Control

Takeaways

Leverage the best of both powerful frameworks

Many opportunities for new app types using SL + XNA

If you know XNA – go learn Silverlight!

If you know Silverlight – go learn XNA!

http://create.msdn.com/

Page 24: Free Phone! Graphics, pick one technology Browser, Maps Control

Q&A

Questions?

And please fill out your evaluation form!

Page 25: Free Phone! Graphics, pick one technology Browser, Maps Control

Related Content

WPH371-HOL | Game Development with Microsoft XNA Framework

WPH374-HOL | Tombstoning, Launcher and Chooser, and More, with Microsoft XNA Framework

WPH304 | New Windows Phone Data Access Features

WPH307 | Connecting Windows Phones and Slates to Windows Azure

WPH311 | Lessons Learned about Application Performance on Windows Phone

Windows Phone Booth after this session

Page 27: Free Phone! Graphics, pick one technology Browser, Maps Control

Resources

www.microsoft.com/teched

Sessions On-Demand & Community Microsoft Certification & Training Resources

Resources for IT Professionals Resources for Developers

www.microsoft.com/learning

http://microsoft.com/technet http://microsoft.com/msdn

Learning

http://northamerica.msteched.com

Connect. Share. Discuss.

Page 28: Free Phone! Graphics, pick one technology Browser, Maps Control

Complete an evaluation on CommNet and enter to win!

Page 29: Free Phone! Graphics, pick one technology Browser, Maps Control

MS Tag Placeholder Slide

Page 30: Free Phone! Graphics, pick one technology Browser, Maps Control

© 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to

be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS

PRESENTATION.