[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.drawing

Storing Point in ArrayList

Retoro

10/15/2004 4:35:00 PM

I amy capturing Points in an ArrayList in the following way.

MouseDown: begin capturing points in a new ArrayList
MouseMove: add Points to ArrayList
MouseUp: Add Point ArrayList to an ArrayList of Lines and clear the Point
ArrayList

The problem is that after adding a couple lines in the Line ArrayList each
Line has the identical to the last line drawn. It seems my Line ArrayList
keeps some type of handle
on my Point ArrayList so when I clear the Point ArrayList it affects the
previous line?

I would like to clone the Point as it is added to my Point ArrayList but
cannot find such a way.

What to do ??



2 Answers

Retoro

10/15/2004 4:46:00 PM

0

I fixed this by re-initializing my Point ArrayList instead of calling the
..clear() method.

ie.
MyPointArrayList = new ArrayList();

"TJO" <no@spam.com> wrote in message
news:%235qG7TtsEHA.3076@TK2MSFTNGP09.phx.gbl...
>I amy capturing Points in an ArrayList in the following way.
>
> MouseDown: begin capturing points in a new ArrayList
> MouseMove: add Points to ArrayList
> MouseUp: Add Point ArrayList to an ArrayList of Lines and clear the Point
> ArrayList
>
> The problem is that after adding a couple lines in the Line ArrayList each
> Line has the identical to the last line drawn. It seems my Line ArrayList
> keeps some type of handle
> on my Point ArrayList so when I clear the Point ArrayList it affects the
> previous line?
>
> I would like to clone the Point as it is added to my Point ArrayList but
> cannot find such a way.
>
> What to do ??
>
>
>


Mario Lassnig

2/21/2008 10:01:00 AM

0

On Feb 20, 6:27 pm, Joni Toivanen <jomio...@gmail.com> wrote:
> Mario Lassnig wrote:
>
> > Hahaha, brilliant!
>
> > First try, without knowing what's going on:
>
> Well, I left all the available help a little vague on purpose, to leave
> at least something for people to figure out on their own, even in a
> simple game like this :)
>
> Don't worry, you should be able to figure out what is going on quite
> soon, and I'm sure that after a few more games you have quite a clear
> image of what the game is all about...
>
>
>
> > Alan's Psychedelic Journey Character Dump
> > -----------------------------------------
>
> > Alas, you were trampled to death by a lizard!
> > You scored -128 points!
> > Your journey lasted for 715 turns.
> > Your final health was 0/100
> > You ate 3 blue mushrooms,
> > 16 green mushrooms, and
> > 9 purple mushrooms on your way.
> > You had 1 enlightening visions.
> > You were left with 2 bottle(s) of beer!
>
> Gosh, now I really think I should have bothered to fix all of those
> plurals to singular if there is only one item/thing. They're ugly.
>
> And yeah, the lizards can be a pain, even if you know to expect them
> (did you notice the warning the game gives about them? ;), but by making
>   sure you have a few spare bottles of beer, you should be able survive
> them (and then there are some more creative ways of avoiding them)...
>
>
>
> > PS: Works flawlessly on MacOS X Leopard.
>
> Really? You mean it compiles with the existing makefiles without any
> trouble? I'm truly surprised if it does, since I must admit that I've
> never compiled a single line of code on a Mac (although, I think I
> really should try one of them out some day, I've heard plenty of good
> things about them lately...)
>
> But I guess if they have most of the GNU tools, or something similar
> enough, available then there shouldn't be too much trouble -- I actually
> noticed that the "makefile.inc" is written awfully from the point of
> portability, when I was trying to get the game to compile on AIX (nope,
> not mine, a university server which I have a shell access to)...

Yep, downloaded, called make, worked :-) I didn't try the SDL though.

> Cheers, and thanks for the feedback ;-)

De rien.