Dynamically import texture tiles using arrays

BlitzMax Forums/BlitzMax Beginners Area/Dynamically import texture tiles using arrays

abelian_grape(Posted 2010) [#1]
For anyone that read this thread previously, I edited it because I decided to a take a different route toward solving this problem. I can't quite figure out why I'm getting the Compile Error: Unable to convert from 'String' to 'Int' on the line that reads:

texture_file_name = NextFile(dir)


I'm sure it's some fundamental misunderstanding of how to handle files in a directory, but I can't quite figure out what the problem is or how to properly use the functions with the existing documentation.

In this code I am trying to cycle through a pre-defined "Textures" directory that contains images of textures to be used in a map editor. For each texture image, I create a white "floor" with that particular image drawn over it, and store them into an array.

			Local textures:TFloor[] = New TFloor[texture_num]		'An array that holds the different types of textures
			Local texture_file_name:String	'Name of the current texture image file under consideration
			Local dir:String = AppDir + "\Textures"	'Textures directory

			'Load the textures from the Textures directory
			For Local i:Int = 0 To (texture_num - 1)
				texture_file_name = NextFile(dir)
				textures[i] = TFloor.Create(255, 255, 255, texture_file_name, LoadImage(texture_file_name))
				texture_file_name = Null
			Next



abelian_grape(Posted 2010) [#2]
*bump*


Czar Flavius(Posted 2010) [#3]
ReadDir(path:String) takes a path name and returns an id number to identify that directory, which is intended for use with NextDir. Look in Modules/System/File system


abelian_grape(Posted 2010) [#4]
Ah, okay. The documentation mentioned that and I didn't quite understand. The problem appears to be solved, thank you :)