Drawing Text - Reverse Style
BlitzMax Forums/BlitzMax Beginners Area/Drawing Text - Reverse Style
| ||
Evening all, I need to draw text in a way which I think is pretty standard, but can't work out how to do it in BMax. It is for 'currency' in my puzzle game, whereby you start off with: £0.00 But you can get up to: £40.00 Now, what I'd like to do is have the text move 'left' when the extra character is required when the value goes over £9.99, as opposed to right. Does that make sense? Let me know if I need to explain further. I've toyed with SetOrigin / SetHandle, but to no avail as yet. Cheers! M. |
| ||
How about doing something like this:Graphics 640,480 Local money:Int = 0 While Not KeyHit(KEY_ESCAPE) Cls Local moneyTmp:String = "$"+money+".00" DrawText moneyTmp,200-TextWidth(moneyTmp),200 Delay 100 money :+ 5 Flip Wend End This way you decide on the most left pixel where the text will be and then deduct the total width in pixels of the text. This should keep everything left aligned. |
| ||
Ooh, looks good, will give it a try. I didn't think about concatenating strings into it, as I was thinking how I would do the decimal point and symbol. Will try now... ;) |
| ||
It's called Right Alignment and is standard for numbers on reports and spreadsheets etc. |
| ||
Grey Alien - I should really have thought of that, being a guy who spends his working day creating reports in various software... :0 |
| ||
;-) I wrote a report generator from scratch including graphical display in Delphi for some business software. Had to have a right align option :-) |