How can I do this...

BlitzMax Forums/BlitzMax Programming/How can I do this...

Grey Alien(Posted 2006) [#1]
I have a global function called FlushKeys() which is deliberately named to be the same as the one in PolledInput.bmx so that my game uses my version instead.

However, if I want to call the one in PolledInput.bmx, instead, how can I do this? The following code doesn't work as PolledInput is not a Type (it works in delphi and I know you can do a namespace thing in C++ so how can it be done in BMax?):

PolledInput.FlushKeys()


thanks in advance.


Perturbatio(Posted 2006) [#2]
BRL.polledinput.flushkeys()


?


Grey Alien(Posted 2006) [#3]
I don't want to sound to happy, but I love you. Thanks :-)


ImaginaryHuman(Posted 2006) [#4]
I was gunna say just do:

BRLFlushKeys()=FlushKeys
FlushKeys()=MyFlushKeyFunction

then
BRLFlushKeys() 'use the original
FlushKeys() 'use yours


Grey Alien(Posted 2006) [#5]
that's an interesting alternative thanks. But actually I wonder if it would work as would the compiler straight away see the FlushKeys in the same file?


WendellM(Posted 2006) [#6]

Wow, that's some cool stuff right there... it's so easy to create your own dialect of Basic on the fly!

name$ = Graphics( "What's your name? " )
Cos "Hi, " + name
Print


Function Graphics$(a$)
	Return BRL.StandardIO.Input(a$)
End Function

Function Cos(a$)
	BRL.StandardIO.Print a$
End Function

Function Print()
	End
End Function



Grey Alien(Posted 2006) [#7]
lol, that's horrible.


ImaginaryHuman(Posted 2006) [#8]
lol. Grey, it should be okay, you are modifying the function pointer at runtime not compiler time. Give it a try I guess,.


Grey Alien(Posted 2006) [#9]
Ah I see, thanks. Anyway I already used the BRL. method.


Chris C(Posted 2006) [#10]
rofl - good one WendellM!!


Damien Sturdy(Posted 2006) [#11]
Chris, WendellM Stole your secret code!