Weathr is a 3D weather app for Windows 8.1 using C++, DirectX, and XAML.
Why a weather app?
While working on the Hilo C++
project, I really wanted to further explore the intersection among C++, DirectX, and XAML in the context of a Windows Store app. A 3D weather app seemed novel (I've never seen one before) yet doable (arguably easier to implement than a game.) I'm publishing this sample as a way of sharing what I learned and getting your feedback.
Although you're free to use any of the code and patterns you see here in your own apps, remember this is a personal side project of mine -- there's surely room to improve the architecture and design patterns that are used. Please report any feedback you have on the code in the Issues or Discussions tab. If you find any parts to be particularly useful, or would like to see more discussion on, please let me know that as well!
Click the image below for a quick video tour of the app.
(Some folks have asked me if this app is in the Windows Store. It is not yet!)
What's needed to run it?
- Windows 8.1
- Visual Studio 2013. Get Visual Studio Express 2013 here.
- A Bing Maps API key. Get a trial key here.
- A World Weather Online API key. Get a trial key here.
Add your API keys to ServiceKeys.h
I know it's a bit of a pain, but it's pretty straight-forward to register for the API keys. You can still run the app without the API keys; you simply won't be able to access weather data or search for locations.
What's it demonstrate?
Here are some of the features to look for in this sample. Also see the Documentation
tab for technical info about various parts of this project.
- How to use ISO C++ to implement the core logic and C++/CX along the "boundary" where you work Windows Runtime.
- How to use DirectX to manage 3D content and XAML to manage 2D content.
- Using PPL tasks to load assets asynchronously and to perform background work.
- Rendering shared 3D content across pages.
- Capturing 3D content for later use (such as on the live tile and location management page.)
- Displaying current weather info on the live tile.
- Using the secondary tile to bookmark to a specific experience.
- Rendering cloud and star effects in a way that works on both Intel and ARM-based devices.
- Using the C++ REST SDK to connect to the weather and Bing Maps services.
- Throttling HTTP requests to limit the number of requests made per second.
- Using app bars to browse the 5 day forecast and perform interesting commands.
- Using GestureRecognizer to read input events for manipulating the globe.
- Using Semantic Zoom to enable fast navigation.
- Using MessageDialog to confirm commands.
- Using the Search contract to search for locations from Bing Maps.
- Downloading and caching images for later use.
- Using app settings to set preferences.
- Using a basic logger to display diagnostic messages on the UI.
Who worked on it?
- Development: Thomas Petchel (Microsoft)
- Beta testing: Megan Petchel
- Logo image: Deborah Steinke (Graphic Designer, adaQuest, Inc.)
- Special thanks to Michael Thompson (Microsoft) for helping me with some of the math (before I wised up to using DirectXMath!) and for helping me troubleshoot some of my DirectX code. Also big thanks to Michael B. McLaughlin (Microsoft MVP) and Giovanni Dicanio (Microsoft MVP) for reviewing portions of the code and providing valuable feedback.
- Thanks also to Jennifer Leaf (Microsoft) & Michael Blome (Microsoft) for trying the app out and providing feedback, and to my manager Billie Jo Smith (Microsoft) for supporting this project.