Advertisement

Dynamic arrays (nothing to do with maps)

Started by June 13, 2000 10:34 AM
1 comment, last by Zombie 24 years, 6 months ago
Uh... this is a little bit difficult to explain, but I''ll try:

Sub InitTextures()
 layers=2
 ReDim numtextures(1 To layers)
 numtextures(1) = 2
 numtextures(2) = 1

 ReDim Textures(1 To layers, 1 To numtextures(x))  ''<- the problem is here

 Slider1.Min = 1
 Slider1.Max = numtextures(1)
 Set Textures(1, 1) = CreateTextureSurface(App.Path & "\test.bmp")
 Set Textures(1, 2) = CreateTextureSurface(App.Path & "\test2.bmp")
 Set Textures(2, 1) = CreateTextureSurface(App.Path & "\tst1.bmp")
End Sub
 
Now, the problem is quite strange. In textures array, the value of second dimension should be relative to the first, so that when the 1st. dimension''s value is 1, the maximum value of the 2nd. should be 2. And when the value of the first is 2, the max of second is 1. Is it even possible to do this, and if not, could someone tell how to make something that works in the same way?
I hope that x has been initilized to something useful. Other than that I''d just use an if statement. I assume that x is a global having a value of 1 or 2.
If x = 1 then redim texture(1 to 2, 1 to 1)else redim texture(1 to 2, 1 to 2)end if 

I wouldn''t recomend making the numtextures array if its just used to redim the textures array. An if statement would probably be faster and cleaner.

OneEyeLessThanNone

the icons are shaking again
Advertisement
Sorry, I should have used question marks instead of x. X isn''t any variable, it just is there to show that there should be something. And well, that solution wouldn''t even work- Redim changes the both values, so that wouldn''t be of any use. Someone HAS to know this, so please, help me!

This topic is closed to new replies.

Advertisement