Hi,
I just starting programming for the first time, and I decided to write a scrolling text program. When I run the program with my Monitor Refresh Rate set to 85 Hertz, the scrolling looks great, but when I run it at a refresh rate of 60 Hertz it looks kind of choppy.
I tried using the Timer() command to sync my screen updates, but I could not get it it to work right, so I just use the SYNC commands instead. I also tried adjusting my SYNC RATE to get faster playback, but I have used a SINE WAVE in my scroll routine, for the TEXT Y position, and it updates the Y POSITION way too fast, but the TEXT X POSITION looks a lot better.
The reason I want to run this at 60Hertz refresh rate is because I'd like to run it on my Arcade Machine.
Anyway, here is my code for this scrolling text program. I can probibly simplify this code a lot more, but I'm still learning how to program... I'm just happy it works at all
If anyone has any ideas about this, I would really appreciate it.
Thanks!!
[/code]
Rem ***** Main Source File *****
message1$ = "This is just sample text.... it's not really saying anything important... in fact, it's only purpose for existence is to be displayed across the screen in a fancy flashing sine wave."
message2$ = "And this text is here just because I wanted to see if I could have 2 scrolls going at the same time."
hide mouse
set text font "FixedSys"
set text size 50
screen_width = screen width()
letter_width = text width(" ")
letters_per_screen = (screen_width/letter_width)+2
xpos = letter_width*-1
length2 = text width(message2$)
for m = 1 to letters_per_screen
spacer$ = spacer$ + " "
next m
message1$ = spacer$ + message1$
message_length = len(message1$)
load bassmod "media\estrayk-commando.mod",1
set bassmod 1,44100,1
play bassmod 1
sync on
sync rate 60
do
for scroll = 0 to message_length
for m = 1 to letter_width step 4
cls
t = t + 1
cc = cc + 1
colourvalue1 = (sin(cc*4)*128)+128
for x = 1 to letters_per_screen
v=v+1
letter$ = mid$(message1$, x+count)
xpos = xpos + letter_width
ypos = sin(v*5)*120
shadowcolour()
text (xpos+s)+4,ypos+184,letter$
colourfade1(colourvalue1)
text xpos+s,ypos+180,letter$
next x
v=v-letters_per_screen+1
xpos = (letter_width*-1)
s = s - 4
value2 = (sin(cc*8)*128)+128
colourfade2(value2)
xmov = xmov - 2
xpos2 = (xmov + screen_width)
if xpos2 <= -length2
xmov = 0
else
xmov = xmov
endif
text xpos2, 400, message2$
if scancode() then goto finish
sync
next m
v=v+1
count = count + 1
s=0
next scroll
count = 0
loop
finish:
end
function shadowcolour
ink rgb(128,128,128),0
endfunction
function colourfade1(value1)
ink rgb(220, value1, 100),0
endfunction
function colourfade2(value2)
ink rgb(value2, value2, value2),0
endfunction
[code]