found out about global in types.
BlitzMax Forums/BlitzMax Beginners Area/found out about global in types.
| ||
I was under the impression that I could do this.type Thi global gfxwide:float=graphicsheight() 'or global whatever:float=gfxwide/2 method draw() drawtext "Hi",gfxwide/2,20 end method end type But when I do that,gfxwide ends up 0.So I have to do this instead. global gfxwide:float function create gfxwide=graphicswidth() end function I guess you can't assign a value to globals in Types?I am running the demo Blitzmax.This has caused me so many headaches.Live and learn. Later, mudcat |
| ||
The problem is graphicswidth() and graphicsheight() are being called before graphics() - globals inside types are initialised first, before any code is run. |
| ||
That explains alot. Thanks, mudcat |