Windows Game Programming with Visual Basic and DirectX.pdf
(
7675 KB
)
Pobierz
Contents at a Glance
Introduction 1
I Diving into the Game
11
1
2
3
4
5
6
Developing an Idea into a Game 13
Introducing DirectX 23
Creating 3D Graphics 49
Turning 2D Graphics into 3D Graphics 71
Loading Mall Information 89
Displaying 3D Graphics 111
Windows
Game
Programming
with Visual
Basic and
DirectX
®
Wayne S. Freeze
II Simulating Reality
133
7
8
9
10
11
Random Numbers Ain’t Random 135
Simulating Reality 153
Simulating the Mall 173
Simulating Customers 193
Simulating Stores and Money 211
III Making the Game Fun
227
12
13
14
15
16
Controlling the Mall with DirectInput 229
Commanding the Game 247
Attention, Shoppers 271
A Map and Customers 293
Walking Through the Mall 309
IV Finishing the Game
325
17
The Mall Strait Journal 327
18
Running the Mall 345
19
The End of the Beginning 365
Index 383
201 W. 103rd Street
Indianapolis, Indiana 46290
Windows
®
Game Programming with Visual
Basic and DirectX
Copyright © 2002 by Que
All rights reserved. No part of this book shall be repro-
duced, stored in a retrieval system, or transmitted by any
means, electronic, mechanical, photocopying, recording,
or otherwise, without written permission from the pub-
lisher. No patent liability is assumed with respect to the
use of the information contained herein. Although every
precaution has been taken in the preparation of this book,
the publisher and author assume no responsibility for
errors or omissions. Nor is any liability assumed for dam-
ages resulting from the use of the information contained
herein.
International Standard Book Number: 0-7897-2592-4
Library of Congress Catalog Card Number: 2001096458
Printed in the United States of America
First Printing: December 2001
05
04
03
02
4
3
2
1
Publisher
David Culverwell
Executive Editor
Candace Hall
Acquisitions Editor
Michelle Newcomb
Development Editor
Howard Jones
Managing Editor
Thomas F. Hayes
Senior Editor
Susan Ross Moore
Copy Editor
Kate O. Givens
Indexer
Angie Bess
Proofreaders
Marcia Deboy
Maribeth Echard
Technical Editor
Micheal McDonald
Team Coordinator
Cindy Teeters
Media Developer
Michael Hunter
Interior Designer
Ruth Harvey
Cover Designers
Dan Armstrong
Ruth Harvey
Page Layout
Susan Geiselman
Brad Lenser
Michelle Mitchell
Trademarks
All terms mentioned in this book that are known to be
trademarks or service marks have been appropriately capi-
talized. Que cannot attest to the accuracy of this informa-
tion. Use of a term in this book should not be regarded as
affecting the validity of any trademark or service mark.
Warning and Disclaimer
Every effort has been made to make this book as complete
and as accurate as possible, but no warranty or fitness is
implied. The information provided is on an “as is” basis.
The author and the publisher shall have neither liability
nor responsibility to any person or entity with respect to
any loss or damages arising from the information con-
tained in this book or from the use of the CD or programs
accompanying it.
Table of Contents
I Diving into the Game
Introduction
Creating a Computer Game 2
Types of Games 3
Visual Basic 3
DirectX 4
Introducing Swim Mall 4
Your Challenge 5
Who Should Read This Book 5
System Requirements 5
What This Book Covers 6
What This Book doesn’t Cover 7
Conventions Used in This Book 7
Questions and Comments 8
Other Resources 8
2 Introducing DirectX 23
Understanding DirectX 24
Why DirectX? 24
DirectX Services 25
Introducing 3D Graphics 27
The 2D Coordinate System 27
The 3D Coordinate System 27
The World Is Made of Triangles 28
Drawing Lots of Triangles 29
Colors 30
Lights and Viewpoints 30
I’m a Little Teapot 31
Installing DirectX 32
Starting the Program 33
Initializing DirectX Objects 35
Initializing Direct3D 37
Setting Lights 41
Creating a 3D Object 43
Displaying Graphics 43
Rendering the Scene 44
Final Thoughts 47
3 Creating 3D Graphics 49
Introducing Caligari trueSpace 50
Introducing Adobe Photoshop and
Illustrator 51
Constructing 3D Graphics 51
Basic Concepts 51
Using trueSpace 52
trueSpace Tools 53
Creating a Mall 55
Designing a Mall 55
Creating an Empty Mall 56
Final Thoughts 69
1 Developing an Idea into a Game 13
Designing the Game 14
Game Design Document for Swim
Mall 15
Philosophy 15
Story 16
Technical Features 16
Game Objects 17
User Interaction 18
Simulation Engine’s Control 20
Game Variables 21
Cheat Codes 21
Easter Eggs 22
Final Thoughts 22
iv
Windows Game Programming with Visual Basic and DirectX
4 Turning 2D Graphics into 3D
Graphics 71
Creating 2D Graphics 72
Tweaking Images with Photoshop 72
Introducing Photoshop 73
Editing Images 74
Using Layers 76
Extracting Parts of an Image 78
Running Filters and More 79
Creating a Store 81
Creating a Simple Texture with
Photoshop 81
Creating a Complex Texture with
Photoshop 84
Creating an Empty Store with
trueSpace 85
Final Thoughts 88
6 Displaying 3D Graphics 111
Initializing Graphics Information 112
Loading Your Mall 113
Initializing DirectX 113
Loading a 3D Object into Memory 115
Displaying Graphic Information 118
Rendering Your Mall 119
The Main Loop 119
Rendering Direct3D Graphics 119
Displaying Text on the Screen 124
Selecting Objects Using the DXGraphics
Class 127
Detecting a Mouse Click 127
Checking Each 3D Object 127
Checking a Particular Object 128
Running the Program 130
Final Thoughts 131
5 Loading Mall Information 89
Design Details 90
Disk-Based Structures 90
Swim Mall File Format 92
Memory-Based Structures 94
Loading a Saved Game 94
The Game Class 94
Using the Game Class 95
Module Variables in the Game
Class 96
Inside the
LoadGame
Method 97
Extracting Data from the Saved Game
File 98
Reading Data Using the
SwimFile
Class 101
Loading Mall and Store
Information 103
Creating Stores and other Mall
Items 105
Anchor Properties 108
Managing Collections of Anchors 108
Final Thoughts 110
Part II Simulating Reality
7 Random Numbers Ain’t Random 135
Defining a Random Number 136
Random Numbers and Computers 136
Creating Random Numbers 138
Random Numbers and Visual Basic 139
Randomize and Rnd 139
Generating Random Numbers with
Rnd 140
Rolling Dice 141
Ranges of Random Numbers 143
Scaling Continuous Random
Numbers 143
Creating Discrete Random
Numbers 145
Plik z chomika:
heroinka94
Inne pliki z tego folderu:
Równania kwadratowe - metoda na rozwiązanie w głowie w 3 sekundy!(1).mp4
(8861 KB)
Równania kwadratowe - metoda na rozwiązanie w głowie w 3 sekundy!.mp4
(8861 KB)
gjhkgkgit.7z
(3050 KB)
Learning_PHP-_MySQL_-_JavaScript_With_jQuery-_CSS_-_HTML5-_4th_Edition.pdf
(11632 KB)
rtysdf.7z
(4608 KB)
Inne foldery tego chomika:
Pliki dostępne do 01.06.2025
Pliki dostępne do 19.01.2025
●NOWOŚCI FILMY RMVB Napisy PL
01. Exploring the Oracle Database 12c Architecture Part 1
02. Exploring the Oracle Database 12c Architecture Part 2
Zgłoś jeśli
naruszono regulamin