Methods are ****ing awesome!

BlitzMax Forums/BlitzMax Beginners Area/Methods are ****ing awesome!

JoshK(Posted 2006) [#1]
Type RenderContext
Field group:tgadget
Field panel:tgadget
Field hWnd
Field hDC
Field hRC
Field FPS#
Field FPSLastUpdateTime
Field frames

	Method Render()
	
		'Setup Viewport
		w=ClientWidth(group)
		h=ClientHeight(group)
		glViewport 0.0,0.0,w,h
		glClearColor 0.0,0.0,1.0,0.0
		glClear GL_DEPTH_BUFFER_BIT+GL_COLOR_BUFFER_BIT
	
		glMatrixMode GL_PROJECTION
		glLoadIdentity()
		glPushMatrix()
		gluPerspective 45.0,Float(w)/Float(h),1.0,100.0
	
		'Draw Triangle
		glBegin GL_TRIANGLES
		glVertex3f 0.0,0.0,-10.0
		glVertex3f 1.0,1.0,-10.0
		glVertex3f 1.0,0.0,-10.0
		glEnd
		
		glpopmatrix()
		
		glLoadIdentity()
		glPushMatrix()	
		glOrtho 0,w,h,0,-1,1
		glRasterPos2f 1,13
		
		s$=fps
		Local buffer@ Ptr=s.ToCString()
		glListBase(listBase)
		glCallLists(s.Length,GL_UNSIGNED_BYTE,buffer)
		MemFree(buffer)
		
		glpopmatrix()
	
		'Flip buffer
		SwapBuffers hdc
		
		frames=frames+1
		time=MilliSecs()
		elapsed=(time-FPSLastUpdateTime)
		If elapsed>1000
			fps#=frames/(elapsed/1000.0)
			FPSLastUpdateTime=time
			frames=0
			EndIf
		
	EndMethod

EndType



gman(Posted 2006) [#2]
lol welcome to OOP :) gets even better with inheritance.


N(Posted 2006) [#3]
Yes. Yes they do.


Booticus(Posted 2006) [#4]
Aren't they though? They are ****ing awesome indeed!


Chris C(Posted 2006) [#5]
lol.... an' now ya see the light - as the song goes


maximo(Posted 2006) [#6]
boy you sure spamed these forums. Awsomeness of methods is nothing new to the rest of us halo ;)


boomboommax(Posted 2006) [#7]
dude post in the beginner section! spammaholic


Haramanai(Posted 2006) [#8]
And try to read the Language/Module reference and some tutorials.