Page 1 of 1

Recording mousemovements

PostPosted: Jan 3, 2004 @ 5:51pm
by kaiton
Hi!

Ive created a little game(Kai-Bong):
http://www.pocketmatrix.com/forums/view ... 9&start=15

Now, some people would like a replay function.
What's the best way to record the mouse/pen- movements?
I had this in my mind:
a C-struct:

t=struct{
TIME t
POINT p
}

And onmousemove a new variable of this struct
in an linked list.

Is that a good idea?

PostPosted: Jan 3, 2004 @ 6:27pm
by StephC
Why a linked list ?

PostPosted: Jan 5, 2004 @ 6:58pm
by BIGBEN

PostPosted: Jan 5, 2004 @ 8:07pm
by wyrd

PostPosted: Jan 5, 2004 @ 9:51pm
by Presto
The vector doesn't have to grow every time you add an item. You can allocate it in blocks, if I'm not mistaken. So you could allocate room for 100 records, and when that fills up, it'll automatically free space for up 100 more, etc. I haven't tried this myself, but I've read about it... Having to rebuild the list every time would most definitely be terrible for performance.

PostPosted: Jan 5, 2004 @ 9:55pm
by mlepage
Vector has exactly the same order of operations for growing as linked list. Anyone using the STL should know this. If you are using the STL and you do not, then you need to take a minute to brush up on the performance guarantees of the various operations on the various containers. If you are not using the STL, and particularly if you labour under the misconception that some containers and operations are slower than they actually are, then you need to start using the STL.

PostPosted: Jan 5, 2004 @ 10:41pm
by wyrd