Methods with same name as Max functions?

BlitzMax Forums/BlitzMax Beginners Area/Methods with same name as Max functions?

sswift(Posted 2006) [#1]
If I have a method for a sprite called SetColor which sets the color of the sprite, and I also need a Draw method which uses the original SetColor to set the color which the sprite's image will be drawn with to this color, how do I do that?

Can I user Super to do this? I'm not sure if Type Sprite is considered to be extending the main system or what.

I hope this is possible because it sure would be annoying to have to come up with different names just to make sure none of my methods conflict the the names of commands which already exist, when said names are the most obvious thing to call them.

[edit]
It does not appear I can use Super to do this. :-(
[/edit]


Diablo(Posted 2006) [#2]
i thought i saw this once and reading your post reminded me about this:

BRL.Max2D.SetColor(r, g, b)




Koriolis(Posted 2006) [#3]
You can, even if said function is not in a module.

http://blitzbasic.com/Community/posts.php?topic=51266#571854

Bear in mind though that AFAIK it's part of the numerous things that were never ever documented, so who knows if it won't be removed at some point. But I don't see any good reason so using it seems quite safe.


sswift(Posted 2006) [#4]
Koriolis:

I think that dot method is BORKEN.

Type Sprite
	Method SetColor()
	   .SetColor(255, 255, 255)
	   Print "Blah"
	End Method
End Type

ThisSprite:Sprite = New Sprite

ThisSprite.SetColor()


"Blah" does not print!

Type Sprite
	Method SetColor()
	   brl.max2d.SetColor(255, 255, 255)
	   Print "Blah"
	End Method
End Type

ThisSprite:Sprite = New Sprite

ThisSprite.SetColor()


Blah does not print here either. Hm... Maybe using setcolor screws up the print command?

SetColor(255, 255, 255)
Print "blah"


Yup. I don't know why, but...

Maybe I should try it with debug mode enabled?

Yup. Another case of me being scrwed by Max simply exiting rather than throwing up a crash window. :-)


Diablo(Posted 2006) [#5]
it works fine here sswift:
Building untitled2
Compiling:untitled2.bmx
flat assembler  version 1.64
3 passes, 4130 bytes.
Linking:untitled2.debug.exe
Executing:untitled2.debug.exe
Blah

Process complete


in both debug and release.

edit: ahh you forgot graphics command ;)


sswift(Posted 2006) [#6]
Okay, tested and both single dot and the name with the dots work for acessing the main functions. Thanks. :-)