Reputation: 35
I am trying to code custom cursor graphics for Windows 8
. I will use it for an application which uses one or any number of Wiimotes
to send touch input to Windows
, which means I need to be able to display several cursors
. I can not use the build in cursor
for touch because they are very hard to see when it is viewed from a distance.
Currently I am using a separate transparent window for each cursor on which I draw the cursor graphics with DirectX
, but for the actual re-positioning of the cursor
I move the window to the current cursor
position by using the win32
methods SendMessage
and SetWindowPos
. This will result in a near zero latency for re-positioning, but it will use unreasonable amount of process time. Sometimes near 30%
when moving several cursors at the same time.
What I initially tried was drawing to a transparent window covering the whole screen. I've tried both a WPF
window with re-positioning of shapes on a Canvas, and drawing directly to the D3D
DirectX
instance of Desktop Window Manager
and re-position by changing transform matrixes
. These will result in some very annoying milliseconds of latency.
How do I draw on screen, a cursor
which will move with low latency and low CPU
?
Upvotes: 1
Views: 222
Reputation: 1516
If you're using D3D / DirectDraw.
Double buffering is known to cause input lag, triple causes even more. And if you take VSYNC into account then the process would block for even as much as 20 ms.
That means you will have a 20ms gap between the input events.
Double/Tripple buffering aren't usually the problem 'cause VSYNC blocks for 2000% the time required to render the screen.
Because normally it takes 1-2 ms to render the screen but 17-24 ms waiting for VSYNC.
For example [c++]:
- Take a look here .
Upvotes: 3