Author Topic: Vertical Scroller  (Read 2514 times)

0 Members and 1 Guest are viewing this topic.

Offline DrewPee

  • I Toast Therefore I am
  • Pentium
  • *****
  • Posts: 563
  • Karma: 25
  • Eat Cheese - It's good for you!
    • View Profile
    • Retro Computer Museum
Vertical Scroller
« on: November 17, 2007 »
Could anybody help me with a vertical scroller routine using tinyptc please?

I have done a scroller of sorts but really really not happy about it!  :whack:

Would it also be possible to enable a zoom function into this as well?

i.e. if a character is 8 pixels by 8 pixels (as my spectrum font is . . .) could i make this say 64 x 64 pixels instead (I know it would look blocky but this is something I have an idea for!).

Can anybody help me with this one please?

Thanks in anticipation . . .

Drew
DrewPee
aka Falcon of The Lost Boyz (Amiga)
Ex-Amiga Coder and Graphic Designer
Administrator of > www.retrocomputermuseum.co.uk

Offline DrewPee

  • I Toast Therefore I am
  • Pentium
  • *****
  • Posts: 563
  • Karma: 25
  • Eat Cheese - It's good for you!
    • View Profile
    • Retro Computer Museum
Re: Vertical Scroller
« Reply #1 on: November 17, 2007 »
Erm . . . ive just sorted out a vertical scroller (of sorts) now!!! lol!!!

I could do with help on the other matter though please?

Drew
DrewPee
aka Falcon of The Lost Boyz (Amiga)
Ex-Amiga Coder and Graphic Designer
Administrator of > www.retrocomputermuseum.co.uk

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Vertical Scroller
« Reply #2 on: November 17, 2007 »
If you're just using PTC and drawing pixels, then it's just a case of repeating each source pixel many times.
You might have
Code: [Select]
for y=0 to srcy-1
 for x=0 to srcx-1
  pix = srcgfx[x+y*srcx]
  for h=0 to yscale-1
   for w=0 to xscale-1
    screen[dstx+w+(dsty+h)*SCREENWIDTH]=pix
   next
  next
  dstx += xscale
 next
 dstx -= srcx*xscale
 dsty += yscale
next

Where xscale and yscale are the x and y repeat counts, so you might want 8 and 8 for a 64x64 graphic, and dstx, dsty are the screen position of the sprite, scrx and srcy are the source size (8,8), and SCREENWIDTH is the screen width.

(Code untested)

Jim
Challenge Trophies Won: