Explorar o código

Added support for SColor8.

woollybah %!s(int64=5) %!d(string=hai) anos
pai
achega
5c10824d1b
Modificáronse 3 ficheiros con 33 adicións e 0 borrados
  1. 12 0
      d3d9sdlmax2d.mod/d3d9sdlmax2d.bmx
  2. 10 0
      gl2sdlmax2d.mod/main.bmx
  3. 11 0
      glsdlmax2d.mod/glsdlmax2d.bmx

+ 12 - 0
d3d9sdlmax2d.mod/d3d9sdlmax2d.bmx

@@ -414,6 +414,14 @@ Type TD3D9SDLMax2DDriver Extends TMax2dDriver
 		_iverts[15]=_color
 		_iverts[21]=_color
 	End Method
+
+	Method SetColor( color:SColor8 ) Override
+		_color=(_color&$ff000000)|color.ToARGB()		
+		_iverts[3]=_color
+		_iverts[9]=_color
+		_iverts[15]=_color
+		_iverts[21]=_color
+	End Method
 	
 	Method SetClsColor( red,green,blue ) Override
 		red=Max(Min(red,255),0)
@@ -421,6 +429,10 @@ Type TD3D9SDLMax2DDriver Extends TMax2dDriver
 		blue=Max(Min(blue,255),0)
 		_clscolor=$ff000000|(red Shl 16)|(green Shl 8)|blue
 	End Method
+
+	Method SetClsColor( color:SColor8 ) Override
+		_clscolor=$ff000000|color.ToARGB()
+	End Method
 	
 	Method SetViewport( x,y,width,height ) Override
 		If x=0 And y=0 And width=_gw And height=_gh 'GraphicsWidth() And height=GraphicsHeight()

+ 10 - 0
gl2sdlmax2d.mod/main.bmx

@@ -882,6 +882,12 @@ Type TGL2Max2DDriver Extends TMax2DDriver
 
 	End Method
 
+	Method SetColor( color:SColor8 ) Override
+		color4f[0]=color.r / 255.0
+		color4f[1]=color.g / 255.0
+		color4f[2]=color.b / 255.0
+	End Method
+
 	Method SetClsColor( red, green, blue ) Override
 
 		red = Min( Max( red, 0 ), 255 )
@@ -890,6 +896,10 @@ Type TGL2Max2DDriver Extends TMax2DDriver
 		glClearColor( red / 255.0, green / 255.0, blue / 255.0, 1.0 )
 
 	End Method
+
+	Method SetClsColor( color:SColor8 ) Override
+		glClearColor( color.r / 255.0, color.g / 255.0, color.b / 255.0, 1.0 )
+	End Method
 	
 	Method SetViewport( x, y, w, h ) Override
 		'render what has been batched till now

+ 11 - 0
glsdlmax2d.mod/glsdlmax2d.bmx

@@ -402,12 +402,23 @@ Type TGLMax2DDriver Extends TMax2DDriver
 		glColor4ubv color4ub
 	End Method
 
+	Method SetColor( color:SColor8 ) Override
+		color4ub[0]=color.r
+		color4ub[1]=color.g
+		color4ub[2]=color.b
+		glColor4ubv color4ub
+	End Method
+
 	Method SetClsColor( red,green,blue ) Override
 		red=Min(Max(red,0),255)
 		green=Min(Max(green,0),255)
 		blue=Min(Max(blue,0),255)
 		glClearColor red/255.0,green/255.0,blue/255.0,1.0
 	End Method
+
+	Method SetClsColor( color:SCOlor8 ) Override
+		glClearColor color.r/255.0,color.g/255.0,color.b/255.0,1.0
+	End Method
 	
 	Method SetViewport( x,y,w,h ) Override
 		If x=0 And y=0 And w=GraphicsWidth() And h=GraphicsHeight()