MouseMove事件绘画太慢 [英] MouseMove event too slow for painting

查看:466
本文介绍了MouseMove事件绘画太慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用C#的WinForms营造一个建设者我的XNA游戏。我有一个平铺网格,你可以用铅笔工具作画,就像在MSPAINT。问题是,当你拖动鼠标快(ISH)画一条线砖得到跳过。

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.

任何想法?

推荐答案

OTTOMH,你可以跟踪的最后点鼠标是和你的MouseMove处理程序,你可以假设直线运动,并确定最后一个点之间所有的瓷砖和当前点。我的猜测是,你不可能永远得到足够的MouseMove事件触发处理,用户非常迅速地移动他的鼠标的情况下。

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.

这篇关于MouseMove事件绘画太慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆