News:

Function Finder  Find all the functions within source code files

Main Menu

Improvements on GetFontWidth()

Started by thaaks, September 11, 2005, 03:10:06 PM

Previous topic - Next topic

thaaks

Currently I am writing some simple menu where I want to draw boxes for the menu items.
I calculate the sizes using GetFontWidth(menuFont) * Len(menuItemText$).
But because GetFontWidth() returns the width of the widest character in Pixel the box is much too wide.

Furthermore I assume that GetFontWidth() takes the width in Pixel from my current desktop resolution (1280x1024) instead of the game screen size (800x600).

The given font width doesn't change, no matter what screen resolution I choose (taken the example code from the GetFontWidth() help page).

So I would like to get GetFontWidth() "fixed" or request some function that calculates the "real and absolute" width of some text with a given font and the game's resolution.

Or someone shows some working sample code where you can place a colored box with any given text fitting precisely into the colored box  :rolleyes:

Cheers,
Tommy

kevin


thaaks

QuoteWidth = GetTextWidth(String$)
:rolleyes: Too many functions available error  :rolleyes:

Seems I tried to find the most complicated way...

Thanks a lot! Working perfect now  :D