Enhanced SetClsColor

BlitzMax Forums/BlitzMax Programming/Enhanced SetClsColor

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.

Hm, seems like I tested this only with OpenGL. DX-Alpha got ignored somehow. Here's the line from d3d7max2d:
clscolor=$ff000000|(red Shl 16)|(green Shl 8)|blue

Changing $ff000000 to something different doesn't make a difference.

Here's an example that, using the OpenGL driver, works:


'setgraphicsdriver glmax2ddriver()
graphics 800,600,0,0

while not keydown(key_escape)
	CE_SetClsColor(100,200,100,0)
	cls
	setcolor (255,0,0)
	drawrect (100,100,200,200)
	if keyhit(KEY_SPACE)
		local pm:TPixmap=GrabPixmap (0,0,400,400)
		SavePixmapPNG(pm,"test.png")
		notify ("Image ~qtest.png~q written!")
	End If
	flip
WEnd



Function CE_SetClsColor( red%,green%,blue% ,alpha#=1.0)
		red=Max(Min(red,255),0)
		green=Max(Min(green,255),0)
		blue=Max(Min(blue,255),0)
		alpha=Max(min(alpha,1.0),0.0)
		If TD3D7Max2DDriver(_max2dDriver)
			'from brl-d3d7max2d.bmx: clscolor=$ff000000|(red Shl 16)|(green Shl 8)|blue
			TD3D7Max2DDriver(_max2dDriver).clscolor=(int(alpha*255) Shl 24) |(red Shl 16)|(green Shl 8)|blue
		Else
			glClearColor red/255.0,green/255.0,blue/255.0,alpha
		EndIf
End Function