Custom Blender

Пример о том, как можно смешать цвет спрайта встроенными средствами FBGFX

Платформы: Windows, Linux
Автор: counting_pine

custom_blender.png

Screenres 320, 200, 8

Function replace255(Byval src As Uinteger, Byval dest As Uinteger, Byval p As Any Ptr) As Uinteger
    Dim c As Uinteger = *cptr(Uinteger Ptr, p)
   
    If src = 255 Then
        Return c
    Elseif src = 0 Then
        Return dest
    Else
        Return src
    End If
End Function

Dim As Any Ptr tankimg = Imagecreate(32, 32, 0, 8)
Line tankimg, (5, 24)-(30, 28), 255, bf
Line tankimg, (10, 20)-(28, 23), 255, bf
Line tankimg, (5, 19)-(22, 19), 7
For x As Integer = 7 To 28 Step 7
    Circle tankimg, (x, 29), 2, 7, ,,, f
Next x

Dim c As Uinteger

Do While Inkey = ""
    c = 1 + Int(rnd*254)
    Put (Int(rnd*320), Int(rnd*200)), tankimg, Custom, @replace255, @c
    Sleep 1000
Loop

Imagedestroy tankimg