Hi,
I'm getting some strange readings from my class when trying call my drawTxt method. It is always just displaying 0 - see below;
type TGameSetup
field gameText:string
field xText:int
field yText:int
method new()
gameText="test text2"
xText=40
yText=40
end method
Function drawTxt()
DrawText(gameText,xText,yText)
End Function
Function Create:TGameSetup()
Return New TGameSetup
End Function
End Type
Global gameInfo:TGameSetup = new TGameSetup
Graphics 1024,768,0
While Not KeyHit(KEY_ESCAPE)
Cls
gameInfo.drawtxt() 'this displays 0
DrawText(gameInfo.gameText,100,100) 'this displays the text
flip
wend
Apologies about the code not being highlighted/blue etc - but how do you do this?
Anyway, the method always returns 0, but calling the DrawText function and passing in gameInfo.gameText works fine. So why is this failing from the method call?
I'm assuming it thinks it is an integer, but I've defined the field as String.
Regards,
Scott M.
|