Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Steve's basic SIN/COS Tutorial
#3
(05-16-2024, 10:08 PM)grymmjack Wrote: This is cool! I need to read up on how you made a scrolling console window like that.

This is nifty @SMcNeill

I haven't read the tutorial because I just got off of work and my brain is fried and I'm tired.

I will read it some day when I need to understand more about COS and SIN.

The scrolling window isn't anything impressive, once you learn the secret behind it.  I tend to lazily make use of stufff like this in a lot of different programs.   Here's the trick:

ts = _NewImage(800, 6000, 32)
ws = _NewImage(800, 600, 32)
Screen ws

_Dest ts

Two screens -- ts (temp screen) and ws (work screen). If you notice, ws is the actual screen that we display and show to the user, while ts is the screen that we work with, and which all our PRINT/COLOR/LINE/ect statements take place on.

(also notice that the temp screen (ts) is the same width, but 10 times longer than the display screen (ws).)

...

And, in our main program loop, we have this little tidbit which rounds out the process:

_PutImage (0, 0)-(800, 600), ts, ws, (0, y)-Step(800, 600)

We basically take a segment of the tempscreen (ts) and place it on the workscreen (ws), starting at whatever Y position we want for that tempscreen.

So if y is 0, the work screen is showing (0,0)-(800,600).... The top of the temp screen.

Press the down arrow, increment Y by 100, and not the work screen is showing (0,100)-(800,700)... The temp screen scrolled down that 100 pixels.



That's honestly all there is to that simple little voodoo trick! Quick. Easy to set up and implement. And useful as heck in organizing and displaying longer screens of text than what you can normally display on a single screen.

Nothing tricky at all to learn here. It's just a very simple little putimage of a portion of a longer image onto a shorter one, without any scaling/stretching or whatnot affecting things. Smile
Reply


Messages In This Thread
Steve's basic SIN/COS Tutorial - by SMcNeill - 05-10-2024, 09:35 AM
RE: Steve's basic SIN/COS Tutorial - by grymmjack - 05-16-2024, 10:08 PM
RE: Steve's basic SIN/COS Tutorial - by SMcNeill - 05-16-2024, 10:41 PM
RE: Steve's basic SIN/COS Tutorial - by Pete - 07-12-2024, 01:57 AM
RE: Steve's basic SIN/COS Tutorial - by vince - 07-12-2024, 06:53 PM



Users browsing this thread: 1 Guest(s)