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.

Newcomers DBPro Corner / multiple source files

Author
Message
Tenbar
14
Years of Service
User Offline
Joined: 31st Mar 2010
Location:
Posted: 11th Apr 2010 22:28
is there a way in dbpro to have multiple source files in a program..

for instance have one file with the game loop and another file with all the functions and then include the function file into the gameloop file when you want to run/compile the exe?
GreenDixy
16
Years of Service
User Offline
Joined: 24th Jul 2008
Location: Toronto
Posted: 11th Apr 2010 23:28 Edited at: 11th Apr 2010 23:29
i so far have several different files to handle different things just add the new file and use a function command to your main loop or other



so depending on what its for globals etc you would put at the top of your main game file or some may go into your main loop

Edit: btw dont start muilty threads it just may take some time for people to respond

======================================
Tenbar
14
Years of Service
User Offline
Joined: 31st Mar 2010
Location:
Posted: 11th Apr 2010 23:49
Quote: "function function_name()
//your code here
end function"


I think you just told me how to use a function??

I would like to put a command like #include "allmyfunc.txt" that would insert that file into the main file.

Quote: "Edit: btw dont start muilty threads it just may take some time for people to respond"


This is the second post I put up because the first one did not appear. I have to wait for someone to ok the posts I put up here (don't know why) which can take a hour or so.
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 12th Apr 2010 13:17
Quote: "I have to wait for someone to ok the posts I put up here (don't know why)"


Because you are a new user you are on post approval. A mod has to approve your posts to make sure you stick to the forum rules and don't cause havoc!

Everyone starts on this and it automatically stops after a while.

You obviously don't know the forum rules or you would have known this, so check this out:

http://forum.thegamecreators.com/?m=forum_view&t=116024&b=10

TDK

LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 12th Apr 2010 18:11
Quote: "is there a way in dbpro to have multiple source files in a program."


Yes, by using the #include command that you have already listed. To my knowledge, this is limited to .dba files.

If you want to load a .txt file into DBPro, you would have to open the file to read, read the contents and store them (usually within an array).

Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 12th Apr 2010 18:43
Personally, I don't like the old IDE's way of handling includes, so I tend to use #include, and just have the include source open in another instance of the editor. The new IDE is probably much better with included files - but I like to work usually with just 1 include file, like a shared library between the game itself and the editor.

Also, the first command in your include file should be END - that way, it'll ignore everything and won't run into a function decleration or subroutine. This allows you to compile the include file to debug it - at least as far as syntax goes.


Health, Ammo, and bacon and eggs!

Login to post a reply

Server time is: 2024-09-28 16:34:35
Your offset time is: 2024-09-28 16:34:35