4

If I'm looking to create a game that doesn't necessarily run full screen, but simply needs to feature 2D/3D graphics somewhere in a portion of the screen, what's my best approach?

Quick Wireframe

Some specific questions could be:

  • What component would the rendered area use?
  • Are there any game libraries I could leverage for the rendered area?
  • What would be the most "pure" or "canonical" stack according to Microsoft to use here?
Alexander Trauzzi
  • 7,277
  • 13
  • 68
  • 112
  • Windows Dev Center / MSDN Forum question: http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/14a624f6-e19a-43ec-b096-180e88d392f9 – Alexander Trauzzi Sep 05 '12 at 12:58
  • are you looking to create a Win8 store app (previousy known as Metro), or just an application running on Win8? (for the second, WPF is indeed good and easier, but it can't do the first) – TDaver Oct 04 '12 at 18:53

2 Answers2

1

Omega -- Visual Studio 2010 and 2012 are Both WPF apps. WinRT is for Tablets / Mobile. WPF is certainly NOT outdated.

If I were you I wouldn't render everything out the way canvas forces you to, it might be a better approach to have the center item be a UI element named Frame, which is the base element for all UI related content in WPF.

In this way you would be able to leverage all of the possible types of controls in the Frame whether you decided that An ImageSourceType or Canvas is more applicable to a particular features of the game.

Zack Weiner
  • 664
  • 4
  • 14
0

Depending on how you want to draw graphics, you could use (but are by no means limited to):

  • Canvas - which would be totally appropriate for slow moving games. This way you get the benefit of the various WPF layout routines and can define objects inside the scene in XAML/vectors as well.
  • WPF supports 3D graphics (using Direct3D on the backend) so you could probably set up an orthogonal projection matrix and treat it like a Direct3D context (with the WPF API). I don't have enough experience to know how slow this is compared to D3D, but it's certainly easier (built-in "scene graph" like support from the XAML architecture, for instance).
  • If you want to go whole-hog with Direct3D you could use SlimDX, which has a WPF shim that I've used in the past, as well as another third party control. There may be other libraries available as well.
  • Direct blitting to/from a Bitmap using WriteableBitmap (see WriteableBitmapEx for a third-party version with a much friendlier API) or similar.

There are probably a lot of other options too. My preference would be for using Canvas initially if it's a slow-paced game that doesn't need super-fast frame rates (the layout work does incur a fairly substantial overhead, but it's less work and may be easier to get looking exactly the way you want).

If you want absolute control and speed, use D3D through SlimDX, but this is a pretty hefty learning curve if you're new to it.

Community
  • 1
  • 1
ravuya
  • 8,586
  • 4
  • 30
  • 33
  • In a Windows 8 context, wouldn't WPF be considered somewhat obsolete? What would be the most "pure" or "canonical" stack to use here according to Microsoft? – Alexander Trauzzi Sep 04 '12 at 22:40