Beginning Game Programming 1st Edition Jonathan S. Harbour instant download
Beginning Game Programming 1st Edition Jonathan S. Harbour instant download
https://ebookfinal.com/download/beginning-game-programming-1st-
edition-jonathan-s-harbour/
https://ebookfinal.com/download/beginning-java-se-6-game-
programming-3rd-edition-jonathan-s-harbour/
https://ebookfinal.com/download/microsoft-visual-basic-game-
programming-for-teens-2nd-edition-jonathan-s-jonathan-s-harbour-
harbour/
https://ebookfinal.com/download/more-python-programming-for-the-
absolute-beginner-1st-edition-jonathan-s-harbour/
https://ebookfinal.com/download/microsoft-visual-basic-net-
programming-for-the-absolute-beginner-1st-edition-jonathan-s-harbour/
Beginning OpenGL Game Programming 1st Edition Dave Astle
https://ebookfinal.com/download/beginning-opengl-game-programming-1st-
edition-dave-astle/
https://ebookfinal.com/download/beginning-opengl-game-programming-1st-
edition-dave-astle-2/
https://ebookfinal.com/download/beginning-directx-11-game-
programming-1st-edition-allen-sherrod/
https://ebookfinal.com/download/beginning-c-through-game-
programming-4th-edition-michael-dawson/
https://ebookfinal.com/download/opengl-game-programming-prima-tech-s-
game-development-1st-edition-kevin-hawkins/
Beginning Game Programming 1st Edition Jonathan S.
Harbour Digital Instant Download
Author(s): Jonathan S. Harbour
ISBN(s): 9781592005864, 1592005861
Edition: 1
File Details: PDF, 8.76 MB
Year: 2004
Language: english
TEAM LinG - Live, Informative, Non-cost and Genuine!
Beginning
Game Programming
Jonathan S. Harbour
I am grateful to my wife, Jennifer, for allowing me to write while also working full time.
Thank you for being so supportive. I love you. I am also blessed to have two wonder-
ful kids, Jeremiah and Kayleigh, who help me take a break and play now and then. I
thank God for all of these blessings in life.
I am indebted to the hardworking editors, artists, and layout specialists at Course PTR and
to all of the freelancers for doing such a fine job. Many thanks to Estelle Manticas, Jenny
Davidson, Brandon Penticuff, Mitzi Koontz, and Emi Smith. Thanks go to Joshua Smith
and Sebastien St-Laurent for their technical review, which was very helpful. I believe you
will find this a true gem of a game programming book due to all of their efforts.
I want to send greetings to friends, co-workers, and relatives from whom I occasionally
derive inspiration (or is it consternation?). After all, I’m not working in a hole somewhere
(although sometimes it feels that way!). Thanks to the following for your friendship: Peter
Blue, Nathan Warthan, John Striker, Gerald “Dr. Ghastly” Winkler, Chris “Vermis” Henson,
Trammel “Banshee” Stevens, Matt Klein, Jennifer Whitwell, Matt Hamby, Wade and Lind-
sey Eutsey, Justin and Kim Galloway, Brandon and Emily Figg, Jason and Kelly Trisco. And
to the Friday night gang: could you please stahhhhp messing up the house? Just kidding!
This has been a very challenging year for many of my friends and co-workers due to the
tragic loss of two of our best. I want to remember a fellow gamer and friend who passed
away this year, Brian “Zonious” Parker, who worked as a WAN engineer. I also honor the
memory of Jason Ward, a fellow programmer and sports-car enthusiast. Rest in peace.
iv
TEAM LinG - Live, Informative, Non-cost and Genuine!
About the Author
Jonathan S. Harbour has been an avid gamer and programmer for 17 years, having
started with early systems like the Commodore PET, Apple II, and Tandy 1000. He holds
a bachelor of science degree in Computer Information Systems and has earned a position
as senior programmer with seven years of professional experience. He enjoys writing code
mainly in C, C++, and VB, and has experience with a wide variety of platforms, including
Windows, Linux, Pocket PC, and Game Boy Advance.
Jonathan has written six books on the subject of game programming. In addition to his
recent Game Programming All In One, 2nd Edition, he has also written Pocket PC Game
Programming, Microsoft Visual Basic Game Programming with DirectX, Microsoft Visual
Basic .NET Programming for the Absolute Beginner, Beginner’s Guide to DarkBASIC Game
Programming, and Programming the Game Boy Advance. He is currently working on his
next two books, Visual Basic Game Programming for Teens and The Black Art of Xbox Mods.
He maintains a Web site dedicated to game programming at www.jharbour.com.
v
TEAM LinG - Live, Informative, Non-cost and Genuine!
Contents
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
T his book will teach you everything you need to know to write games in C using
DirectX 9. Game programming is a challenge—it is difficult to learn and almost
impossible to fully master. This book takes away the mystery of game program-
ming using the tools of the trade: C and DirectX. You will learn how to harness the power
of Windows and DirectX to write both 2D and 3D games. And even though this is a begin-
ner’s book, I’ve placed an especially strong emphasis on some of the more advanced top-
ics in 3D programming.
In this book, you will learn how to write a simple Windows program. From there, you’ll
learn about the key DirectX components—Direct3D, DirectSound, and DirectInput—
and you’ll find out how to make use of these components while writing simple code at a
pace that will not leave you behind. Along the way, you will put the information you glean
from each chapter into a framework, or game library. After you have learned all you need
to know to write a simple game, you will do just that—write a game—and not just the
usual sprite-based game, either. You’ll write a complete, fully functional 3D game using
3D collision detection, with real 3D Studio models (converted to the .X format). You will
also learn how to create your own models using the popular and free Anim8or modeling
program (which is included on the CD-ROM).
xiii
This book is dedicated to teaching the basics of game programming, and it will cover a lot
of subjects very quickly—you’ll need to be on your toes! I use a writing style that will
make the subjects easy to understand and I repeat key concepts and methods to nail the
points home. You will learn by practice, and will not struggle with any one subject because
you’ll use each tool and technique several times throughout the book.
Each chapter in this book can stand alone, so if you are particularly interested in a certain
subject, feel free to skip to the chapter that covers it. In order to build the game frame-
work, however, you really should read the chapters in order, as each chapter builds on the
information in the one before it. For example, in Chapter 7, you will learn about sprite
animation, and then in Chapter 8 you will learn about transparency.
In this book, I’ll spend a lot of time talking about 3D programming—in order to get to
the 3D material, a lot of information must be covered. I’ll cover the necessary advanced
topics in 3D programming fairly quickly. In order to load a 3D model, for instance, you
need to learn how to create a 3D model first, right? Well, you will learn just how to do that
in this book.
Anim8or is a powerful 3D modeling program; it is included on the CD-ROM that accom-
panies this book. You will learn how to use Anim8or in Chapter 12 to create a complete
model of a Hummer.
After you have learned the ropes of 3D modeling, you will need to learn how to convert
your 3D models to a format that Direct3D will understand. Chapter 13 explains how to
convert the models exported from Anim8or to the Direct3D format.
If you don’t have much experience with C, then I recommend that you read a C primer
before delving into this book, or keep one handy for those parts that confuse you. For a
good start in C, pick up C Programming for the Absolute Beginner, by Michael Vine
(Course PTR).
Figure I.1 You will see how the models for Bash were created.
Windows
Programming
Chapter 1
Getting Started with Windows and DirectX . . . . . . . . . . . . . . . . . . . . . . .3
Chapter 2
Windows Programming Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .23
Chapter 3
Windows Messaging and Event Handling . . . . . . . . . . . . . . . . . . . . . . . .35
Chapter 4
The Real-Time Game Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .53
This chapter provides the crucial information necessary to get started writing Windows
games; it leads into the next three chapters, which provide an overview of the mechanics
of a Windows program.
Here is what you will learn in this chapter:
■ How to put game programming into perspective.
■ How to choose the best compiler for your needs.
■ How to determine your skill level and realize what you need to learn.
■ How to get started learning about Windows programming.
Language: English
BY
P. KROPOTKIN
G. P. PUTNAM’S SONS
NEW YORK AND LONDON
1913
P R E FA C E .
Fourteen years have passed since the first edition of this book was
published, and in revising it for this new edition I found at my
disposal an immense mass of new materials, statistical and
descriptive, and a great number of new works dealing with the
different subjects that are treated in this book. I have thus had an
excellent opportunity to verify how far the previsions that I had
formulated when I first wrote this book have been confirmed by the
subsequent economical evolution of the different nations.
This verification permits me to affirm that the economical
tendencies that I had ventured to foreshadow then have only
become more and more definite since. Everywhere we see the same
decentralisation of industries going on, new nations continually
entering the ranks of those which manufacture for the world market.
Each of these new-comers endeavours to develop, and succeeds in
developing, on its own territory the principal industries, and thus
frees itself from being exploited by other nations, more advanced in
their technical evolution. All nations have made a remarkable
progress in this direction, as will be seen from the new data that are
given in this book.
On the other hand, one sees, with all the great industrial nations,
the growing tendency and need of developing at home a more
intensive agricultural productivity, either by improving the now
existing methods of extensive agriculture, by means of small
holdings, “inner colonisation,” agricultural education, and co-
operative work, or by introducing different new branches of intensive
agriculture. This country is especially offering us at this moment a
most instructive example of a movement in the said direction. And
this movement will certainly result, not only in a much-needed
increase of the productive forces of the nation, which will contribute
to free it from the international speculators in food produce, but also
in awakening in the nation a fuller appreciation of the immense
value of its soil, and the desire of repairing the error that has been
committed in leaving it in the hands of great land-owners and of
those who find it now more advantageous to rent the land to be
turned into shooting preserves. The different steps that are being
taken now for raising English agriculture and for obtaining from the
land a much greater amount of produce are briefly indicated in
Chapter V.
It is especially in revising the chapters dealing with the small
industries that I had to incorporate the results of a great number of
new researches. In so doing I was enabled to show that the growth
of an infinite variety of small enterprises by the side of the very
great centralised concerns is not showing any signs of abatement.
On the contrary, the distribution of electrical motive power has given
them a new impulse. In those places where water power was utilised
for distributing electric power in the villages, and in those cities
where the machinery used for producing electric light during the
night hours was utilised for supplying motive power during the day,
the small industries are taking a new development.
In this domain I am enabled to add to the present edition the
interesting results of a work about the small industries in the United
Kingdom that I made in 1900. Such a work was only possible when
the British Factory Inspectors had published (in 1898, in virtue of the
Factories Act of 1895) their first reports, from which I could
determine the hitherto unknown numerical relations between the
great and the small industries in the United Kingdom.
Until then no figures whatever as regards the distribution of
operatives in the large and small factories and workshops of Great
Britain were available; so that when economists spoke of the
“unavoidable” death of the small industries they merely expressed
hypotheses based upon a limited number of observations, which
were chiefly made upon part of the textile industry and metallurgy.
Only after Mr. Whitelegge had published the first figures from which
reliable conclusions could be drawn was it possible to see how little
such wide-reaching conclusions were confirmed by realities. In this
country, as everywhere, the small industries continue to exist, and
new ones continue to appear as a necessary growth, in many
important branches of national production, by the side of the very
great factories and huge centralised works. So I add to the chapter
on small industries a summary of the work that I had published in
the Nineteenth Century upon this subject.
As regards France, the most interesting observations made by M.
Ardouin Dumazet during his many years’ travels all over the country
give me the possibility of showing the remarkable development of
rural industries, and the advantages which were taken from them for
recent developments in agriculture and horticulture. Besides, the
publication of the statistical results of the French industrial census of
1896 permits me to give now, for France, most remarkable
numerical data, showing the real relative importance of the great
and the small industries.
And finally, the recent publication of the results of the third
industrial census made in Germany in 1907 gives me the data for
showing how the German small industries have been keeping their
ground for the last twenty-five years—a subject which I could touch
only in a general way in the first editions. The results of this census,
compared with the two preceding ones, as also some of the
conclusions arrived at by competent German writers, are indicated in
the Appendix. So also the results recently arrived at in Switzerland
concerning its home industries.
As to the need, generally felt at this moment, of an education
which would combine a wide scientific instruction with a sound
knowledge of manual work—a question which I treat in the last
chapter—it can be said that this cause has already been won in this
country during the last twenty years. The principle is generally
recognised by this time, although most nations, impoverished as
they are by their armaments, are much too slow in applying the
principle in life.
P. Kropotkin.
Brighton, October, 1912.
P R E FA C E TO F I R S T E D I T I O N .
Under the name of profits, rent, interest upon capital, surplus value,
and the like, economists have eagerly discussed the benefits which
the owners of land or capital, or some privileged nations, can derive,
either from the underpaid work of the wage-labourer, or from the
inferior position of one class of the community towards another
class, or from the inferior economical development of one nation
towards another nation. These profits being shared in a very
unequal proportion between the different individuals, classes and
nations engaged in production, considerable pains were taken to
study the present apportionment of the benefits, and its economical
and moral consequences, as well as the changes in the present
economical organisation of society which might bring about a more
equitable distribution of a rapidly accumulating wealth. It is upon
questions relating to the right to that increment of wealth that the
hottest battles are now fought between economists of different
schools.
In the meantime the great question—“What have we to produce,
and how?” necessarily remained in the background. Political
economy, as it gradually emerges from its semi-scientific stage,
tends more and more to become a science devoted to the study of
the needs of men and of the means of satisfying them with the least
possible waste of energy,—that is, a sort of physiology of society.
But few economists, as yet, have recognised that this is the proper
domain of economics, and have attempted to treat their science
from this point of view. The main subject of social economy—that is,
the economy of energy required for the satisfaction of human needs
—is consequently the last subject which one expects to find treated
in a concrete form in economical treatises.
The following pages are a contribution to a portion of this vast
subject. They contain a discussion of the advantages which civilised
societies could derive from a combination of industrial pursuits with
intensive agriculture, and of brain work with manual work.
The importance of such a combination has not escaped the
attention of a number of students of social science. It was eagerly
discussed some fifty years ago under the names of “harmonised
labour,” “integral education,” and so on. It was pointed out at that
time that the greatest sum total of well-being can be obtained when
a variety of agricultural, industrial and intellectual pursuits are
combined in each community; and that man shows his best when he
is in a position to apply his usually-varied capacities to several
pursuits in the farm, the workshop, the factory, the study or the
studio, instead of being riveted for life to one of these pursuits only.
At a much more recent date, in the ’seventies, Herbert Spencer’s
theory of evolution gave origin in Russia to a remarkable work, The
Theory of Progress, by M. M. Mikhailovsky. The part which belongs
in progressive evolution to differentiation, and the part which
belongs in it to an integration of aptitudes and activities, were
discussed by the Russian author with depth of thought, and
Spencer’s differentiation-formula was accordingly completed.
And, finally, out of a number of smaller monographs, I must
mention a suggestive little book by J. R. Dodge, the United States
statistician (Farm and Factory: Aids derived by Agriculture from
Industries, New York, 1886). The same question was discussed in it
from a practical American point of view.
Half a century ago a harmonious union between agricultural and
industrial pursuits, as also between brain work and manual work,
could only be a remote desideratum. The conditions under which the
factory system asserted itself, as well as the obsolete forms of
agriculture which prevailed at that time, prevented such a union
from being feasible. Synthetic production was impossible. However,
the wonderful simplification of the technical processes in both
industry and agriculture, partly due to an ever-increasing division of
labour—in analogy with what we see in biology—has rendered the
synthesis possible; and a distinct tendency towards a synthesis of
human activities becomes now apparent in modern economical
evolution. This tendency is analysed in the subsequent chapters—a
special weight being laid upon the present possibilities of agriculture,
which are illustrated by a number of examples borrowed from
different countries, and upon the small industries to which a new
impetus is being given by the new methods of transmission of
motive power.
The substance of these essays was published in 1888-1890 in the
Nineteenth Century, and of one of them in the Forum. However, the
tendencies indicated therein have been confirmed during the last ten
years by such a mass of evidence that a very considerable amount
of new matter had to be introduced, while the chapters on
agriculture and the small trades had to be written anew.
I take advantage of this opportunity to address my best thanks to
the editors of the Nineteenth Century and the Forum for their kind
permission of reproducing these essays in a new form, as also to
those friends and correspondents who have aided me in collecting
information about agriculture and the petty trades.
P. Kropotkin.
Bromley, Kent, 1898.
CONTENTS.
PAGE
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookfinal.com