Types, handles, arrays
BlitzMax Forums/BlitzMax Beginners Area/Types, handles, arrays
| ||
local selc:circle[2] In bmax, does this create an array of handles to circle objects or an array containing memory for 2 circle structures? |
| ||
In your terminology, what is the difference between a "handle" and "memory"? If I understand the question correctly, I'd say it's the first. It creates an array containing empty references to 2 circle objects. In order to put references into the array, you would have to go (for example) selc[0] = New circle, and selc[1] = New circle respectively. |
| ||
The former. |
| ||
OK thanks guys. I think you both correctly understood what I was trying to get at and thanx for the replies. Out of interest, is there any way to do the latter, with all the structures stored consecutively in memory rather than wherever individual new commands put them? |
| ||
Try this:Graphics 640,480,0 Type TCircle Field x End Type Local selc:Tcircle[] =[New TCircle, New TCircle] selc[0].x = 2 Print selc[0].x WaitKey |
| ||
Out of interest, is there any way to do the latter, with all the structures stored consecutively in memory rather than wherever individual new commands put them? No, Max doesn't do 'static' arrays. |
| ||
OK, cheers Mark, Perturbatio. |