FreeFont on Draw3D2

Blitz3D Forums/Blitz3D Programming/FreeFont on Draw3D2

Yue(Posted 2015) [#1]
Function Init_objFuente3D.CFuente3D( nameZip$, nameImagen$, nombre$ = "", mode% = 2, blend% = 2, pivot% = 0, order% = -1 )
	
	Local obj.CFuente3D = New CFuente3D 
	
	obj.CFuente3D\imagen3D.CImagen3D = Init_ObjImagen3D.CImagen3D( nameZip$, nameImagen$, nombre$, mode%, blend%, pivot%, order% )
	obj.CFuente3D\fuente3D% = FontRange3D(obj.CFuente3D\imagen3D.CImagen3D\imagen3D%)
	
	If nombre$ = "" Then 
		
		idFuente3D% = idFuente3D%  + 1
		obj.CFuente3D\nombre$  = "Fuente3D " + idFuente3D% 
		
	Else 
		
		obj.CFuente3D\nombre$   = nombre$
	End If 
	
	If obj.CFuente3D <> Null And obj.CFuente3D\fuente3D> 0 Then 
		
		
		InfoDepurador(obj.CFuente3D\nombre$)
	Else 
		InfoDepurador(obj.CFuente3D\nombre$,"Fail")
		
		
	End If 
	
	
	Return obj.CFuente3D
	
	
End Function 

Function DeleteObjFuente3D%()
	
	Local obj.CFuente3D = Null
	
	For obj.CFuente3D = Each CFuente3D
		
		idFuente3D% = 0
		
		obj.CFuente3D\nombre$ = ""
		
;		obj.CFuente3D\fuente3D% = 0
		
		If obj.CFuente3D\imagen3D.CImagen3D\imagen3D% Then 
			
			FreeImage3D (obj.CFuente3D\imagen3D.CImagen3D\imagen3D%)
		End If  
		
		
		
		
		Delete obj.CFuente3D
		
	Next 
	
	
	
End Function


Hello, I created a source with Draw3D2 library, but I fail to understand as to delete from memory when no longer needed more, I can delete without problem the image associated with this source, but the library can not find a command such as "Freefont" or something and I fear that it may remain in memory. Any suggestions?


hectic(Posted 2015) [#2]
Hi Yue, if you use FreeImage3D(image_handle) then will be Draw3D2 delete the Font3D automatically.


here is the code snippet from FreeImage3D():

...

			;ALLE/FONT/BANKPOS/DURCHGEHEN
			For IDrawCount=DRAWFONTSTEP To GDrawFontUsed-DRAWFONTSTEP Step DRAWFONTSTEP
				
				;ALLE/FONT/DEPENDENCIES/FREIGEBEN
				If Abs(PeekInt(GDrawFontBank,IDrawCount+DRAWFONTLINK))=FDrawHandle Then
					
					;ANGEGEBENE/FONT/BANKPOS/FREIGEBEN
					PokeInt GDrawFontBank,IDrawCount+DRAWFONTLINK,0
					PokeInt GDrawFontBank,IDrawCount+DRAWFONTFACE,0
					PokeInt GDrawFontBank,IDrawCount+DRAWFONTMEAS,0
					PokeInt GDrawFontBank,IDrawCount+DRAWFONTSVAL,0
					PokeInt GDrawFontBank,IDrawCount+DRAWFONTHVAL,0
					PokeInt GDrawFontBank,IDrawCount+DRAWFONTPVAL,0
					PokeInt GDrawFontBank,IDrawCount+DRAWFONTIVAL,0
					PokeInt GDrawFontBank,IDrawCount+DRAWFONTUSET,0
					PokeInt GDrawFontBank,IDrawCount+DRAWFONTVSET,0
					PokeInt GDrawFontBank,IDrawCount+DRAWFONTWSET,0
					PokeInt GDrawFontBank,IDrawCount+DRAWFONTHSET,0
					PokeInt GDrawFontBank,IDrawCount+DRAWFONTCHAR,0
				End If
			Next

...

		;ALLE/FONT/BANKPOS/DURCHGEHEN
		For IDrawCount=DRAWFONTSTEP To GDrawFontUsed-DRAWFONTSTEP Step DRAWFONTSTEP
			
			;LETZTES/FONT/HANDLE/SUCHEN
			If PeekInt(GDrawFontBank,IDrawCount+DRAWFONTLINK)<>0 Then IDrawPoint=IDrawCount
		Next
		
		;FONT/DRAWBANK/GRÖßENZUWEISUNG
		GDrawFontUsed=IDrawPoint+DRAWFONTSTEP
		ResizeBank GDrawFontBank,GDrawFontUsed

...



Yue(Posted 2015) [#3]
Thanks You :)