Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
print + scroll text big to an image (is there a better way?)
#14
Thanks B+. After I made that, I realized you were replying to someone, I guess my head was in the clouds...

So I decided to make the text side-scroller news that he wanted, with a little story I made up. Smile
This is using the resized text that Bplus posted.  


Code: (Select All)

'Side News Scroller by SierraKen
'Resized text code by Bplus.


Dim s$(19)
Screen _NewImage(800, 600, 32): _ScreenMove 250, 60
ls = Len(s$)
size = 2
t = 1
Read s$(t)
xx = -400
Do
    _Limit 40
    xx = xx + 4
    If xx > 550 Then
        t = t + 1
        xx = -400
        If t = 18 Then Restore story: t = 1
        Read s$(t)
    End If
    Text ((800 - ls * _FontWidth) / 2) - (2 * xx), ((600 - _FontHeight) / 2) - (size * 16), size * _FontHeight, &HFFFF0000, s$(t)
    _Delay .05
    _Display
    Cls
Loop Until InKey$ = Chr$(27)
End

story:
Data "Hello...","My name is Computer 5000...","Today's weather is Sunny with a breeze of 5 mph from the West..."
Data "Today's news is that everything is a-okay...","Breaking News..."
Data "Martians have landed!...","This may be my last newscast...","Over to you on the field Ralph..."
Data "Yeah it looks bad, Martians have destroyed everything...","Oh wait! Here comes the helicopters!..."
Data "*CRASH BOOM SMACK.... BZZZZZZZZZZZZ*...","Come in Ralph, you there? We seem to have lost the transmission..."
Data "Now over to Henry...","It looks like everything is under control...","The Martians are leaving now..."
Data "I guess they didn't want anything here on Earth...","They said all of our stuff is outdated, so they are leaving the planet..."


Sub Text (x, y, textHeight, K As _Unsigned Long, txt$)
    Dim fg As _Unsigned Long, bg As _Unsigned Long, cur&, i&
    fg = _DefaultColor: bg = _BackgroundColor: cur& = _Dest
    i& = _NewImage(8 * Len(txt$), 16, 32)
    _Dest i&: Color K, _RGBA32(0, 0, 0, 0): _PrintString (0, 0), txt$
    _PutImage (x, y)-Step(Len(txt$) * textHeight / 2, textHeight), i&, cur&
    Color fg, bg: _FreeImage i&: _Dest cur&
End Sub

Reply


Messages In This Thread
RE: print + scroll text big to an image (is there a better way?) - by SierraKen - 03-26-2025, 01:01 AM



Users browsing this thread: 1 Guest(s)