Have Type, need Float Ptr

BlitzMax Forums/BlitzMax Beginners Area/Have Type, need Float Ptr

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.

or I could:

Type color4f
	Field r#,g#,b#,a#

	Method TypePtr:Float Ptr()
		Return Varptr r
	End Method	
End Type

glLightfv GL_LIGHT0, GL_AMBIENT, ambient.TypePtr()



That way I'll only have to edit the TypePtr definition if the type changes.

I still think VarPtr(t.mytype) should do it for me, or there could be a TypePtr() function in BlitzMax.
In these simple float examples you can use an array, but when you want to match a more complex C struct, it gets more tricky.