Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: hellninjas on October 23, 2011, 12:16:46 am

Title: One letter at a time...
Post by: hellninjas on October 23, 2011, 12:16:46 am
Ok, using the "Text(" Command, how would I display text on the screen one letter at a time for dramitization?
Also... How would I make a menu? I've tried adding and subtracting the Y value but it wont do anything, i need maybe an example...  :banghead:
Title: Re: One letter at a time...
Post by: Michael_Lee on October 23, 2011, 03:09:48 am
Okay, this isn't tested + I'm writing this up while half-incoherent with sleep, but here's something that _might_ work to display letters one at a time:

Edit: Okay, it works now.

Assuming Axe 1.0.5 for function coolness.

Code: [Select]
.TEST

. Use 'Fix 5' to draw all text to the buffer.
Fix 5


.Text you want to display:
"HELLO WORLD"->Str1

.Display the text
SLTXT(10,10,8,1000,Str1)

.Wait until you press [CLEAR] to quit.
Repeat getKey(15)
    DispGraph
End

. End program
Fix 4
Return


.Function:
.r1 = X coordinate
.r2 = Y coordinate
.r3 = Distance between letters
.r4 = Delay between each letter
.r5 = Pointer to string
Lbl SLTXT
    0->r6
    While {r5+r6}
        .X1T is from the parametric variable section.
        .I just needed another variable -- you could have done
        .r5+r6->A
        .and used A instead if you needed to.
        r5+r6->X1T

        .'o^^' is the degrees symbol
        Text(r6*r3+r5,r2,o^^X1T)

        Pause r4
        r6+1->r6
    End
Return


.Basically:
.While the character isn't [00] (null byte),
.keep going and display the character.


What kind of menu?  There are so many...

Here's basically pseudocode for what I would do for a basic menu:
Code: [Select]
.TEST

Fix 5

Draw basic stuff
Write all the text
Draw a sprite next to the first item
Repeat until I press [2nd] or [Enter]
    If getkey up or down
        erase the sprite
        If getkey up
            Subtract 1 from the sprite's Y value
        End
        If getkey down
            Add 1 to the sprite's Y value
        End
        Draw the sprite (multiply the Y value by whatever and add an offset)
        DispGraph
    End
End

The sprite's Y coordinate is the menu item number
If Y=0
    .Do something
ElseIf Y=1
    .Do something
ElseIf (etc....)
    .Blah
End

(Either wrap the entire menu in a loop, or add a Goto here.)

Title: Re: One letter at a time...
Post by: hellninjas on October 23, 2011, 05:53:54 pm
Ok, What are the Fixes? I only know what Fix 5 does...
Title: Re: One letter at a time...
Post by: parserp on October 23, 2011, 06:02:13 pm
the explanation of what all the fixes do is in the commands list (http://ourl.ca/8409)
Title: Re: One letter at a time...
Post by: Michael_Lee on October 23, 2011, 06:04:17 pm
What they all do are in the commands list: http://ourl.ca/8409
(see the 'Text' section)

I like to think of them as 'switches': you do Fix 5, the program 'switches' so that all text is drawn to the buffer, not directly to the screen, and you do Fix 4 to revert it back (which is good practice, otherwise things will look a little funny temporarily after you end the program.)
Title: Re: One letter at a time...
Post by: hellninjas on October 24, 2011, 02:45:26 pm
Thanks!
Title: Re: One letter at a time...
Post by: DJ Omnimaga on October 24, 2011, 03:21:50 pm
By one letter at a time do you mean like in RPG text boxes where the text appears like if it was typed? I always had troubles trying to figure that out myself in Axe too.

Also when this topic was started, I thought somebody started a forum game where each member posts one letter per post lol. Glad it wasn't the case.
Title: Re: One letter at a time...
Post by: Yeong on October 25, 2011, 09:28:05 am
I know somebody made a substring routine. (I think it's Runer) use his routine to display one letter and put some pause.. repeat..
That would work.
Title: Re: One letter at a time...
Post by: aeTIos on October 25, 2011, 10:54:34 am
Its not really hard or so.