Ver código fonte

Further changes for legacy BlitzMax.

woollybah 9 anos atrás
pai
commit
47856db29e

+ 2 - 2
mojo2.mod/examples/writepixels/writepixels.bmx

@@ -35,9 +35,9 @@ While Not KeyDown(key_escape)
 				b=.5
 			EndIf
 			
-			Local rgba:Int=a*255 Shl 24 | b*255 Shl 16 | g*255 Shl 8 | r*255
+			Local rgba:Int=Int(a*255) Shl 24 | Int(b*255) Shl 16 | Int(g*255) Shl 8 | Int(r*255)
 			
-			Local pix:Int Ptr = data.pixels
+			Local pix:Int Ptr = Int Ptr(data.pixels)
 			For Local i:Int=0 Until 16*16
 				pix[i] = rgba
 			Next

+ 24 - 1
mojo2.mod/graphics.bmx

@@ -451,14 +451,24 @@ Type TTexture Extends TRefCounted
 	End Function
 	
 	Function Color:TTexture( color:Int )
+?bmxng
 		Local tex:TTexture=TTexture(_colors.ValueForKey( color ))
+?Not bmxng
+		Local c:TIntVal = New TIntVal
+		c.value = color
+		Local tex:TTexture=TTexture(_colors.ValueForKey( c ))
+?
 		If tex Return tex
 
 		Local pixmap:TPixmap=New TPixmap.Create( 1,1,PF_RGBA8888 )
 		pixmap.ClearPixels( color )
 
 		tex=New TTexture.Create( 1,1,PF_RGBA8888,ClampST,pixmap )
+?bmxng
 		_colors.Insert color,tex
+?Not bmxng
+		_colors.Insert c,tex
+?
 		Return tex
 	End Function
 	
@@ -507,7 +517,11 @@ Type TTexture Extends TRefCounted
 	Field _glTexture:Int
 	Field _glFramebuffer:Int
 
-	Global _colors:TIntMap=New TIntMap'<TTexture>
+?bmxng
+	Global _colors:TIntMap=New TIntMap
+?Not bmxng
+	Global _colors:TMap=New TMap
+?
 	Global _black:TTexture
 	Global _white:TTexture
 	Global _magenta:TTexture
@@ -3251,3 +3265,12 @@ Type TDrawListStack
 	End Method
 
 End Type
+
+?Not bmxng
+Type TIntVal
+	Field value:Int
+	Method Compare:Int(v:Object)
+		Return value - TIntVal(v).value
+	End Method
+End Type
+?