Reputation: 149
I'm using C# WinForms to create a level builder for my XNA game. I have a tile grid that you can paint with a Pencil tool, like in MSPaint. The problem is that when you drag the mouse fast(ish) to paint a line tiles get skipped.
I've tried using one approach i saw on Google saying to spawn a thread to do the painting, but that didn't seem to help.
Any ideas?
Upvotes: 5
Views: 3799
Reputation: 149
Awesome! worked perfectly.
I used the DDA line algorithm from here
http://www.cs.unc.edu/~mcmillan/comp136/Lecture6/Lines.html
to draw the line.
Thanks!!
Upvotes: 2
Reputation: 25396
OTTOMH, you could keep track of the last point the mouse was and in your MouseMove handler you can assume linear motion and determine all the tiles between the last point and the current point. My guess is that you're not likely to ever get enough MouseMove events to fire to handle the case where the user moves his mouse very quickly.
Upvotes: 6