123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|631|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Blitz -> Viewport to scroll text in a fixed boundary

Fri, 03 Oct 2008, 11:19
LostUser
In my game I have a Commodore 64 styled "boot screen", which is just basically a list of everything its loading, line by line -- but the thing is sometimes the output goes outside the boundary of the viewable screen.

What I'd like to do is use Viewport() or something similar so that whatever is outputted on the screen will be fixed to a boundary.

Here is what I've done so far;



In this above example the text just displays "as-is", but does not scroll within the viewport boundary.

Any help on this would be greatly appreicated.

With thanks.
Fri, 03 Oct 2008, 14:58
Jayenkai
You need to scroll the value of Y.
Rather than move Y, move a second variable, and get that to shift the displayed Y value instead.



Now, if you want a "More C64 esque" tiled scroll, you'll have to move ScrollY by 15 pixels at a time, rather than 1.
Easy enough, but if you move them too fast it's unreadable, so you should add a ScrollDelay variable, count that up to .. say 20.. then when it hits 20, reset it to 0, and then move up the ScrollY variable. Should slow it down enough.

-=-=-
''Load, Next List!''
Sun, 05 Oct 2008, 10:38
LostUser
Oh that's fine enough! Thanks again Jayenkai!
Sun, 05 Oct 2008, 12:07
LostUser
I've got a bit of a problem.

The code you provided automatically scrolls text up the screen from near the bottom of the viewport.

In my code I'm actually calling functions, so when it says "Loading generic data...", it's actually calling a function called "Init_Generic_Data()".

So this means I can't use a loop.

I could use a "message" type to catch when a message has already displayed and therefore not load the function again, but that seems a bit overkill.

Although I am not using a loop, it doesn't mean I'm not adversed to using one in my problem; so long as it doesn't load any of the functions again.



Secondly the scrolling happens, regardless of how many messages there are on the screen. So, if there's only 3 messages; it'll scroll all 3 up the screen.

What I'm after is a line-carriage routine.

Explained in pseduocode.



I hope I've explained the problem, and what I'm after a bit better.
Sun, 05 Oct 2008, 15:14
Jayenkai
Gotcha..
A good old style scrolling list display thing.

OK, first off you need an array and a global to keep track of things.

dim LineofText$(30)
global LinesOnScreen=0

Whenever you print a line, shove it in the lastmost LineofText() and keep track of which line your up to with the global..
Then, if you're at the bottom, rather than adding to line 31, you instead shift all the other bits of text up one, remove the first, and plonk the text into line 30.



To display the text, run through each one, and text it to the screen. You could make a handy Function C64Display() to do that... And then have a Function C64CLS() to clear all the lines of text, and reset LinesOnScreen to the top...

You might also want to use StringWidth(txt$) to check the width of txt$. If it's too long to fit onto the screen, cut the string into chunks and add it as a set of lines, instead of one single one.

-=-=-
''Load, Next List!''
Mon, 06 Oct 2008, 07:40
LostUser
Okay, I'll try using what you've given to provide an answer.

Thanks.
Mon, 06 Oct 2008, 10:05
LostUser
Hi. I've done a hack/quick fix solution to solve the problem.

I simply just put a fill-colored rectangle over the viewport area and reset the Y parameter and this resets the line carriage to the top.

IE;


*CLOSED*




Sat, 11 Oct 2008, 15:56
dna
When I use this I just get a bunch of blurry lines.



-=-=-
DNA
Sat, 11 Oct 2008, 16:05
Jayenkai
It's not a USE, USE, USE, USE, USE function.. it's a one use = one line of text function.



Like so..

-=-=-
''Load, Next List!''
Sun, 12 Oct 2008, 15:35
dna

I see.

I was calling it continuously.


Thu, 16 Oct 2008, 03:19
LostUser
Hi there.

Thanks for your solution. After a lot of careful consideration I just decided to have a "Loading..." message and got rid of the C64 Bootup screen as it was pretty pointless having it.

I'm going away again to dubai to find full-time work, and as soon as I've settled down I'll concentrate again on finishing my project.
Thu, 16 Oct 2008, 03:49
Jayenkai
Cool! Good luck!! Let us know how it turns out.