forums

TNT Basic Forums > Programming Q&A
Scrolling...
< Last Thread     Next Thread >
Author
Thread        Post A Reply

02-18-2003 10:14

Posted by:
No Frills

Click Here to Email No Frills   Find more posts by No Frills

I've downloaded and played with the 'scrolling examples' pack - and they all seem to relate to scrolling a 'MAP' made up of 'TILES'.

Well, suppose you get a wide (or tall) picture, and want to be able to scroll round that, instead of a MAP.

Is it possible?

02-18-2003 11:29

Posted by:
ERaZer

Click Here to Email ERaZer   Find more posts by ERaZer

Yeah, I don't think that would be any problem unless you're in Hardware mode since many graphics cards have a limit of how big the images it handles can be.

02-18-2003 12:09

Posted by:
No Frills

Click Here to Email No Frills   Find more posts by No Frills

hhehe - I was ideally looking for an 'example' of how it was done, but after messing about I discovered the 'copy canvas' command.

Here's what I've got so far:

.......
Graphics Mode 640,480
Open Canvas 1,1024,768
int counter
vbl sync on
Canvas 1
Draw Picture 128
Canvas 0
hide mouse
for counter=1 to 100 step 2
Copy Canvas 1,counter,0,counter+640,480 to 0,0,0
draw frame
next counter
wait mouse click
close canvas 1
show mouse
.........

Now it works just fine - but it's sorta 'slow' - anyone got any tips on how to speed it up (if I increase the step, it jerks the screen instead of scrolls it).

02-18-2003 13:05

Posted by:
John Treece-Birch

Click Here to Email John Treece-Birch   Find more posts by John Treece-Birch

Viewports

Viewports are made for doing pretty much exactly what you want.

Basically, you can create a canvas then create a viewport to that canvas and then you can move the viewport's offset around and it creates a scrolling effect. The code looks something like this...

Graphics Mode 640,480

Open Canvas 1,2000,2000
Open Viewport 1,0,0 to 640,480

Canvas 1
Draw Picture pictureId

for n=0 to 50
Set Viewport Offset 1,0+n,0
Draw Frmae
next n

I probably got some parameters wrong in the above code because I can't run it at the moment but I think there is a section in the help called Viewports which should explain everything.

Thanks,
John

02-18-2003 14:16

Posted by:
No Frills

Click Here to Email No Frills   Find more posts by No Frills

Ever made one of those days where you ask a coding question, then just as you press 'POST' the answer pops into your head?

I was looking at your 'simple tile based scrolling example' and spotted the viewport command, and had a play.

I've got it scrolling left and right on curor presses now

It's certainly a LOT faster than my original method.

Do you have the TNT basic help in book format to purchase?

The apple help viewer takes far to long to load up (OS X 10.2.4), so I cheat and throw the main page into Safari.

02-18-2003 20:30

Posted by:
Mark Tully

Location:
TNT HQ, England

Click Here to Email Mark Tully   Find more posts by Mark Tully

Help viewer

I don't know what Apple have done to their help viewer - it used to be so much faster. Searching doesn't seem to work as well anymore either.

Hopefully they'll inject some Safari Technology™ into it soon!

We don't have any help in book format, but James Rhodes has kindly converted our tutorials into pdfs which are good for printing.

See http://homepage.mac.com/seascapesoftware/basicallyreal/html/news.html

Mark

02-18-2003 22:13

Posted by:
No Frills

Click Here to Email No Frills   Find more posts by No Frills

Yeah, I've got the BasicallyReal link bookmarked - it's a shame, as the PDF that most interests me (the actual TNT Basic command reference) is the one that hasn't yet been converted to PDF.

That said, it was using his PDF of the 'Introduction To Scrolling' along with Johns 'simple tile based scrolling example' that allowed me to work out the problems I was having with picture scrolling instead of map scrolling.

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.