How do I use the transparency correctly when making sprites with mem2sprite? I try with 0x00 and 0x0f and I only get 1 bit transparency. 0-14 makes 100% transparent, 15-255 makes 100% non-transparent. I thought it would be 8 bit? What am I missing?
GLOBAL sprite%[]
GLOBAL abgr%, r, g, b, a
GLOBAL mx, my, b1, b2
ALPHAMODE 0.9
DIM sprite[100*100]
FOR n = 0 TO 16
DRAWRECT RND(800), RND(600), RND(800), RND(600), RGB(RND(255), RND(255), RND(255))
NEXT
USEASBMP
WHILE TRUE
FOR y = 0 TO 99
FOR x = 0 TO 99
abgr = bOR(ASL(x, 24), 0xffffff)
sprite[x + y * 100] = abgr
NEXT
NEXT
MEM2SPRITE(sprite[], 1, 100, 100)
MOUSESTATE mx, my, b1, b2
DRAWSPRITE 1, mx, my
SHOWSCREEN
WEND
You need to enable alpha blending when you draw it:
ALPHAMODE -1
DRAWSPRITE 1, mx, my
ALPHAMODE is in there already but in the start. I noticed now that SHOWSCREEN resets alphamode, did it do that earlier too? Never had this problem before, but it works if I put it just before the drawsprite.
I believe ALPHAMODE was reset with each SHOWSCREEN
SHOWSCREEN resets pretty much everything.