DirectX 9 User Interfaces: Design and Implementation

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Companion CD included with Paint Shop Pro 8 evaluation edition!Interfaces strongly affect how an application or game is received by a user, no matter which cutting-edge features it may boast. This unique book presents a comprehensive solution for creating good interfaces using the latest version of DirectX. This involves building an interface library from the ground up. Divided into three sections, the book discusses the foundations of interface design, the construction of a feature-rich interface library, and the creation of a fully functional media player in DirectShow.

Author(s): Alan Thorn
Publisher: Wordware Publishing, Inc.
Year: 2004

Language: English
Pages: 347

DirectX 9 User Interfaces: Design and Implementation
Cover
Dedication
Contents
Acknowledgements
Introduction
Chapter 1 User Interfaces
1.1 User Interfaces-What Are They?
1.2 Controls-Gadgets and Gizmos
1.2.1 Text Boxes
1.2.2 Text Edits
1.2.3 Buttons
1.2.4 Labels
1.2.5 List Boxes
1.2.6 Drop-Down Lists
1.2.7 Check Boxes
1.2.8 Menus
1.2.9 Page Controls/Tab Controls
1.2.10 Windows and Other Containers
1.3 Interface Flow Diagrams-Interfaces on Paper
1.4 Interface Design-Tips and Tricks
1.4.1 Be Consistent
1.4.2 Know Your Audience
1.4.3 Justification and Alignment
1.4.4 Grouping Data
1.4.5 Error Handling
1.4.6 Disabling Program Features
1.4.7 Graphics, Colors, Icons, and Art
1.4.8 Balancing Text and Symbols
1.4.9 Paths and Navigation
1.4.10 Keyboard Support
1.4.11ToolTips
1.5 Conclusion
Chapter 2 Introducing DirectX
2.1 DirectX-What Is It?
2.1.1 Direct3D-Graphics
2.1.2 DirectInput-Keyboards, Mice, and Joysticks
2.1.3 DirectMusic and DirectSound-MIDI and WAV
2.1.4 DirectPlay-Networking
2.1.5 DirectShow-Programmable Media Player
2.2 DirectX-Other Features
2.2.1 Mesh Viewer
2.2.2ErrorLookup
2.2.3 Caps Viewer
2.2.4 GraphEdit
2.2.5 Texture Tool
2.3 System Requirements
2.4 Where to Obtain DirectX
2.5 Installation
2.6 Installed Files
2.7 Configuring Visual C++
2.8 Coding with Hungarian Notation
2.9 Conclusion
Chapter 3 Introducing Direct3D
3.1 Direct3D Concepts-Overview and Mathematics
3.2 Getting Started
3.3 Programming Direct3D Applications
3.4 Initializing Direct3D
3.5 Creating a Direct3D Device-A Graphics Card
3.6 Preparing to Render
3.7 Initializing World Data
3.7.1 Direct3D Surfaces-IDirect3DSurface9
3.7.2 Direct3D Surfaces-Loading Image Files
3.7.3 Direct3D Surfaces-Rendering
3.7.4 Direct3D Textures-IDirect3DTexture9
3.7.5 Direct3D Textures-Preparing to Render
3.7.6 Direct3D Textures-Rendering
3.8 Alpha Blending
3.8.1 Using Adobe Photoshop
3.8.2 Using Paint Shop Pro
3.8.3 Using the DirectX Texture Tool
3.8.4 Enabling Alpha Blending in Direct3D
3.9 Conclusion
Chapter 4 Introducing DirectInput
4.1 DirectInput Basics
4.2 Getting Started
4.3 Programming
4.4 Creating a DirectInput Object
4.5 Creating DirectInput Devices
4.6 The Keyboard
4.6.1 Creating the Keyboard
4.6.2 Configuring the Keyboard
4.6.3 Reading from the Keyboard
4.7 The Mouse
4.7.1 Creating the Mouse
4.7.2 Setting the Cursor
4.7.3 Reading from the Mouse
4.7.4 Processing the Cursor Position
4.7.5 Reading Mouse Buttons
4.8 Conclusion
Chapter 5 Wrapping Direct3D
5.1 CXSurface-Wrapping Surfaces
5.1.1 Instantiating and Deleting CXSurface
5.1.2 Loading Images
5.1.3 Copying Surfaces
5.1.4 Representing the Back Buffer
5.1.5 Rendering
5.1.6 Using CXSurface
5.2 CXTexture-Wrapping Textures
5.2.1 Instantiating and Deleting
5.2.2 Loading Images
5.2.3 Preparing to Render
5.3 CXPen-Wrapping ID3DXSprite
5.3.1 Instantiating and Deleting
5.3.2 Rendering Textures
5.3.3 Using CXPen and CXTexture
5.4 Conclusion
Chapter 6 Abstracting DirectInput
6.1 CXInput-The DirectInput Object
6.1.1 Instantiating the DirectInput Object
6.1.2 Creating Input Devices
6.2 CXKeyboard-Wrapping the Keyboard Device
6.2.1 Instantiating Keyboard Devices
6.2.2 Reading from CXKeyboard
6.3 Wrapping the Mouse Device
6.3.1 CXMouseSurface-Wrapping a List of Cursors
6.3.2 Linked Lists-A Definition
6.3.3 Navigating Linked Lists
6.3.4 Adding New Items to Linked Lists
6.3.5 Deleting Linked Lists
6.3.6 CXMouseSurface-Other Properties
6.3.7 Wrapping the Mouse Device with CXMouse
6.3.8 Initializing Mouse Cursors with CXMouse
6.3.9 Changing Mouse Cursors with CXMouse
6.3.10 Reading Mouse Data with CXMouse
6.3.11 Reading Cursor Positions with CXMouse
6.3.12 Reading Button States with CXMouse
6.4 Conclusion
Chapter 7 Beginning CXControl
7.1 UI LIB (User Interface Library)-What Is It?
7.2 UI LIB-Controls as Classes
7.3 Controls-Class Hierarchy and Base Controls
7.4 CXControl-The Beginnings
7.5 Defining CXControl-Controls and a Canvas
7.6 CXControl-Parent, Sibling, and Child Controls
7.6.1 Adding Child Controls
7.6.2 Clearing Child Controls
7.6.3 Removing Specific Children
7.6.4 Counting Child Controls
7.7 Absolute and Relative Positioning
7.7.1 Computing Positions
7.8 CXControl-The Class Declaration Thus Far
7.9 Conclusion
Chapter 8 Continuing CXControl
8.1 Messages
8.1.1 Posting Messages
8.1.2 Message Specifics
8.2 Handling Mouse Messages
8.2.1 Cursor Intersection
8.2.2 Hierarchical Posting
8.2.3 Triggering Mouse Events
8.3 Handling Keyboard Messages
8.3.1 Focus
8.3.2 Triggering Events
8.4 Handling Control Painting
8.5 Posting in Reverse
8.6 Depth Sorting
8.7 Triggering Paint Events
8.8 CXControl-The Final Declaration
8.9 Conclusion
Chapter 9 Developing Windows
9.1 CXWindow-Deriving from CXControl
9.2 Desktop and Application Windows
9.3 Class CXWindow as a Parent
9.4 Implementing the Parent Window
9.5 CXWindow as a Child Window
9.6 Implementing Child Windows
9.6.1 Child Windows-Loading the Canvas
9.6.2 Painting Application Windows
9.6.3 Dragging Application Windows
9.6.4 Minimizing and Restoring Application Windows
9.7 Using CXWindow-Sample Application
9.7.1 Overview
9.7.2 Desktop Initialization
9.7.3 Window Initialization
9.7.4 Windows Message Posting
9.7.5 Deleting an Interface
9.8 Conclusion
Chapter 10 Labels and Buttons
10.1 Labels and Buttons
10.2 CXLabel-Labels
10.3 Labels as ID3DXFont
10.3.1 Instantiating ID3DXFont
10.3.2 Setting the Label Caption
10.3.3 Painting with ID3DXFont
10.3.4 Releasing ID3DXFont
10.4 CXButton-Buttons
10.5 CXButton-The Class Declaration
10.5.1 The Class Constructor
10.5.2 Setting Pressed and Unpressed Images
10.5.3 Setting the Button Caption
10.5.4 Painting
10.5.5 Destructor
10.6 CXLabel and CXButton-A Sample Application
10.7 Conclusion
Chapter 11 Text Boxes and Check Boxes
11.1 Text Boxes and Check Boxes
11.2 Text Boxes
11.3 Clever Strings-Std::String
11.3.1 Initialization and Assigning
11.3.2 String Lengths
11.3.3 Editing and Appending Strings
11.3.4 Copying Substrings
11.3.5 Converting Strings to char*
11.3.6 Erasing and Emptying
11.4 Lines-ID3DXLINE
11.4.1 Drawing Lines
11.5 CXTextBox-The Class Declaration
11.5.1 Constructor
11.5.2 Text Width and Height
11.5.3 Setting Text
11.5.4TextBoxCaret
11.5.5 Inserting Text
11.5.6 Removing Text
11.5.7 Processing Keypresses
11.5.8 Cursor Positioning
11.5.9 Caret at Cursor
11.5.10 Handling the Mouse
11.5.11 Painting
11.5.12 Cleaning Up
11.6 Check Boxes
11.7 CXCheckBox-The Class Declaration
11.7.1 Image and Text Loading
11.7.2 Checking and Unchecking
11.7.3 Painting
11.7.4 Cleaning Up
11.8 Conclusion
Chapter 12 Scrolling Lists
12.1 Scroll Bars, List Boxes and Drop-Down Lists
12.2 CXScrollBar-Scroll Bars as a Class
12.2.1 The Class Constructor
12.2.2 Arrows, a Thumb, and a Background
12.2.3 Width and Height, Min and Max
12.2.4 Screen Positions to Scroll Values
12.2.5 Scaling the Thumb
12.2.6 Setting the Thumb Position
12.2.7 Handling Input
12.2.8 Tiling the Background
12.2.9 Painting
12.2.10 CXScrollBar-Cleaning Up
12.3 List Boxes and List Items
12.4 CXListItem-ListItems as a Class
12.4.1 The Class Constructor
12.4.2 Setting Item Size
12.4.3 Painting
12.5 CXListBox-List Boxes as Classes
12.5.1 The Class Constructor
12.5.2 Loading Item Backgrounds
12.5.3 Loading the Scroll Bar
12.5.4 Computing a List Frame
12.5.5 Adding List Items
12.5.6 Clearing List Items
12.5.7 Getting Items by Index
12.5.8 Getting Items by (X,Y) Position
12.5.9 Scrolling the Frame
12.5.10 Handling Input
12.5.11 Painting
12.5.12 Cleaning Up
12.6 CXDropDownList-Drop-Down Lists as Classes
12.6.1 The Class Constructor
12.6.2 Initializing the Drop-Down List
12.6.3 Showing and Hiding the List
12.6.4 Handling Input
12.6.5 Painting
12.6.6 Cleaning Up
12.7 Conclusion
Chapter 13 Introducing DirectShow
13.1 DirectShow-What Is It?
13.2 Getting Started
13.3 The Filter Graph
13.4 The Media Control
13.5 The Event Mechanism
13.6 Registering for Events
13.7 Loading a File
13.8 Playing a File
13.9 Catching Media Events
13.10 Reading Media Events
13.11 Handling Media Events
13.12 Cleaning Up
13.13 Conclusion
Chapter 14 Wrapping DirectShow
14.1 CXMedia and CXMediaPlayer
14.2 CXMedia- Songs, Movies, and More
14.3 CXMediaPlayer- Player of the Playlist
14.3.1 The Class Constructor
14.3.2 Initializing DirectShow
14.3.3 Adding Media Files
14.3.4 Clearing Media Files
14.3.5 Playing a Playlist
14.3.6 Pausing and Stopping
14.3.7 Handling Messages
14.3.8 Uninitializing DirectShow
14.3.9 Cleaning Up
14.4 Conclusion
Chapter 15 Building the Media Player
15.1 The Media Player
15.2 CXMyMediaPlayerApp-The Media Player
15.2.1 Creating the Media Player
15.2.2 Loading Controls
15.2.3 The Window
15.2.4 The List Box
15.2.5TheTextBox
15.3 Buttons Are Connectivity
15.3.1 CXSearchButton-The Search Button
15.3.2 CXSearchButton-Loading Images
15.3.3 CXSearchButton-Handling Mouse Clicks
15.3.4 CXPlayButton-The Play Button
15.3.5 CXPlayButton-Handling Button Clicks
15.3.6 CXStopButton-The Stop Button
15.3.7 CXCloseButton-The Close Button
15.4 CXMyMediaPlayerApp-Loading Buttons
15.4.1 CXMyMediaPlayerApp-Cleaning Up
15.5 Sample Program-Plugging in the Media Player
15.6 Conclusion
Afterword
Appendix Recommended Reading
Index
Team DDU