Game Development Reference
In-Depth Information
The CDXUTDialogResourceManager is a class that helps you draw all of the UI
gizmos you need buttons, sliders, text boxes, and so on. Later in this chapter, you
will see calls to this class to create and place them on the screen. The CDXUT-
TextHelper class is nearly indispensable to those programmers who want to draw
text on a Direct3D 11 screen.
The reason for this is that Direct3D 11 does not support the very easy-to-use ID3DX-
Font interface you may have seen before. Instead, Microsoft is pushing Direct-
Write , which pushes font rendering or glyph rendering to new levels of complexity.
When writing this topic, I nearly panicked thinking how I was going to condense this
huge subject into this chapter, until I found that the CDXUTTextHelper class essen-
tially hid all that complexity from me. Thank goodness!
The Human's Game View
Recall from Chapter 2,
that the game interface should be
completely separate from the game logic. A game view receives game events, such
as
What
'
s in a Game?,
and does whatever it needs to present
this new game state. In return, the view is responsible for interpreting inputs from
controllers and other hardware into commands that will get sent back to the game
logic, such as
object was created
or
object was moved,
request throw grenade.
It would be up to the game logic to determine
whether this was a valid request.
I
'
m about to show you a base class that creates a game view for a human player. As
you might expect, it ' s pretty heavy on user interface. I think it ' s a good idea to take
somewhat of a top-down approach, showing you major components and how they fit
together.
As you might expect, a class that implements the game view for a human player is
going to be tied very closely to how input devices are read and how the view is actu-
ally presented to the player. This crossroads is a great intersection between the oper-
ating system, which will let you get the state of the input devices, and the graphics
system, which will draw the game world. Oh, and I can ' t forget the audio system
either, which is a renderer in its own right
s ears. I could abstract
all this into platform-independent classes with the right interfaces, etc., but in the
interest of making things a little easier for me to present and for you to understand,
I ' ll leave that improvement as an exercise for you. OK, enough excuses here ' s the
class definition for the HumanView .
one for the player
'
typedef std::list<shared_ptr<IScreenElement> > ScreenElementList;
 
 
Search WWH ::




Custom Search