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 / How to make your own libarys for GDK using GDK?

Author
Message
CocaCola
14
Years of Service
User Offline
Joined: 23rd Mar 2010
Location: CocaCola.x CocaCola.y CocaCola.z
Posted: 27th Oct 2010 01:15 Edited at: 27th Oct 2010 01:15
I want to basically make functions, but not use functions, something that I can use with any program I make without having to make a new function for it, is there a way to do this? say I wanted a command "dbCube" to do the exact same as "dbMakeObjectCube, dbRotateObject, dbColorObject" except without making a function for it. So how do you make libraries for GDK using GDK?

Always program as if the person maintaining your program is a psychopath that knows where you live
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 27th Oct 2010 01:18
You create a 'static lib' project, write your function and compile it.

You then write a header file for your function, then include that in your target app and link your static lib. Take a look at the DarkSDK.h file to see how to automatically link your static lib when including the header.

Utility plug-ins (26-JUL-2010)
I'm applying terms of use that require you to wear a red nose and honk a horn whenever you use the Internet
CocaCola
14
Years of Service
User Offline
Joined: 23rd Mar 2010
Location: CocaCola.x CocaCola.y CocaCola.z
Posted: 27th Oct 2010 01:33
Ok, how do I make the commands? like how do I code a bunch of commands to make one?
like in DBpro it was something like this for functions:

Is it anything like that but in C++ form?

Always program as if the person maintaining your program is a psychopath that knows where you live
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 27th Oct 2010 15:34
Um ... yes. You need to write functions in C++

There's no difference between the functions you'd write and the functions that TGC/I write. None at all. We use exactly what I posted above to provide the libs for the GDK.

Utility plug-ins (26-JUL-2010)
I'm applying terms of use that require you to wear a red nose and honk a horn whenever you use the Internet
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 27th Oct 2010 15:45

I think that's what you want. Making functions in C/C++ is a pretty straight foreward and basic thing. If you have done more than a month's worth of programming in C/C++, you should have made a function or two already. Just in case, you should look up class/struct and function declarations before going any further in programming. They make your program easier to manage and more powerful. For instance:

I know it doesn't seem like much when you first look at it, but it's much more powerful than DBP's "function".
Remember, when you make a class, you have to declare it before you ever use it in your code. I usually make all my functions and place them in another file and then #include it at the beginning of my main program. There are several ways to do that, but if you don't want to mess with multiple files, just declare the class before your main loop.

The fastest code is the code never written.
CocaCola
14
Years of Service
User Offline
Joined: 23rd Mar 2010
Location: CocaCola.x CocaCola.y CocaCola.z
Posted: 28th Oct 2010 17:38
Hawkblood, I cant use the top one to make functions in lib files?

Always program as if the person maintaining your program is a psychopath that knows where you live

Login to post a reply

Server time is: 2024-11-19 16:46:47
Your offset time is: 2024-11-19 16:46:47