Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Question about Classes and GDK code included

Author
Message
Dragon slayer
18
Years of Service
User Offline
Joined: 3rd Nov 2006
Location: Bourbonnais Illinois
Posted: 18th May 2013 16:06 Edited at: 18th May 2013 16:11
I have been learning c++ through the Game Institute. The code here is from the book. I can get the code to work with VC 2008 no problem. I would like to use DarkGDK so I set up a project using the wizard option DarkGdk-game get all the class code done and it compiles with no errors but when the screen comes up nothing is seen. My code generation for C++ under the properties is set to MT. I have tried all the other options and get lots of errors. Not sure what this option is supposed to be for mixing Dgdk and straight C++. I have tried the code in main in and out of the While(Loop).

Here is the code

The header file


Here is the class implementation file


And here is the main file

Dragon slayer
18
Years of Service
User Offline
Joined: 3rd Nov 2006
Location: Bourbonnais Illinois
Posted: 18th May 2013 18:54
Ok I have no answers here! I did a dumb thing! I included iostream, string and I did not need these. I included the class header and the GDK header only and just used the gdk code and it worked.

Maybe I am over-thinking DarkGDK I think that I need to include the c++ headers for certain things when I really don't! Maybe it is that I don't fully understand how GDK works and why I don't need the c++ headers and now I definitely don't really know when I do need to use them. Maybe someone can help me to understand this!

I am learning classes and this is big for me that I can get them working in GDK! I am very happy about this!!! I have a project I am doing in DBP that I am going to port over to GDK and use classes instead of UDT's.

There is also a small text rpg in my book that I am going to do in GDK!
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 24th May 2013 19:41
If you're using a function supplied by DGDK, then you won't need to #include any headers that it uses. If you need to use a function or data type that DGDK doesn't use, then you will need to #include it.
One problem I see is:
Quote: "Wizard wiz0;"
inside your LoopGDK. This will initialize the wiz0 each time it "loops" and any variable changes you made in the loop will be reset. Place the declaration outside the loop.
Another issue is that you are using "cout". Use dbText instead.

The fastest code is the code never written.
Dragon slayer
18
Years of Service
User Offline
Joined: 3rd Nov 2006
Location: Bourbonnais Illinois
Posted: 25th May 2013 04:30
I was just trying things out could not get it to work any way I tried. I am gaining on it. I think once I get it all figured out GDK is going to be good. It just seems like there is a lot to figure out on your own as the documentation is lacking. I think classes are great and a big part of c++. I looked through some of the tutorial code and did not see classes being used. I thought that was what OOP was all about. I do some stuff in DBP with UDT's and like the idea of classes much more.
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 25th May 2013 16:30
class/struct is by far the most useful thing in c++ (IMO). They can be used to encapsulate variables for an object and functions that the object uses can be written in the class/struct.

The fastest code is the code never written.

Login to post a reply

Server time is: 2024-11-18 21:37:45
Your offset time is: 2024-11-18 21:37:45