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 / Two Source File Help?

Author
Message
CokeBoi
15
Years of Service
User Offline
Joined: 19th Jun 2009
Location:
Posted: 16th Aug 2009 04:46
Hi, Say I wanted two source files to make the code look neater. In one Source file I want to make the screen maximize and in the other one I want to load a matrix and move around using arrow keys. How would I go about doing this? Because When I have tried before The only one that worked was the Main Source file and not the second source file. I'm thinking it has to do with linking problems.

LOL
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 16th Aug 2009 06:08
do something like this:

Main Source:


Make 2 files one named ScreenSetup.h and one named ScreenSetup.cpp.
In the ScreenSetup.h add this code:


In the ScreenSetup.cpp add this code:


This code is pretty useless because it takes more line to set it up then it would to just put dbSetWindowOff ( ); in your main source. But this gives you a good idea on how to do these types of things.

Use Google first... it's not rocket surgery!
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 16th Aug 2009 06:21
Using multiple files for organisation is quite a basic principle of C++. Though from your description I have to assume that you are a beginner to programming in c++, bearing that in mind, I would suggest learning the language basics first, before you start worrying about splitting things into different files.

Once you have the language basics down and you know what it is all doing, you can start to look at program organisation.

A simple example though, is the Dark Invaders tutorial that comes with darkGDK... it is using a basic method of file organisation to keep things tidy and easy to read.

Here is a link to a site where you will find some nice tutorials :

http://www.cplusplus.com/doc/tutorial/

and

http://www.cprogramming.com/tutorial.html

Good Luck, C++ is a powerful language if you can find the time and patience to learn it properly.

If it ain't broke.... DONT FIX IT !!!

Login to post a reply

Server time is: 2024-11-19 02:49:46
Your offset time is: 2024-11-19 02:49:46