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 / [DBP] Reading Resources - mixing C++ and DBP

Author
Message
Veneticus
21
Years of Service
User Offline
Joined: 29th Jan 2003
Location:
Posted: 23rd Apr 2004 06:43
I have a (very large) file containing all of my game resources - bitmaps, textures, 3D objects, sounds, etc. I have C++ classes that can load the file, and get a pointer to the raw data for an individual resource. What I want to do is mix DBP (faster/easier game development) and C++ (better performance/already programmed) as such:

1) Initialize video/variables (DBP)
2) Open resource file (C++)
3) Grab a bitmap/3D Object/wav (C++)
4) Use resources in Title screen (DBP)
5) Grab more resources (C++)
6) Use resources in Main menu (DBP)
7) Grab more resources (C++)
8) Use resources in Game (DBP)
9) Repeat steps 7 and 8 as needed, getting resources from the (constantly open) resource file via C++, and using said resources in DBP as needed.

Is this doable? I'm making the following assumptions:
1) Integer value (ID) and Memblock pointer (for holding resource) are passed to C++ object.
2) Upon return, memblock holds data to be converted to bitmap/sound/object.
3) File stays open until program ends.
4) All resource retrieval happens during "loading" of current game phase (not a real-time activity).

If anyone could give me some pointers on the technical aspects of how to open a file and keep it open while retrieving data from it as needed in C++, I'd appreciate it.

DocSee
apophis
21
Years of Service
User Offline
Joined: 14th Jul 2003
Location:
Posted: 24th Apr 2004 06:52
I would say you should put this in the DBPro forum as it isn't really a newcomer question. You would need a pretty experienced coder to answer that.

-Apophis
the_winch
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 24th Apr 2004 08:28
I think the closest you will get is IanM's inteface libary
http://www.thegamecreators.com/?m=forum_view&t=27222&b=8

you ain't the cops
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 24th Apr 2004 12:06
What you are trying to aim for is possible and could be done using a set of commands similar to my Matrix1Async plug-in.

I avoided the data-conversion issue. Basically, the data just gets loaded into a memblock and it's up to the coder to translate this into usable data.

What I do personally is write a program that loads the data, converts it to a memblock (using MAKE MEMBLOCK FROM ...) and then saves the the memblock to a file. Then when the data is loaded back into the memblock within my main program, I use the MAKE ... FROM MEMBLOCK commands to convert it back.

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk
Veneticus
21
Years of Service
User Offline
Joined: 29th Jan 2003
Location:
Posted: 26th Apr 2004 01:51
So, what you're saying Ian, is that I should save the resource to a disk file in C++, and then load the resource from the disk in DBP?
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 26th Apr 2004 03:17
Huh? Not at all. I'm just saying that if you have a bitmap held in a resource of some sort, then you need to think about how you are going to get that data into DBPro.

You can load data into DBPro via a memblock but then the data has to be in the correct format.

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk
himynameisali
20
Years of Service
User Offline
Joined: 9th Nov 2003
Location: England, You...Rastards!
Posted: 27th Apr 2004 23:37
DocSee - this is DarkBASIC/DarkBasicPro, this is BASIC programming not C++, I wouldn't do C++, thats a little to advance for me

I'm happy with DarkBASIC, I haven't got DBP though I've got DBC

( KA-BOOM! ) Nukesoft Interactive
himynameisali
20
Years of Service
User Offline
Joined: 9th Nov 2003
Location: England, You...Rastards!
Posted: 27th Apr 2004 23:38
BUT! the_winch has got a good point try out that!

( KA-BOOM! ) Nukesoft Interactive

Login to post a reply

Server time is: 2024-09-22 06:39:47
Your offset time is: 2024-09-22 06:39:47