free phone! graphics, pick one technology browser, maps control
TRANSCRIPT
Building Windows Phone Applications with Microsoft Silverlight and XNA
Rob CameronArchitect EvangelistMicrosoft
WPH-306
Stay to the End to Win!
Free Phone!
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
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
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
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?
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
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
demo
XNA Shared Rendering
Rob CameronArchitect EvangelistDPE
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
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(); }
XNA Shared RenderingReplacing “Game” functionality
Rob CameronArchitect EvangelistDPE demo
But Can I Mix XNA 3D and Silverlight?
GREAT Question!
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
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
XNA Shared RenderingUsing UIElementRenderer to drawSilverlight controls within an XNA sceneRob CameronArchitect EvangelistDPE demo
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
Advanced Use Cases
Navigation across pages while using XNA rendering
Multiple UIElementRenderers – reduce overdraw
TextBox and software keyboard
XNA Shared RenderingPutting it all together: XNA rendering, Silverlight navigation, advanced use casesRob CameronArchitect EvangelistDPE demo
Advanced Use Cases
MediaElement
Camera capture preview and VideoBrush
XNA Shared RenderingVideo and Camera:MediaElement and camera previewRob CameronArchitect EvangelistDPE demo
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/
Q&A
Questions?
And please fill out your evaluation form!
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
Track Resources
AppHub – http://create.msdn.com
Design Resources for WP7
Windows Phone 7 Development Documentation
Windows Phone 7 Training Kit
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.
Complete an evaluation on CommNet and enter to win!
MS Tag Placeholder Slide
© 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.