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.

DarkBASIC Professional Discussion / C++ Library update

Author
Message
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 7th Apr 2003 02:47
A couple of weeks back, various people (including myself) were discussing writing programs in C++ that used the DBPro engine - I said that I was looking at putting together an interface to allow anyone with C or C++ knowledge to do it.

Well, it's not been quite as automatic as I thought it would be, but here is some very basic test code that I've been playing with to get things started - I think you'll agree that I couldn't have made things much easier



Screenshot :

I've used namespaces because some of the function names 'clash'. More to come soon
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 7th Apr 2003 02:51
Arse! Damn code didn't post correctly.

The includes are for files : cstdio, DBPro/Interface.hpp, DBPro/Core.hpp DBPro/Text.hpp, DBPro/Input.hpp and DBPro/Basic2D.hpp
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 7th Apr 2003 03:33
interesting ...

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
Galiem
23
Years of Service
User Offline
Joined: 27th Nov 2002
Location: United States
Posted: 8th Apr 2003 21:52
Impressive...

So I could define the algorythms for my program in DBPro, even the contents of the window, and then define properties of the window itself using C++, and your tool.

I'm speechless!

You've really got something great there! Keep us posted on when it's ready and what you want to do with it/ how it will become available. I think this could be the solution to alot of problems. Right now, it would cut my source down thousands of lines!

AtomR
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Portugal
Posted: 8th Apr 2003 22:18 Edited at: 8th Apr 2003 22:20
Does this method have any effect on the performance of the program?

[EDIT]
It just occured to me!!!! Does this also mean you don't need DBPro compiler to run the code??? Just the DLL's??? That's bad :-s

Take care
AtomR
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 8th Apr 2003 22:29
you'd require some good oki of C though and have a valid C compiler though

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 8th Apr 2003 22:58 Edited at: 8th Apr 2003 22:59
Answer to your questions in order:

Yes, code your algorithms in DBPro, then convert to C++, either for the whole program, or for your own commands.

Performance - there is a small overhead involved, but the C++ optimiser will remove most (if not all) of this.

Yes you will need the DBPro compiler for two very good reasons:
1) I have no idea what initialisation or shutdown steps DBPro needs to get everything running and it would take a lot of effort to find out.
2) It would encourage piracy if all you needed was the libraries.


The libraries I have implemented so far are: Basic2D, Bitmap, Core, Image, Input, Memblocks, Sprites, System and Text.

I have changed the way I've implemented the library already - Although namespaces are a great idea, I decided that I was nesting them too deeply, so I have removed a level. This means that I have to deal with naming conflicts between the libraries. For example both sprites and images have a function named 'Delete'. I also had a problem with functions that return floats which I have now fixed.

Here is som example code, with added calls to core, sprite and image libraries.



You'll see that it reads almost the same as the equivalent DBPro program at the moment - but I will have the ability to group functionality into classes later.
Freddix
AGK Developer
23
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 8th Apr 2003 23:54
I don't know if it can be authorized as it is not the standard use of DBP engine.
The engine was developped to be used with the editor and compiler .
If you find a way to not use the compiler , you don't use dbp in the standard way then it can be forbidden ( in a law point of view )

IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 9th Apr 2003 00:11
Not according to an email conversation I had with Lee. He was quite happy for me to spread the word once I'd figured it out

Besides, I'm not the only one using this - how do you think GuyS zip extension populates an array with filenames?
pugmartin
23
Years of Service
User Offline
Joined: 3rd Jan 2003
Location: United Kingdom
Posted: 9th Apr 2003 01:33
Great stuff mate. Very useful. In fact i think this could be the most useful thing happening on the forum. Keep us up to date. Good luck

That picture actually is me you know...
Can anyone post me a banana?
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 9th Apr 2003 01:52
hmmm... i think there's a part of the SDK i musta missed
cause right now i'm only using the global pointer system, i mean i can setup the checklists and such easily enough from that ... but i've not tried to populate and array.

i remember being told that you couldn't use Classes within DLLs withough it crashing - has that been cleared up?

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 9th Apr 2003 10:26
You can use classes within DLL's - My map TPC DLL uses a couple of classes internally.

And you can even export them to other DLLs or your main program : http://www.codeproject.com/dll/dllexport.asp

I have heard of a problem with memory allocated within a DLL and freed outside that DLL, but I've never had a reason to try it, so I don't know how true it is.
Shadow Robert
23
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 9th Apr 2003 16:31
oh thats cool
i coulda sworn you said at one point that Classes crashed DBpro when you used them - i've been working most of this time to avoild using them, that certainly allows alot more leverage

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 26th Apr 2003 04:42
Further Update:

I had a *major* breakthough yesterday, and everything fell into place all at once I've spent this evening cleaning up a few loose ends and adding polish and extra capabilities to what I've got.

All DBPro commands are now available with a few exceptions that no-one will miss, and a few others added that I'm sure someone will find useful. It takes about 15 minutes to regenerate the library from scratch.

I am now starting to test all the commands, which is going to be a bit time-consuming but I will continue to keep you up to date.



And another screenshot:

solo
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Israel
Posted: 26th Apr 2003 04:57
MAN, that is called a revolution!!!
good luck with your tests. i'm sure you'll fix bugs too, and save Lee the concerning of patch 5


[solo]

Login to post a reply

Server time is: 2026-07-10 21:41:01
Your offset time is: 2026-07-10 21:41:01