Building Windows Phone Applications with Microsoft Silverlight and XNA - PowerPoint PPT Presentation

slide1 n.
Skip this Video
Loading SlideShow in 5 Seconds..
Building Windows Phone Applications with Microsoft Silverlight and XNA PowerPoint Presentation
Download Presentation
Building Windows Phone Applications with Microsoft Silverlight and XNA

play fullscreen
1 / 30
Building Windows Phone Applications with Microsoft Silverlight and XNA
Download Presentation
Download Presentation

Building Windows Phone Applications with Microsoft Silverlight and XNA

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. WPH-306 Building Windows Phone Applications with Microsoft Silverlight and XNA Rob Cameron Architect Evangelist Microsoft

  2. Stay to the End to Win! Free Phone!

  3. Silverlight and XNA on Windows Phone 7 RTMXNA Game Studio or Silverlight: which product is right for me? Graphics, pick one technology • Silverlight • Declarative XAML • Retained mode • Controls, user friendly • XNA • GPU Accelerated • Immediate mode, very low level Browser, Maps Control

  4. Silverlight and XNA on Windows Phone 7 RTMXNA Game Studio or Silverlight: which product is right for me? Everything but graphics, mix and match • XNA framework • Audio and microphone • Media playback • Input • GamerServices, etc… • Silverlight • HttpWebRequest

  5. 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 sets • Dynamic glyphs – cloud, user input

  6. Writing a Rich Connected App for Windows Phone 7? Silverlight is the way to go But what about… • Drawing 3D Content • Complex scenes, high entity counts • Texturing and effects? • Using the hardware scaler?

  7. XNA Shared Graphics XNA 3D graphics within your Silverlight app! Silverlight app model • Application class • PhoneApplicationPage and Navigation XNA Rendering takes over entire display • SetSharingMode(boolenableXna) • Graphics operations only valid while shared rendering is enabled

  8. XNA Shared Graphics XNA SharedGraphicsDeviceManager • Manages Direct3D device sharing with Silverlight GPU resource management • Silverlight evicts resources when using XNA Graphics • XNA APIs allow manual resource management • Maximize free memory, minimize repeat loading of content

  9. XNA Shared Rendering Rob Cameron Architect Evangelist DPE demo

  10. What About “Game”? Microsoft.Xna.Framework.Game • XNA cross-platform application abstraction • Game “Heartbeat” methods • Application lifetime events • ContentManager System.Windows.Application does many of these already New GameTimer type for Update/Draw events

  11. Microsoft.Xna.Framework.GameTimer • public sealed class GameTimer : IDisposable • { • publicGameTimer(); • public event EventHandler<GameTimerEventArgs> Draw; • public event EventHandler<EventArgs> FrameAction; • public event EventHandler<GameTimerEventArgs> Update; • public intFrameActionOrder { get; set; } • publicTimeSpanUpdateInterval { get; set; } • public intUpdateOrder { get; set; } • public intDrawOrder { get; set; } • public static void ResetElapsedTime(); • public static void SuppressFrame(); • public void Start(); • public void Stop(); • public void Dispose(); • } // 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 { //… publicTimeSpanElapsedTime { get; internal set; public boolIsRunningSlowly { get; internal set; publicTimeSpanTotalTime { get; internal set; } }

  12. XNA Shared RenderingReplacing “Game” functionality Rob Cameron Architect Evangelist DPE demo

  13. But Can I Mix XNA 3D and Silverlight? GREAT Question!

  14. 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 input • Texture models • Imposters/Billboards

  15. UIElementRenderer Uses Single-use render target • Draw international text, place it where you want • Background image creation • Effect/Transition from Silverlight to XNA Per-frame render target • Draw entire page along with 3D rendering • Draw a few controls for a pause menu • HUD/Status Bar

  16. XNA Shared RenderingUsing UIElementRenderer to drawSilverlight controls within an XNA scene Rob Cameron Architect Evangelist DPE demo

  17. Input with UIElementRenderer Use Silverlight input • Canvas + Manipulations is handy Or use XNA TouchPanel for input Recommendation – don’t use both at the same time • Input focus management problems • If SL handles a button press, XNA TouchPanel isn’t notified

  18. Advanced Use Cases Navigation across pages while using XNA rendering Multiple UIElementRenderers – reduce overdraw TextBox and software keyboard

  19. XNA Shared RenderingPutting it all together: XNA rendering, Silverlight navigation, advanced use cases Rob Cameron Architect Evangelist DPE demo

  20. Advanced Use Cases MediaElement Camera capture preview and VideoBrush

  21. XNA Shared RenderingVideo and Camera:MediaElement and camera preview Rob Cameron Architect Evangelist DPE demo

  22. 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!

  23. Questions? And pleasefill out your evaluation form! Q&A

  24. Required Slide Speakers, please list the Breakout Sessions, Interactive Discussions, Labs, Demo Stations and Certification Exam that relate to your session. Also indicate when they can find you staffing in the TLC. 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

  25. Required Slide Track PMs will supply the content for this slide, which will be inserted during the final scrub. Track Resources • AppHub – • Resource 2 • Design Resources for WP7 • Resource 3 • Windows Phone 7 Development Documentation • Resource 4 • Windows Phone 7 Training Kit

  26. Resources • Connect. Share. Discuss. Learning • Sessions On-Demand & Community • Microsoft Certification & Training Resources • Resources for IT Professionals • Resources for Developers • •

  27. Required Slide Complete an evaluation on CommNet and enter to win!

  28. Required Slide Your MS Tag will be inserted here during the final scrub. MS Tag Placeholder Slide

  29. © 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.