Dark Bit Factory &  Gravity

Dark Bit Factory & Gravity

  • September 09, 2010 *
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

Pages: [1]   Go Down

Author Topic: Sinus scrolling done right?  (Read 272 times)

0 Members and 1 Guest are viewing this topic.

Pixel_Outlaw

  • Pentium
  • *****
  • Karma: 68
  • Offline Offline
  • Posts: 1206
    • View Profile
Sinus scrolling done right?
« on: January 26, 2008 »


I know how to make my text flow in sin() waves but my question is how to do it "correctly".

How do you usually pair this with scrolling text?

What is the method used most commonly to make your scrollers wrap around the screen?

How do you avoid slowdown when you are drawing say 20 sentences?

That is alot to ask at once but I would like to start with the best solution rather than poke around in the dark on this one.
Logged

Shockwave

  • good/evil
  • ADMIN
  • Senior Member
  • ********
  • Karma: 357
  • Offline Offline
  • Posts: 15098
  • evil/good
    • View Profile
    • WWW
Re: Sinus scrolling done right?
« Reply #1 on: January 26, 2008 »
Slowdown should not really be a problem on todays computers, the method behind a sine scroll is straight forward.

If you view your letter as a bitmap:

Code: [Select]
  #####
#######
##      ##
#######
##      ##
##      ##

It is made out of rows and columns.
In most programming languages/apis there is usually a method that allows you to cut a rectangle out of a bitmap and draw it.

So for the letter "a" above the program would need to  chop it up into vertical slices which can then be drawn in the right position.

Sin is straight forward;

n=sin(theta)

Returns a value in n between -1 and +1 depending on the angle you feed it (theta).

you can transform this into something more useful;

y=(99*sin(theta)) + 100

Produces a large sine wave that ranges from the top of the screen to about 200 pixels down.

So it's really a matter of chopping those letters up and drawing them in the right place. On the Amiga, they were done using the Blitter chip, you could set up a "blitter window" and move this around as you were blitting the letters.

There are dozens of sine scrollers here, if you need more help please ask :)
Logged
Shockwave ^ Codigos....  Error: Keyboard not attached.... Press F1 to continue.
Pages: [1]   Go Up
 

 

B l a c k R a i n V.2 by C r i p

Page created in 0.12 seconds with 18 queries.