Sign in to follow this  

System cursor drawing along with DX9 Cursor

This topic is 2008 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

II am setting up a DX9 cursor like this...
[CODE]
public void SetHardwareCursor(string fileName) {
_cursorSurface = Surface.CreateOffscreenPlain(Device, 32, 32, Format.A8R8G8B8, Pool.SystemMemory);
Surface.FromFile(_cursorSurface, fileName, Filter.None, 0);
Device.SetCursorProperties(new Point(0, 0), _cursorSurface);
}
[/CODE]

During each render look i am calling ...
[CODE]
Device.ShowCursor = true;
[/CODE]
Otherwise i get nothing, but now it seems like i am drawing the system cursor under my DX9 cursor and they flicker between each other. Iv tried to find any help with this, but to no avail. Any help? Do i need to add more info?

Share this post


Link to post
Share on other sites
Iv been able to get rid of the system cursor Form.Cursor.Dispose();, but im still getting some flicker as i move the mouse around. Any clue?

Share this post


Link to post
Share on other sites
Hello.
Have you tryed setting the apps window cursor to NULL.
or intercept the message [size="2"][color="#008000"]WM_SETCURSOR[/color][/size]
[size="2"][color="#008000"][size="2"][color="#008000"]case WM_SETCURSOR: [/color][/size][/color][/size]
[size="2"][color="#008000"][size="2"][color="#008000"]{[/color][/size][/color][/size]

[size="2"][color="#008000"][size="2"][color="#008000"]// only change the cursor when it''s within the client area [/color][/size][/color][/size]

[size="2"][color="#008000"][size="2"][color="#008000"]if(LOWORD(lParam) == HTCLIENT) [/color][/size][/color][/size]

[size="2"][color="#008000"][size="2"][color="#008000"] {[/color][/size][/color][/size]

[size="2"][color="#008000"][size="2"][color="#008000"]//base on some onover event for the mouse EG. over a unit or giving a path[/color][/size][/color][/size]

[size="2"][color="#008000"][size="2"][color="#008000"]SetCursor(MainAppPointer);[/color][/size][/color][/size]

[size="2"][color="#008000"][size="2"][color="#008000"] return TRUE;[/color][/size][/color][/size]

[size="2"][color="#008000"][size="2"][color="#008000"] }[/color][/size][/color][/size]

[size="2"][color="#008000"][size="2"][color="#008000"] return FALSE;[/color][/size][/color][/size]

[size="2"][color="#008000"][size="2"][color="#008000"]}break;[/color][/size][/color][/size]

Share this post


Link to post
Share on other sites
[quote name='ankhd' timestamp='1340613257' post='4952592']
Hello.
Have you tryed setting the apps window cursor to NULL.
or intercept the message [size=2][color=#008000]WM_SETCURSOR[/color][/size]
[size=2][color=#008000]case WM_SETCURSOR: [/color][/size]
[size=2][color=#008000]{[/color][/size]

[size=2][color=#008000]// only change the cursor when it''s within the client area [/color][/size]

[size=2][color=#008000]if(LOWORD(lParam) == HTCLIENT) [/color][/size]

[size=2][color=#008000]{[/color][/size]

[size=2][color=#008000]//base on some onover event for the mouse EG. over a unit or giving a path[/color][/size]

[size=2][color=#008000]SetCursor(MainAppPointer);[/color][/size]

[size=2][color=#008000]return TRUE;[/color][/size]

[size=2][color=#008000]}[/color][/size]

[size=2][color=#008000]return FALSE;[/color][/size]

[size=2][color=#008000]}break;[/color][/size]
[/quote]

Not sure how to accomplish this in C# with SLimDX, this is starting to bother me, i tried to put off fixing it, but now i really need to get it working.

Share this post


Link to post
Share on other sites
Honestly, I've found the DirectX cursor to be glitchy and kindof laggy and I've had better results with the system cursor.

I use LoadImage and SetCursor to load up a full colour custom cursor, created in 'RealWorld Cursor Editor' ([url="http://www.rw-designer.com/cursor-maker"]http://www.rw-design...om/cursor-maker[/url]). I think you'll also need to respond to WM_SETCURSOR for everything to work right. The only problem I'm aware of is a maximum size of 32x32 pixels.

Share this post


Link to post
Share on other sites
[quote name='Geoffrey' timestamp='1342180764' post='4958758']
Honestly, I've found the DirectX cursor to be glitchy and kindof laggy and I've had better results with the system cursor.

I use LoadImage and SetCursor to load up a full colour custom cursor, created in 'RealWorld Cursor Editor' ([url="http://www.rw-designer.com/cursor-maker"]http://www.rw-design...om/cursor-maker[/url]). I think you'll also need to respond to WM_SETCURSOR for everything to work right. The only problem I'm aware of is a maximum size of 32x32 pixels.
[/quote]

I looked into that, but i was reading it didnt do full color cursors...i read somethign about it needing to be black and white.

This says one thing
[url="http://msdn.microsoft.com/en-us/library/system.windows.forms.cursor"]http://msdn.microsoft.com/en-us/library/system.windows.forms.cursor[/url]

This says somethign else...
[url="http://msdn.microsoft.com/en-us/library/system.windows.input.cursor"]http://msdn.microsoft.com/en-us/library/system.windows.input.cursor [/url]

Share this post


Link to post
Share on other sites
[quote name='JWBaker' timestamp='1342188032' post='4958792']
I looked into that, but i was reading it didnt do full color cursors...i read somethign about it needing to be black and white.
[/quote]

I believe that was the case a *long* time ago. But I've tested a full colour system cursor on Windows 7, Vista, XP and 98 so I don't think you'll have any problems!

Share this post


Link to post
Share on other sites
[quote name='Geoffrey' timestamp='1342189128' post='4958800']
[quote name='JWBaker' timestamp='1342188032' post='4958792']
I looked into that, but i was reading it didnt do full color cursors...i read somethign about it needing to be black and white.
[/quote]

I believe that was the case a *long* time ago. But I've tested a full colour system cursor on Windows 7, Vista, XP and 98 so I don't think you'll have any problems!
[/quote]

Ok, ill give it another look, thanks!

Share this post


Link to post
Share on other sites
I ended up having to import a native function to do this correctly...Stack Overflow saved me, but not until spending forever searching. Thanks for the help you pointed me int eh right direction
[url="http://stackoverflow.com/questions/6897274/c-how-to-load-cursor-from-resource-file"]http://stackoverflow.com/questions/6897274/c-how-to-load-cursor-from-resource-file[/url]

Share this post


Link to post
Share on other sites
Still some issues with this, the mouse is perfect as long as my presentinterval is set to immediate (ie no vsync) but if i enable default or one the the mouse movement becomes unbearably jumpy. Is there a fix for this?

Share this post


Link to post
Share on other sites
It seems my issue involves dual monitors :/

[url="http://forums.create.msdn.com/forums/p/98767/588184.aspx"]http://forums.create...767/588184.aspx[/url]

If i turn off my second monitor and/or go into windowed mode everything is perfect...It seems a combo of 2screens and fullscreen causes input events to cause massive slowdown in how the game renders just like the above poster, but i am using SlimDX not XNA 0.o Edited by JWBaker

Share this post


Link to post
Share on other sites
Sign in to follow this