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 / Functions in Dark GDK

Author
Message
RoF
12
Years of Service
User Offline
Joined: 22nd Mar 2012
Location:
Posted: 24th Mar 2012 00:49
Just so I know and for future reference:
Is it possible to create functions in dark GDK in a separate header file?
If so, how would I load images and sprites within that function?
Thus far my attempts have lead to only silhouettes of the images that I originally wanted to be displayed from my function.

I used dbLoadImage within the function itself and created the sprite in the function. I've included darkGDK.h in the header file and used dbSetColorKey() to pink (which I put in the background of all the images) Is there something else I should have been doing?
WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 24th Mar 2012 03:22 Edited at: 24th Mar 2012 03:23
Images, sprites, objects, etc would be loaded as normal in any piece of code you add to your project.

Generally an extension to a project comes in 2 files, .h and a .c or .cpp. The .c or .cpp gets compiled into an object file that gets linked to your main project. It holds your code, compiled just the same as the main file but can make compiling time quicker.

The .h file usually holds references to the functions in the .cpp or .c file, just like you would forward declare a function or even data.

The GDK (DBP) end exe file is what is generated just like in DBP so ID's are just the same across all included files. Meaning you can call a function in another .cpp file with the ID of an image and it will work hunky dory.

Unless you make a typo in your code...

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
RoF
12
Years of Service
User Offline
Joined: 22nd Mar 2012
Location:
Posted: 24th Mar 2012 19:22
Thanks, I've managed to fix it and get the function to work

Login to post a reply

Server time is: 2024-11-19 03:37:45
Your offset time is: 2024-11-19 03:37:45