| 'The menu class handles all created menu's in the game
Type TMenu
	''''''''''''''''''''''''''''''''''''''''''''''''''
	'List Globals
	''''''''''''''''''''''''''''''''''''''''''''''''''
	
	Global MenuCollection:TList = New TList
	''''''''''''''''''''''''''''''''''''''''''''''''''
	'Basic Fields
	''''''''''''''''''''''''''''''''''''''''''''''''''
	
	Field X:Int
	Field Y:Int
	Field Name:String
	Field Index:Byte
	
	''''''''''''''''''''''''''''''''''''''''''''''''''
	'Status Fields
	''''''''''''''''''''''''''''''''''''''''''''''''''
	
	Field Active:Byte
	Field DoDraw:Byte
	Field DoAlpha:Byte
	Field DoColor:Byte
	Field MouseOver:Byte
	Field MouseClicked:Byte
	
	''''''''''''''''''''''''''''''''''''''''''''''''''
	'GFX Fields
	''''''''''''''''''''''''''''''''''''''''''''''''''
	
	Field DrawAlpha:Byte
	Field DrawRed:Byte
	Field DrawGreen:Byte
	Field DrawBlue:Byte
	
	''''''''''''''''''''''''''''''''''''''''''''''''''
	'List Fields
	''''''''''''''''''''''''''''''''''''''''''''''''''
	
	Field EntityCollection:TList = New TList
	Field ImageList:TList = New TList
	Field ButtonList:TList = New TList
	Field AudioList:TList = New TList
	
	''''''''''''''''''''''''''''''''''''''''''''''''''
	'Basic Static Functions
	''''''''''''''''''''''''''''''''''''''''''''''''''
	
	'Creates a menu and returns the handle to the provided variable
	Function Create:TMenu(MenuName:String, MenuX:Int = 0, MenuY:Int = 0, MenuIndex:Int = -1, MenuActive:Byte = 1)
		
		Local TempMenuHandle:TMenu = New TMenu
		
		TempMenuHandle.Name = MenuName
		TempMenuHandle.X = MenuX
		TempMenuHandle.Y = MenuY
		
		If MenuIndex <= -1
			TempMenuHandle.Index = 0
		Else
			TempMenuHandle.Index = MenuIndex
		EndIf
		
		If MenuActive <> 1
			TempMenuHandle.Active = 0
		Else
			TempMenuHandle.Active = 1
		End If
		
		TMenu.MenuCollection.AddLast(TempMenuHandle)
		
		Return TempMenuHandle
		
	End Function
	
	''''''''''''''''''''''''''''''''''''''''''''''''''
	'List Static Functions
	''''''''''''''''''''''''''''''''''''''''''''''''''
	
	'Clears the list of menus. Set delete data to true if you want to kill all current menu objects.
	Function ClearMenuList(DelData:Byte = 0)
		
		If DelData = 1
			For Local TempMenuHandle:TMenu = EachIn TMenu.MenuCollection
				TMenu.MenuCollection.Remove(TempMenuHandle)
				TempMenuHandle = Null
			Next
			
			Return
		Else
			TMenu.MenuCollection.Clear()
			
			Return
		End If
		
	End Function
	
End Type 
 I need help developing the "ClearMenuList()" function i made. Looking at the other data in the type, would i have to go through and delete each list inside TMenu or will making the TMenu variable null also kill those lists completely? I want to make sure all data involving menu entities and audio objects are removed from memory. And I am not sure if I even wrote the MenuCollection list deletion code right...
 
 Edit: Now that I think about it... this wouldnt work would it? I mean am I right to think that im just killing TempMenuHandle and not the object itself? I mean the object will stay in memory if any other variable anywhere in the program is "looking" at it right?
 
 
 |