OOP Project easily expandable

BlitzMax Forums/BlitzMax Programming/OOP Project easily expandable

Hi all, I have been getting really bogged down lately trying to tie proper OOP methods in such a way as to be a helper in my projects instead of a hinderance.

I really want to try make solutions that are easily expandable, and easily configurable so as to actually start finishing projects. I abhor procedural programming as it always starts getting clunky and not maintainable.

I would just like to know if my below code is on the right track, and advice and criticism is welcome, I really want to start taking a step in the right direction. Please could you help me.

I have a TEntity as you will see, which could hopefully be all objects in a game, and the main TApp, is this the right way of looking at things ?

It was just a simple test, not a fully fledged solution or final app.

'This application was written with BLIde <a href="http://www.blide.org" target="_blank">http://www.blide.org</a>
'Application: Simple	
'Author:  Erick Grove
'Description: Simple OOP Test
'
Strict                       
         
Type TEntity
	Field x:Int
	Field Y:Int
	
	Method Init(x:Int,Y:Int) abstract
	Method Update() abstract
	Method Draw() abstract
	
End Type

Type TPoint Extends TEntity
	                          
	Method Init(xpos:Int,ypos:Int)
		x = xpos
		Y = ypos
	End Method	                       
	                       
	Method Update()
		
	End Method
	
	Method Draw()
		DrawRect x,Y,2,2 
	End Method
	
End Type

Type TApplication    
    Global MyApp:TApplication
    Field EntityList:TList
	Field width:Int
	Field Height:Int
	Field depth:Int     
	Field AppName:String  
	
	Function Create(width:Int,Height:Int,depth:Int,AppName:String)
		 If MyApp = Null Then MyApp:TApplication = New TApplication
		 MyApp.width = width
		 MyApp.Height = Height
		 MyApp.depth = depth
		 MyApp.AppName = AppName
		 SetGraphicsDriver GLMax2DDriver()         
		 AppTitle = AppName
		 Graphics MyApp.width,MyApp.Height,MyApp.depth
	End Function	
    
	Method AddEntity(ent:TEntity)
		If EntityList = Null Then EntityList = New TList
		EntityList.AddFirst(ent)
	End Method

	Method GetWidth:Int()
		Return width
	End Method
	                
	Method GetHeight:Int()
		Return Height
	End Method       
	
	Method GetDepth:Int()
		Return depth
	End Method
	       
	Method UpdateAll()
		For Local Entity:TEntity=EachIn EntityList
			Entity.Update()
			Entity.Draw()
		Next
	End Method
	
	Function Update()
		
		While not KeyDown(KEY_ESCAPE)
			
			DrawText "Application: " + MyApp.AppName + "Running",10,10
			If MyApp.EntityList <> Null Then MyApp.UpdateAll()			
			
			FlushMem
			
			Flip
			Cls
		Wend
		
	End Function
	
	Function CleanUp()
		              
		For Local ent:TEntity=EachIn MyApp.EntityList
			MyApp.EntityList.Remove(ent)
			ent=Null
			FlushMem
		Next        
		
	End Function
	
End Type                         
                                                                

TApplication.Create(640,480,0,"Erick Test")   

For Local i:Byte=0 To 300
    Local point:TPoint = New TPoint
	point.Init(Rnd(640),Rnd(480))
	TApplication.MyApp.AddEntity(point)
Next


TApplication.Update()
TApplication.CleanUp()