Advertisement

04.01 - Some Code to Ponder

Started by April 23, 2001 04:41 PM
41 comments, last by Teej 22 years, 5 months ago
Hi all, OK I''ve been through the code a hundred times and I don''t understand how it takes the bitmap and lets you type a message using the alaphabet from it. Like how do you map all the letters to be associated with the keyboard letters. I guess what I''m asking is how the program knows where each letter ends and starts on the bitmap.I know this is done in the utilities page but cant'' see how. Am I in over my head already? Hope I''m just missing a DirctX function or something.
I''ve found that I can download the files if I hold shift while I click the link (open in a new window) but it doesn''t work if I just rightclick on the links and select open in a new window.
Advertisement
I've been studying the files from BaseCode1 and on a whim decided to look up the header for windows.h to see what it consisted of. After a fruitless search in the VC++ help files, I tried Microsofts' site.. still nothing definitive. Where can I find a copy of the header? (Microsoft mentions that it is around 8k lines, but not where to get it. The VC++ help eludes to a win32 sdk but nothing comes up in a search on Microsofts site pointing towards my goal.) I guess what I really want to know is: When you include the header, how do you know to include it, and for what reasons? From where do you get this knowledge? Any help would be most appreciated.

Edited by - Mitijea on May 3, 2001 1:02:04 AM
The windows.h header file is in the includes directory. When VC++ compiles one of your source files, the first thing that happens is the precompiler opens all of the #include "..." files. Thus, they must be located on your hard disk somewhere. They are usually located in the c:\devstudio\vc\includes directory, so look in there for windows.h

Later,
Buncen

Hi, I''m an Irish signature virus. Please copy me into your signature to help me spread Thanks.

In regards to this file layout for the tuts, where would the code for the AI logic be placed(if any). Just wondering. Keep up the great work.

http://angelfire.com/ny5/codeworx.com

Edited by - shdaga on May 3, 2001 2:10:05 AM
Here's a new dance everyone can do, do the Kirby:<(*.*<) <(^.^)> (>*.*)> <(^.^)> <(*.*<) (>^.^)>
Also, as far as the 32 bit windows API is concerned, you can find very useful help files on the web that has detailed information about everything in Windows.h. I however cannot find a link to it at the current time, but I do have the help file so I know it exists. I also don''t know if it contains all of the information about Windows.h but I have yet to see a function used that it doesn''t have.
Advertisement
Buncen - Thankyou for pointing out where the header is located.. Feeling a little stupid about not figuring it out myself But after purusing it and the header for winuser.h, I''m even more confused. I know that the includes inside angle brackets don''t nescessarily have to have a corresponding cpp file, but can have another type, such as an exe, or a dll, so I''m not sure where to go from here on finding the original code used in conjunction with the headers. But...
RandomGamer - came up with a good suggestion which I will take up (Thanks ). After looking at the header for winuser, I''m thinking the info I''m looking for could fill volumes. Not really sure if I need to dig that deep, but right now I''m really not comfortable with having to rely on someone else saying to use a function when I''ve no idea where they got it from.. And also, I''m just curious about what I''m missing out on.
I have been working with the code and I am beginning to understand the whole modular programming thing now. I''m currently making my own direct x wrapper that will hopefully be made into a library. Thanks teej for the great coding ideas. Especially the ingenious grobals function idea. I look forward to the rest of the tutorial!!!
Rictus,
The resource.bmp file is actually never used. It is just loaded to demonstrate how image files would be laoded in a real game.

The text is painted on the screen using the crude Win32 graphics function TextOut(). As you will see, the font does not even look like the one in the bitmap. It is actually using the default Windows font.
Note: Remember that when you use a Win32 API graphics function like TextOut you must lock your direct draw surfaces and release them when your finished as Teej has done in the example.

Later,
Buncen.
Mitijia,
Don''t think you''ll have much luck finding the ''original code'' that the headers are for. Unless you work at Microsoft or know a good russian hacker. Microsoft do not release the Windows source code to the general public because they think competitors would copy it and they are also terribly embarrased of it.

Later,
Buncen.

This topic is closed to new replies.

Advertisement