Centering letters
Blitz3D Forums/Blitz3D Programming/Centering letters
| ||
Let's say I have a type called "letter" and in there, a field called "s$." If I create 10 "letter" type instances, and the field is a alphanumeric character, how would I center them on the screen, joined together as a word? They all have to be separate strings, because they are all separate entities, and they cannot be one large word string. Thanks in advance! |
| ||
probably do something with font size and then space it im thinkin. A while back i was semi successful with this, sorry no code- lost it |
| ||
There is a 2d text function called StringWidth. That should help :) |
| ||
String width will not help you if the letters are actual meshes though. I'd recommend using an array of types though as you can directly reference the mesh which relates to an ascii value of the character. It really depends on how wide your meshes are .. if they are variable then simply add the meshwidth of each letter you want to print , including spaces and divide by 2. Is there something I'm missing? |
| ||
whatever$="Centered on top..." foobar$="Centered in the Middle of it all!" text graphicswidth()/2,10,whatever$,true text graphicswidth()/2,graphicsheight()/2,foobar$,true inputYou can writ ethe rest of the code yourself. :) RZ |