Page 4 of 5
Re:serious this time
Posted: Sun Mar 07, 2004 12:40 pm
by Schol-R-LEA
Unfortunately, I am not in a position to do so; as is all too often the case with library books, the accompanying CD is in unreadable condition from misuse. I'm going to try usign a scratch-eliminator on it later, but so far I haven't been able to read it.
However, I did find
a copy of the files on InformIT's web site, which at least allows me to see the intended order; I'm going to see if I can take this and get it to work in Dev C++.
UPDATE: I figured out the problem; I had the _pGame global variable in the wrong file (do'h!). It works fine now. I'll proceed with the next chapter, and hopefully get ahead of Joey so I can field questions in a more timely manner from now on. ::)
Re:serious this time
Posted: Sun Mar 07, 2004 7:02 pm
by Joey
ok thanks man. im trying to set up a schedual to work this out on. i am going to try and work through the book ATLEAST monday thru thursday. perhaps friday, and maybe saturday and/or sunday. i am definetely going to work through the book monday thru thursday. ill try and fit in other days too, but i have a lot of things i need to do, like practice guitar, practice hockey, and i need to start jogging to get my legs in shape for hockey cause im not playing as good as i used to.
anyway, i may go through this book slow, because i will only be doing atleast 4 days a week.
thank you very much schol for renting the book to help me through this. your help is very appreciated. you really didnt have to do that, but i wont let you down now
if you are making this effort, i will NOT give up. thanks alot man.
(sorry about the post about the question though. i didnt even think to look at the source on the cd :-\ silly me.
Re:serious this time
Posted: Sun Mar 07, 2004 8:50 pm
by Schol-R-LEA
No problem; I would probably have picked it up out of curiosity anyway. I've just finished chapter 6, and I'll probably slow down to give myself some time to digest the material; as I said, the main reason I'm rushing a bit on it is to keep on top of any questions and scout ahead for any major trouble spots.
Speaking of which:
- If you're using Dev-C++, you'll probably have some problems with chapters 4 and later; the MinGW gcc compiler Does Not Play Well with the GDI library, for some reason. DOes anyone know anything about using the GDI API with Dev-C++? I've looked around and found very lttile other than the fact that it's an issue with it.
- In Ch. 5, Morrison adds a new class for bitmapped images. He discusses the code in general terms, but doesn't include the code in the text, only on the CD. There is a good reason for this; the code involves a lot of messy details of Windows GDI programming that you really don't need to know just yet. My advice is to just get the code off the CD, and work with it as a black-box library. You can look through the code in Bitmap.cpp if you want to, but trust me, it's pretty opaque in places unless you already know the Win32 API really well (I don't know it quite well enough myself).
- Chapter 6 adds an extended version Bitmap which handles transparent regions; again, just use the code off of the disk. That version also requires a library file, msimg32.lib; he explains how to add it in VC++ .NET, but the tool he mentions (the Solutions Explorer) isn't part of VC++ 6.0 so far as I can tell. The easiest way to work it out is just to use Project:Add File and find the library file itself in the VC++ lib\ directory.
I'll let you know if I see any other problems. So far, I've got mixed feelings on the book, but I don't see any reason to quit trying to learn from it. Things definitely seem to get moving around ch. 6 I think. The book is a hard one to learn both C++ and game development from, but it's better than many I've seen.
Re:serious this time
Posted: Mon Mar 08, 2004 12:47 am
by Tim
Schol-R-LEA wrote:- If you're using Dev-C++, you'll probably have some problems with chapters 4 and later; the MinGW gcc compiler Does Not Play Well with the GDI library, for some reason. DOes anyone know anything about using the GDI API with Dev-C++? I've looked around and found very lttile other than the fact that it's an issue with it.
If it's a Windows compiler then it will let you use GDI. If it doesn't then it's broken.
Re:serious this time
Posted: Mon Mar 08, 2004 12:48 pm
by Schol-R-LEA
Th eproblem I am getting is in linking, actually: the linker cannot resolve the references to GDI functions. This is apparently a known issue with MinGW; if I am understand the information I've seen, it actually disables it intentionally for some reason. I'm going to keep looking for information on t to see if I can find a workaround.
Re:serious this time
Posted: Mon Mar 08, 2004 2:10 pm
by Tim
But GDI functions are just like any other Windows functions. For instance, if you can use CreateWindowEx you can use SetPixel.
Re:serious this time
Posted: Mon Mar 08, 2004 8:51 pm
by Schol-R-LEA
I know, I know. I can't figure it out either. The only thing I've been able to determine - and I'm not sure if this was correct or not - is that if you create a project as 'Empty Project' rather than 'Windows Application', the makefile it generates doesn't include the references to gdi.dll for some reason. It seems to be by design, but for the life of me I can't figure out why.
So, for now at least, I'm simply sticking to VC+; the code was written with that compiler in mind, so I know it should work with that at least.
Re:serious this time
Posted: Tue Mar 09, 2004 7:30 am
by ark
That seems to be correct -- when I chose Empty Project, I had a linker error on the Rectangle function. But when I chose Windows Application everything seems to work fine. And you can completely delete their skeleton code and replace it with your own with no problems. And the gdi functions are in gdi32.dll, so that probably is the cause of it. How to fix it, though, I'm not sure because I'm not familiar enough with the Dev-C++ environment.
Re:serious this time
Posted: Tue Mar 09, 2004 7:37 am
by ark
actually, it's pretty easy to fix -- you can just go to your project settings and click the "Load object files" button beside the "further object files or linker options", choose "Lib files (*.a;*.lib)" from the file types combo box, then navigate your way to the Dev-C++ Lib directory and look for libgdi32.a and select it.
The project should compile fine after that. 'Course, it's easier just to select Windows Application to start with.
Re:serious this time
Posted: Tue Mar 09, 2004 1:39 pm
by Joey
when i get to that point, if i get errors, ill just install my vc++ starter edition and use that to continue through.
Re:serious this time
Posted: Tue Mar 09, 2004 7:18 pm
by Xqzzy Rcxmcq
Dev C++ is the Satan of IDE's, but it's still a very good program.
BTW: How do you declare Windows API in C++, I very much assume you have to use HANDLES and DWORDS, etc.
[C++, API, and DLLs have given me a headache the past two weeks. Apparently function libraries don't like me]
Re:serious this time
Posted: Tue Mar 09, 2004 7:32 pm
by ark
That depends on what you mean by "declare Windows API in C++".
Re:serious this time
Posted: Tue Mar 09, 2004 7:46 pm
by Xqzzy Rcxmcq
Apologies for the lack of clarity.
What I meant was:
How do you call standard Windows API functions in C++?
Re:serious this time
Posted: Tue Mar 09, 2004 10:02 pm
by ark
you include windows.h and call them.
Yes, you do need to pass handles where handles are expected and DWORDs where DWORDs are expected, etc.
It shouldn't be any different than calling them from C, except sometimes you'll have to explicitly typecast a value where you don't have to in C.
What specific problem are you having?
Re:serious this time
Posted: Wed Mar 10, 2004 5:39 am
by Joey
i dont understand the question, but ill take a guess.
WinMain()
haha i doubt thats it but i wanted to guess.
anyway, just an udate.
things are going slow because ive been busy lately, but everyday i have been doing atleast a little bit. last night i finished typing in the winmain stuff for the game engine. ill continue today and try and do the rest of the coding or atleast a little.