05-18-2006, 05:00 PM
Can anybody tell me how to center text please
Center Text
|
05-18-2006, 05:00 PM
Can anybody tell me how to center text please
05-18-2006, 05:14 PM
Take how many pixels your screen is wide
divide by 2 for center then divide by 8 for CHAR spaces to center then take yout string and divide by 2 minus that from your screen center! then plug you final number in to LOCATE X,Y eg TEXT$="HELLO WORLD!" <----- string length is 12 screen length=640 640/2=320 320/8=40 <--- screen center for TEXT 12/2=6 <------ Text center 40-6=34 <--- text start for centered text! LOCATE 34,1RINT TEXT$ <------ it is now centered! if you want just a comanded you would either have to write one or look for a library.
05-18-2006, 06:50 PM
So using his example, you can make a simple SUB to print centered text on the screen:
Code: DECLARE SUB printc(text AS STRING, y AS INTEGER) *Note: This has not been tested, there may be errors.
quote="Deleter"]judging gameplay, you can adaquately compare quake 4 with pong[/quote]
05-18-2006, 08:49 PM
You could also look up and use drawstring from the wiki
05-19-2006, 07:14 PM
Anyone have an app to load standard Windows fonts into an image buffer for DRAW STRING use?
f only life let you press CTRL-Z.
-------------------------------------- Freebasic is like QB, except it doesn't suck.
05-19-2006, 11:02 PM
Quote:Anyone have an app to load standard Windows fonts into an image buffer for DRAW STRING use?This thread might interest you: http://www.freebasic.net/forum/viewtopic.php?t=1713 |
« Next Oldest | Next Newest »
|