QB64 Phoenix Edition
Let's take this input for a spin - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3)
+---- Forum: Programs (https://qb64phoenix.com/forum/forumdisplay.php?fid=7)
+---- Thread: Let's take this input for a spin (/showthread.php?tid=368)



Let's take this input for a spin - doppler - 05-07-2022

Code: (Select All)
_Title "Spining Input test"

'
' spin$ Just spins. It can be anything you like
' special graphics like growing periods. Even the entire character set.
' If character set suggest very high limit number, see below
'
spin$ = "|/-\" ' spin pattern.
cr$ = Chr$(13) ' end of input
esc$ = Chr$(27) ' end of program life as we know it

Print "Hit <esc> key or <enter> will exit program someway"
Print

'
' the following print statement can be anywhere on the screen EXCEPT
' at a position where input would flow over right edge of execution box.
' Why ? Because I am lazy and didn't want to handle exception at this time.
'
Print "input spin test ?  ";

Do ' outer do
    spin = 0 ' got to start somwhere

    Do ' inner do
        _Limit 10 ' limit the spin rate Higher faster, lower slower
        x$ = InKey$ ' scan a key
        If x$ = esc$ Then System ' Emergency exit "use the escape clause of contract"
        If x$ = cr$ Then BackOff1: Print " ": End ' the normal way to end input, this would be a goto
        If x$ <> "" Then Exit Do ' got a hit exit inner do
        BackOff1 'locate on top of the spin
        Print Mid$(spin$, spin Mod (Len(spin$)) + 1, 1); 'Print your selected spin character from spin$
        spin = spin + 1 ' just a running count
    Loop

    BackOff1 ' Over write spin character with x$
    Print x$; ' At this point you can build input from x$ (re: t$=t$+x$)
    Locate CsrLin, Pos(0) + 1
Loop ' Return to outer do

End ' Abnormal end, never suppose to get here

Sub BackOff1
    Locate CsrLin, Pos(0) - 1
End Sub

@pete As I named the sub I was thinking of you. re: truck mud flaps, not all have a naked lady sitting on the beach for a pattern.

Take as you like anything of this code.  Free to use or abuse.  Just test code and needs to be tweaked to your flavor.  (add all the salt and pepper you desire)