BASIC

Author Topic: Endless Horizontal Scrolling Code  (Read 6009 times)

Offline mrplant

  • Mr. Polyvector
  • ***
  • Posts: 232
    • View Profile
Re: Endless Horizontal Scrolling Code
« Reply #15 on: 2012-Jan-04 »
Hi Slydog..

A fantastic routine you have written there. It runs great on PC. Mac and iPad!

I added some iOS auto rotation code for iPad and it handles it all great.

Seems much more stable than my original Objective-C and first GLBasic version.

The iPad seems able to handle the 2048 pixel wide images no problem, glad to report.

Well, iPad 2 anyway - still to test on an iPad1.

Incidentally, I added a 6 pixel high vertical coloured line at both edges of each section and did the same in a different colour at the edges of the 2nd section etc.

The good news is I took screenshots and zoomed in and the pixels met perfectly, meaning your routine seems to be joining up perfectly!

I wish I understood more about what Polyvector is doing.

I'll get there..

Regards

Mr Plant.

Offline Slydog

  • Prof. Inline
  • *****
  • Posts: 930
  • KodeSource
    • View Profile
    • KodeSource
Re: Endless Horizontal Scrolling Code
« Reply #16 on: 2012-Jan-06 »
Great!  It seems together perfectly!  (or appears to!)
But, I found a bug when it checks xPos for the start/end, it was one screen width off.
I updated the .zip file in my previous post.

It just so happens that the 1st and 3rd image have the same picture if you overlapped them one screen width.
The original yellow line should have scrolled out of view (when direction=1), but instead it suddenly skips to the 1st image, but was unnoticable as it was the same graphic.

Here's the udpated section:
Code: GLBasic [Select]
        IF direction = 1
                IF xPos >= BackgroundWidth THEN xPos = 0
        ELSE
                IF xPos < 0 THEN xPos = BackgroundWidth - 1
        ENDIF
 
« Last Edit: 2012-Jan-06 by Slydog »
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

Offline mrplant

  • Mr. Polyvector
  • ***
  • Posts: 232
    • View Profile
Re: Endless Horizontal Scrolling Code
« Reply #17 on: 2012-Jan-08 »
Thanks again Slydog..

I hadn't noticed that but glad you found and fixed it - ran your code and its flying by very nicely and smoothly and all your test lines line up perfectly..

Ps. Where is best place to learn all about Polyvector and its use? Manual doesn't go into it in detail and I can guess why!

Why is it so much better than Drawsprite etc? I am taking it the answer is because it is a low level accelerated OpenGL feature?

Thanks again.

mr p.