🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Questions about Windows Game Programming

Started by
5 comments, last by Sage13 22 years, 10 months ago
First of all, I know the C language and I''m just starting to learn C++, I''m also studying Windows game programng at the same time, so that''s where all my questions are coming from. What is a Handle? What is and Instance? Why is VC++ so stupid? ( you don''t have to answer that ) Actually, when I try to compile programs that work fine on other compilers, for whatever reason it dosen''t like them, but this could just be something I''m missing. Should I really be studying windows programming if I plan on developing for Consols and Arcade machines in the long run, but want to practice on game coding now? finally, what are these things #include stdafx.h #include resource.h thanx -Sage13
Advertisement
I also would like to know the answet to your first 3 questions. But as for windows game programming, if your books not helping you, go to

www.winprog.org and take the tutorials. they are quite specifically for Game Programming for Windows Basics. They dont teach you game programming byt they teach you the basi setups
Thanx
Visual C++ glossary gives these horrible definitions:

handle-
A variable that identifies an object;
an indirect reference to an operating system resource.

instance-
An instantiation of a particular object type in a class,
such as a specific process or thread. All instances of a given type have identical performance counters.

Yea right, that really clears thing up.
I don''t know if the following is any better,
but at least there is an analogy.

( From the glossary of Practical Visual C++ 6 Glossary, Que )

handle-
A type of variable that holds a unique reference
( usually a number ) that identifies a specific type of
object. For example, pigeons are sometimes tagged by a
numbered band attached to their legs. This number is the
computer equivilant of a handle and the pigeon is the
object to which the handle refers.

instantiate-
Create an instance of a specific class as a real object
in the computers memory.

( From Black Art of Windows Game Programming, Eric R. Lyons )

A handle is an indirect reference to some sort of memory object
within Windows.
It gave as an example:
HWND, that uniquely identifies any given window on the screen.

So as far as I understand it, if there where two copies of
the same program running at the same time. There would be
two instances of that program.

Still confusing, but I hope it clears things up a little.

Oh yea, Why is VC++ so stupid ?
Seems that way don''t it. I guess it''s just got
some evolving to do so it''s easier to use.
Adulthood is the vehicle for making you childhood dreams come true.
"stdafx.h" is an include file used by MSVC to allow creation of precompiled headers. I don''t know exactly what the point of those are but I do know you have to include them in every file used in a program. Well, that is if MSVC automatically makes it for you. If you turn off precompiled headers or you make an empty project and fill the files in yourself, you don''t even need to worry about that file.

"resource.h" is a header file used to create symbols with which you can refer to any resources you''ve inserted into your project. Resources are essentially files you want attached to your EXE instead of having them separate. They are most commonly used to hold dialog resources. These can be created by hand but since you have MSVC, you can also create them using the built-in GUI designer. Essentially, you add a dialog to the resource and you are then allowed to add controls to the dialog and design it as you would like it to look in your application. Then, "resource.h" is automatically updated to include values for everything you add and you can use them from your code to do things like show custom dialog boxes. Other things can be stored in a resource file too, such as sounds, bitmaps and icons.


-Goku
SANE Productions Homepage
Ok, here are my 2 cents, this is from my personal thoughts, not books

What is a Handle?

its a reference to a resource, a tag if you want, something that helps you deal with bigger objects easilly, imagine carring a suitcase without a handle, hard huh?
Handles hide the actual type of the objects, so a handle can be an integer, a structure, or anything you can think of, some are documented on the windows api help.

What is and Instance?

well, let me use an analogy here,
you know what a cat is right? there are many cats, CAT is a class, or type of object.
say I have a Cat, his name is Wiskers, Wiskers is an Instance of the Object Class "CAT"
so a class is an abstract generalisation of an object such as car,cat dog house,
an instance is an object in particular, such as your car, my cat, fido the dog, the house in the corner, etc.

Why is VC++ so stupid? ( you don''t have to answer that )

its a MS product isnt it?, lucky for us, C/C++ is not (unlike Basic), On my personal projects I preffer using MingW32, (GCC) backed up with the Xemacs IDE, good old school programming, helps a lot when you then want to start coding GTK+ on Linux.

Why is VC++ so stupid? ( you don''t have to answer that )

Remember, VC++ is Microsoft''s _implementation_ of the C++ language and therefore has a lot of proprietary stuff crammed into their compiler and IDE. Actually, I kind of like Visual Studio and think it''s one of the better IDE''s and C++ compiler''s out there...

*duck*

Ok, just my opinion. But the trick to using VC++ is to learn all the little "quirks" it''s got. Once you figure the tool out, you just might like it!

This topic is closed to new replies.

Advertisement