Well, I have been trying to keep the number of global variables down (so far I only have 2 - winmain and winproc). My last re-incarnation of this program was done that way but things got way to messy with 50 some global variables.
Thanks for the advice though.
Help needed with linking....
I inserted the enum into gamestate.h and lo and behold, it didn''t work:
Compiling...
di.cpp
d:\prototype\prototype\di.h(35) : error C2061: syntax error : identifier ''TIMER''
d:\prototype\prototype\di.cpp(124) : error C2511: ''InputHandler'' : overloaded member function ''int (int &,class TIMER &)'' not found in ''DI''
d:\prototype\prototype\di.h(19) : see declaration of ''DI''
If this looks familiar, I''ve got the answer.
Here''s how you do a forward declaration
A class without a declaration or implementation is just like a function prototype. It has been declared as being somewhere and thats all the compiler cares about. Put that before your definition of class DI in di.h and your program should compile.
Oh, and global variables suxor
Compiling...
di.cpp
d:\prototype\prototype\di.h(35) : error C2061: syntax error : identifier ''TIMER''
d:\prototype\prototype\di.cpp(124) : error C2511: ''InputHandler'' : overloaded member function ''int (int &,class TIMER &)'' not found in ''DI''
d:\prototype\prototype\di.h(19) : see declaration of ''DI''
If this looks familiar, I''ve got the answer.
Here''s how you do a forward declaration
|
A class without a declaration or implementation is just like a function prototype. It has been declared as being somewhere and thats all the compiler cares about. Put that before your definition of class DI in di.h and your program should compile.
Oh, and global variables suxor

I am still having problems with it. For some stupid reason it performs an illegal operation whenever I try to close it. At least I got it to compile.
I don't suppose you could e-mail me back the modified source? (rcjbvermilion@hotmail.com) Its really making me mad
.
EDIT: I found out what was causing the problem, but its real odd. I made a destructor for the D3D class, which calls the D3DShutdown function. Now when I use the destructor (or leave its code normal, not commented) it performs an illegal operation. But, when I comment the code in the destructor out, it works fine. I have no idea why its doing that, since the code for the D3DShutdown() should handle everything if its already been released or not. Any ideas on why it would mess up?
Oh, I am also having one other wierd problem. I have a very small memory leak after I run in fullscreen mode (and fullscreen mode only). Its always 2304 bytes and appears to be 2 things. I looked through my fullscreen code and I couldn't find anything that I'm not releasing. Any ideas on this?
Edited by - Moe on August 11, 2001 6:59:40 PM
I don't suppose you could e-mail me back the modified source? (rcjbvermilion@hotmail.com) Its really making me mad

EDIT: I found out what was causing the problem, but its real odd. I made a destructor for the D3D class, which calls the D3DShutdown function. Now when I use the destructor (or leave its code normal, not commented) it performs an illegal operation. But, when I comment the code in the destructor out, it works fine. I have no idea why its doing that, since the code for the D3DShutdown() should handle everything if its already been released or not. Any ideas on why it would mess up?
Oh, I am also having one other wierd problem. I have a very small memory leak after I run in fullscreen mode (and fullscreen mode only). Its always 2304 bytes and appears to be 2 things. I looked through my fullscreen code and I couldn't find anything that I'm not releasing. Any ideas on this?
Edited by - Moe on August 11, 2001 6:59:40 PM
I have been adding more code to it that has to do with vertex buffers. The wierd thing is that it won''t release the vertex buffer when I call GAMESTATE::Shutdown(). Anyone?
Anyone?
Anyone?
Post your code on your website again. That way there''s fresh code to work with thats exactly in the state in which you are having trouble.
I can''t guarantee a fast response. My time is split between work, girlfriend, and Counter-strike. There''s just not enough time in the week.
I can''t guarantee a fast response. My time is split between work, girlfriend, and Counter-strike. There''s just not enough time in the week.
Ok, I really appreciate the help you have given me, along with all you other gamedev members.
The code should be available here.
I admit, I get carried away playing counterstrike as well
. Its soo fun, and it actually doesn''t lag that bad on my poor 33.6 modem (its really 56k but it can''t connect as fast because of old phone lines).
The code should be available here.
I admit, I get carried away playing counterstrike as well

Ok, I have been playing around with a few things. I have some problem with the GAMESTATE destructor. For some reason when I call gamestate.GameStateShutdown(), and I have the destructor so it calls the same function, I get an illegal operation. Why would it not work? When I release something I do check if it is first, so that can't be the problem. Also, when I comment out the line in the destructor that calls the shutdown function, the function doesn't get called at all even though I am specifically calling it in prototype.cpp at the very end of my program. There is something fishy going on there and I would like to get that figured out.
EDIT - I must be tired... I can't even spell anymore.
Edited by - Moe on August 14, 2001 10:06:35 PM
EDIT - I must be tired... I can't even spell anymore.
Edited by - Moe on August 14, 2001 10:06:35 PM
Ok, I have done more playing around with the code. I found out that for some reason the gamestate.GameStateShutdown() function is not being called. I put a message box just before and one in the function, and niether appeared. There is also something funny going on with the destructor for GAMESTATE. When I call the shutdown function in the destructor, it doesn''t get called. I set it up so that a messagebox function should be called when the shutdown function is called, and it never appears even though I should be calling it in the destructor. It also doesn''t get called when I specifically call it. I would like to know what the heck is causing this thing to get messed up. It also performs an illegal operation when I go to close the program if I have the shutdown function in both the destructor and and the end of the program. That shouldn''t happen since I do test if the things are null first.
I don''t really care whatever calls the shutdown function, but as long as it gets called. I would prefer to call it myself and get this whole mess fixed so its called both times just in case I somehow don''t call it. I really just want to stop this memory leak before things get worse.
Anyone?
I don''t really care whatever calls the shutdown function, but as long as it gets called. I would prefer to call it myself and get this whole mess fixed so its called both times just in case I somehow don''t call it. I really just want to stop this memory leak before things get worse.
Anyone?
The link from 3 posts ago doesn't work. It gives the redirection message and links to your home site. Just put a link there to your code and the date it was last modified.
What are you using to detect memory leaks?
EDIT - bad speeling
Edited by - Big B on August 15, 2001 5:40:18 PM
What are you using to detect memory leaks?
EDIT - bad speeling
Edited by - Big B on August 15, 2001 5:40:18 PM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement