You can do this a couple of different ways. One is to just create a large
lookup table with the values, and then copy them left one row at a time.
Then use those values to draw your color.
The other approach would be to create a texture (or surface in SDL 1.2.x)
that is larger the width of the screen (typically twice the width), and the
same height. Then you could draw your points into the surface/texture at
0,0…screenW-1,screenH-1 for the first time slice and copy that rect to the
screen texture/surface, draw the new column at screenW for the next time
slice, and copy from x=1, y=0 to x=screenW, y=screenH-1 for the next time
slice, etc.
Once you get to where you are filling the right most column, you would then
use the left most (wrapping around) for the next time slice. At that point
you will be doing two Blit’s or RenderCopy calls. One for the pixels up to
the right side of your surface, and another for the left strip.
The latter approach will probably yield the best performance, but frankly,
if you don’t have a lot of experience doing this type of split blit, you may
want to start with the first approach since it is conceptually much easier
to understand.
Ken> ----- Original Message -----
From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Behalf Of victor-victor
Sent: Thursday, January 27, 2011 6:17 AM
To: sdl at lists.libsdl.org
Subject: Re: [SDL] how to copy a point in SDL 1.3
Hello
There are two thinks actually; x and y coordinates and color; let me present
in its context.
I display frequency versus amplitude of the sound in a 2D surface (at z =
0); sound data’s arrive the speed, say, of 1sec; so every second the 2D
surface i’m talking about is updated. When it is updated, I want that
surface go behind “one step” at, say, z= -0.1, while the new sound analysis
is display at z = 0; then again what is is = -0.1 goes in z = -0.2, what is
in z = 0 goes in z = 0.1, and the new data are display in z = 0.
In other words, i’d like the 2D surface (x, y and color) be copied entirely
in another parallel surface with different z.
What i’m doing now is that i store in a table the maximum values of each y
of each curve, then copy it at the next step.
Thank you
Victor
View this message in context:
http://old.nabble.com/how-to-copy-a-point-in-SDL-1.3-tp30768528p30776741.htm
l
Sent from the SDL mailing list archive at Nabble.com.
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org