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 / Quic Question on Imbedded UDT's an arrays

Author
Message
zenassem
21
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 17th Apr 2007 04:02
Can someone help me? I forgot how to go about this...

I have User Defined Type let's call MyTypeAA that needs to be an array of say 255 elements. This type will be a member of another user defined type; lets call it MyTypeBB.

So can I do this?



now to access the array elements?



etc...

The part I'm confused about is if I can DIM the array inside the decleration of MyTypeBB. If it is done differently could you use my simple example to rework it the way it should be?

Thanks,
Zenassem
Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 17th Apr 2007 04:21 Edited at: 17th Apr 2007 04:28
Unfortunately, dbp doesn't support arrays within types natively. If you are really interested in this feature, you'd probably like to know that i'm currently working on a preprocessor for dbp that will allow you to have arrays within classes. Classes are basically types that allow you to have functions embedded within them.

So, with my preprocessor, you would be able to do something like this:



Notice everything is done via methods (functions within classes); you cannot access members by themselves, you must return them or set them by way of methods.

Who needs a signature?
zenassem
21
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 17th Apr 2007 04:28
grrrr. No arrays of UDT's in UDT's. Ouch

Until your preprocessor is finished is there another solution. Like using a pointer to a memblock, or something?


I think I read about your preporcessor tool chain in another thread. Can't wait till it's finished. My program experience is mainly OOP in C++ so these types of things always trip me up in DBP. It's hard to do convert from thinking about classes and overloaded functions etc, and then convert that object model thinking to DBPro. Perhaps I need to think about getting the SDK.

~zenassem
Milkman
18
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 17th Apr 2007 04:38
You could use pointers to areas of memory to simulate this, but it would be a pain to use. This is actually what my preprocessor does to your code during processing, but it hides all the details, so you don't have to worry about it.

A link to my preprocessor is here: http://forum.thegamecreators.com/?m=forum_view&b=8&t=99578&p=2
It's an attempt to bring full-blown oop functionality to dbp, so i think you might find it useful as a c++ programmer. I will be needing people to help with beta testing this week, so if you are interested please contact me. After about a week of beta testing, i will release the preprocessor.

Who needs a signature?
zenassem
21
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 17th Apr 2007 04:53
Milkman,

I'd be interested in helping you test out what I can. I'll email you.

Unfortunately my methodology is a mixed bag. I tend to think in OOP but in the conversion to Procedure based programming, my neat organized Ideas begin to spiral out of control very quickly.

analogy:
It's like I have ideas for a neat room, but upon construction the furniture just doesn't fit. So I wind carving things up to fit. only to find the dresser is cut into 4 pieces that are placed on 4 seperate walls.

If that makes any sense.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 17th Apr 2007 21:12
For the detail you need in that first 'MyTypeAA' UDT, you'll need to create a parallel array. Other methods that I can think of would be a problem to implement without plug-in help.

Login to post a reply

Server time is: 2024-09-25 21:19:34
Your offset time is: 2024-09-25 21:19:34