Timur
New member
- Joined
- Apr 4, 2023
- Messages
- 15
Hello; this is my first forum post here, please warn me for anything I do wrong.
I'm trying to center a text, by substracting the half of TextWidth from the half of DeviceWidth, but I get an error, called in the title.
Here's how I am trying to do it:
(Some ways I do things the way I am used to might be impractical, sorry.)
The reason I used "Font().TextWidth" is because it wont work without calling the Font class. It would work without calling it in mojo (1)
Any help would be appreciated.
I'm trying to center a text, by substracting the half of TextWidth from the half of DeviceWidth, but I get an error, called in the title.
Here's how I am trying to do it:
Cerberus:
Import mojo2
Import mojo2.graphics
' ...
Global scoreText:String
Global scoreDiment:Int
' ...
scoreText = String(strings[currentLanguage][0].Replace("ü", score))
scoreDiment = Font().TextWidth(String(scoreText))
myCanvas.DrawText(scoreText, DeviceWidth/2-scoreDiment, 0)
The reason I used "Font().TextWidth" is because it wont work without calling the Font class. It would work without calling it in mojo (1)
Any help would be appreciated.