Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SST
#1
This is a little program that lets you smoothly scroll text across the screen. I thought it would look good in games or intros. No black box around the text either.

It comes with a little demo.

Instructions are in the file =)

[syntax="qbasic"]'SST - Smooth Scrolling Text
'2004 Dark_Prevail
'----

'<------START SST SETUP (must be included)
'$DYNAMIC
DECLARE SUB getsst (x1%, y1%, x2%, y2%, array() AS ANY, sstnum%)
DECLARE SUB putsst (x%, y%, array() AS ANY, sstnum%, c%)
DEFINT A-Z
TYPE ssttype
x AS INTEGER
y AS INTEGER
END TYPE
' -----END SST SETUP--

SCREEN 7, , 1, 0

'We dimension an empty array for each separate SST we want.
'It must be dimensioned as TYPE (ssttype)
DIM sst1(0) AS ssttype
DIM sst2(0) AS ssttype
DIM sst3(0) AS ssttype
DIM sst4(0) AS ssttype
DIM sst5(0) AS ssttype
'Now we use the getsst sub to GET the text for each SST we want.
'The variables passed are: -x1,y1,x2,y2: positions of the area to scan
' for text
' -sst(): The name of the array to install the SST
' to.
' -sstnum: This should be 0 to start with, and after
' the sub is called, will be the size of
' the SST that was just got.

PRINT "This is a piece of scrolling text."
getsst 0, 0, 270, 10, sst1(), sstnum1
CLS
PRINT " Scroll Scroll Scroll."
getsst 0, 0, 270, 10, sst2(), sstnum2
CLS
PRINT " Yada Yada Yada Yada Yada"
getsst 0, 0, 270, 10, sst3(), sstnum3
CLS
PRINT " Blah Blah Blah"
getsst 0, 0, 270, 10, sst4(), sstnum4
CLS
PRINT "Want a little Demo? Wink"
getsst 0, 0, 270, 10, sst5(), sstnum5
CLS

'Now we use the putsst sub to PUT the SST to wherever we want on screen. The
'required variables are as follows:
' -x, y: The coords to PUT the SST to.
' -sst(): The array holding the desired SST
' -sstnum: the size of the SST. This should
' have been got from the getsst sub.
' -colour: The colour to write the SST as.

FOR i = 0 TO 100
putsst 50, i, sst5(), sstnum5, 15
PCOPY 1, 0
CLS
NEXT
SLEEP 2
FOR i = 100 TO 200
putsst 50, i, sst5(), sstnum5, 15
PCOPY 1, 0
CLS
NEXT


FOR i = 0 TO 320
putsst 20, i, sst1(), sstnum1, 1
putsst 20, 200 - i, sst2(), sstnum2, 11
putsst i * 2 - 320, 80, sst3(), sstnum3, 14
putsst 320 - i * 2, 120, sst4(), sstnum4, 9
'WAIT &H3DA, 8'just for timing Wink
PCOPY 1, 0
CLS
NEXT
DIM pos2 AS SINGLE, pos3 AS SINGLE, pos4 AS SINGLE
pos2 = 260
pos3 = 320
pos4 = 380
FOR i = 200 TO 1 STEP -1
temp2 = pos2
temp3 = pos3
temp4 = pos4
putsst 20, i, sst1(), sstnum1, 15
putsst 20, temp2, sst2(), sstnum2, 15
putsst 20, temp3, sst3(), sstnum3, 15
putsst 20, temp4, sst4(), sstnum4, 15
'WAIT &H3DA, 8 'just for timing
PCOPY 1, 0
CLS
pos2 = pos2 - 1.25
pos3 = pos3 - 1.5
pos4 = pos4 - 1.75
NEXT

REM $STATIC
SUB getsst (x1, y1, x2, y2, array() AS ssttype, sstnum)
FOR x = x1 TO x2
FOR y = y1 TO y2
IF POINT(x, y) <> 0 THEN a = a + 1
NEXT
NEXT
sstnum = a

REDIM array(sstnum) AS ssttype
a = 0
FOR x = x1 TO x2
FOR y = y1 TO y2
IF POINT(x, y) <> 0 THEN
a = a + 1
array(a).x = x - x1
array(a).y = y - y1
END IF
NEXT
NEXT
END SUB

SUB putsst (x, y, array() AS ssttype, sstnum, c)
FOR i = 1 TO sstnum
PSET (array(i).x + x, array(i).y + y), c
NEXT
END SUB[/syntax]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)