Archived

This topic is now archived and is closed to further replies.

HellRaiZer

DirectX Input Question -> Mouse Filtering.

Recommended Posts

I''m making a game engine and i have a question about the DirectX Mouse Input.Is there a way to make linear filtering of the mouse? I ask that because the mouse movement is little ugly. I found in the Fluid Studio''s site a demo with DirectX linear filtering.Can anyone tell me how to do that? Please answer. Thanks in advance.

Share this post


Link to post
Share on other sites
You could always just store the values read and then just mean them out. That is one way of smoothing the mouse.

i.e. (this is from my head so may have compile errors but gives general idea)

#define SMOOTH_MAX 10

class Mouse ..
{
LONG m_Read[SMOOTH_MAX];
LONG m_Current;
}

LONG Read()
{
m_Read[m_Current] = m_Mouse.LX (for example) // Mouse Read Value

LONG lCount = 0; // Add Up All Values Read & Mean
for (INT i=0; i< SMOOTH_MAX; i++){
lCount += m_Read;
}
lCount /= SMOOTH_MAX;

if (m_Current ++ >= SMOOTH_MAX) // Increment Counter
m_Current = 0;

return lCount;

}

Share this post


Link to post
Share on other sites