Texture Incbin solved

BlitzMax Modules Forums/MiniB3D/Texture Incbin solved

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

If you change the Filefind() function in "TTexture.bmx", by adding some code to catch "incbin::" , minib3d lets you load incbin'ed textures, with the LoadTexture() function.

I have only tested with with a single texture (not cube maps etc.), but for now this it seems to work fine.

Also I have not tested reloading and if already loaded texures are properly reused.

My new Filefind() function looks like this:

	Function FileFind(file$ Var)
	
		If Lower(Left(file$,8)) = "incbin::"
			If IncbinPtr(Right(file$,Len(file)-8))
				Return True
			Else
				DebugLog "ERROR: Cannot find Incbin texture: "+file$
				Return False	
			EndIf
		EndIf
	
		If FileType(file$)=0
			Repeat
				file$=Right$(file$,(Len(file$)-Instr(file$,"",1)))
			Until Instr(file$,"",1)=0
			Repeat
				file$=Right$(file$,(Len(file$)-Instr(file$,"/",1)))
			Until Instr(file$,"/",1)=0
			If FileType(file$)=0
				DebugLog "ERROR: Cannot find texture: "+file$
				Return False
			EndIf
		EndIf
		
		Return True
		
	End Function