Author Topic: Text Alignment?  (Read 4884 times)

0 Members and 1 Guest are viewing this topic.

Offline Vile Smile

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 10
  • Rating: +0/-0
    • View Profile
Text Alignment?
« on: October 17, 2010, 03:33:00 pm »
Is it possible to align text to the right or center?

Also, is it possible to determine the length of a string?

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Text Alignment?
« Reply #1 on: October 17, 2010, 03:34:34 pm »
is this on the graphscreen or homescreen? and is it large text or small text?

both are possible, i'm just curious because small text would be difficult while large text on the homescreen would be relatively easy.

and yes, you can determine the length of a string
« Last Edit: October 17, 2010, 03:34:48 pm by nemo »


SirCmpwn

  • Guest
Re: Text Alignment?
« Reply #2 on: October 17, 2010, 03:34:53 pm »
Length can be done with length(
As for aligning it, I can look into writing a method for you, but you'd have to calculate the pixel width of the text first.

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Text Alignment?
« Reply #3 on: October 17, 2010, 03:46:12 pm »
With large font, aligning is a simple equation, but for small font, it gets a little more complicated.

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Text Alignment?
« Reply #4 on: October 17, 2010, 04:45:44 pm »
Well wouldn't it only get hard with the small font when you branch away from the three pixel width?
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Vile Smile

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 10
  • Rating: +0/-0
    • View Profile
Re: Text Alignment?
« Reply #5 on: October 17, 2010, 06:12:00 pm »
My goal is to display a score (integer), but it is aligned along the right side of the screen. How would I find the number of digits in the score?

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Text Alignment?
« Reply #6 on: October 17, 2010, 06:16:37 pm »
Crap, I keep forgetting to check what section this is in :P I keep thinking this is all TI-BASIC :P

Anywho, you might be able to do it the way Sir said, with the length( command. But I'm not sure. I only know how I would do it in TI-BASIC.
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Text Alignment?
« Reply #7 on: October 17, 2010, 06:59:03 pm »
Code: [Select]
.S=Score (or any other number to align right)
.T=Temp
.X=x position of text
.Y=y position of text
91→X
S→T
While T/10→T
X-4→X
End
Text(Y,X,S▸Dec)
« Last Edit: October 17, 2010, 07:25:39 pm by Runer112 »

Offline Vile Smile

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 10
  • Rating: +0/-0
    • View Profile
Re: Text Alignment?
« Reply #8 on: October 17, 2010, 08:04:13 pm »
Thanks! Worked like a charm!