SetMaskColor inside Import files?

BlitzMax Forums/BlitzMax Beginners Area/SetMaskColor inside Import files?

Tani(Posted 2006) [#1]
Hi!
Is there some way (a workaround maybe) so that you are able to set the transparent color for images loaded inside a file that are imported (using the Import command). SetMaskColor just don't seem to work for those images. :(


deps(Posted 2006) [#2]
Are you calling SetMaskColor from a function inside those files?
I think SetMaskColor needs to be called after Graphics().

Edit: To expand what i just said

Bad:
' My file I import

SetMaskColor( 255,0,255 )

' Other stuff


Good:
' My file I import

function InitThisCode()
     ' Call this function after you called Graphics()
     SetMaskColor(255,0,255)
endfunction



... At least that's what I think is the problem. Correct me if I'm wrong.


Tani(Posted 2006) [#3]
Yes, it works inside functions, I knew that it needed to be set before Graphics, but it sort of skipped my mind since the file was imported inside another Import file (I just didn't realize the Import files inside other Import files where also loaded before Graphics - which is obvious when I think about it... *sigh* foolish me).

Regardless, I decided to add the Image handle declarations in the Import file only (required to make them aviable to functions inside other Import files) and then load the images in the main program instead. It seems to work just great when I do it that way, yay.

Thanks for the help btw. :)


deps(Posted 2006) [#4]
No problems. Good luck with your game! :)