Jump to content

  • Log In with Google      Sign In   
  • Create Account


System cursor drawing along with DX9 Cursor


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
10 replies to this topic

#1 JWBaker   Members   -  Reputation: 235

Like
0Likes
Like

Posted 21 June 2012 - 08:06 PM

II am setting up a DX9 cursor like this...
		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);
		}

During each render look i am calling ...
Device.ShowCursor = true;
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?

Sponsor:

#2 JWBaker   Members   -  Reputation: 235

Like
0Likes
Like

Posted 23 June 2012 - 12:54 PM

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?

#3 ankhd   Members   -  Reputation: 1068

Like
0Likes
Like

Posted 25 June 2012 - 02:34 AM

Hello.
Have you tryed setting the apps window cursor to NULL.
or intercept the message WM_SETCURSOR
case WM_SETCURSOR:
{

// only change the cursor when it''s within the client area

if(LOWORD(lParam) == HTCLIENT)

{

//base on some onover event for the mouse EG. over a unit or giving a path

SetCursor(MainAppPointer);

return TRUE;

}

return FALSE;

}break;

#4 JWBaker   Members   -  Reputation: 235

Like
0Likes
Like

Posted 12 July 2012 - 06:17 PM

Hello.
Have you tryed setting the apps window cursor to NULL.
or intercept the message WM_SETCURSOR
case WM_SETCURSOR:
{

// only change the cursor when it''s within the client area

if(LOWORD(lParam) == HTCLIENT)

{

//base on some onover event for the mouse EG. over a unit or giving a path

SetCursor(MainAppPointer);

return TRUE;

}

return FALSE;

}break;


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.

#5 Geoffrey   Members   -  Reputation: 499

Like
0Likes
Like

Posted 13 July 2012 - 05:59 AM

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' (http://www.rw-design...om/cursor-maker). 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.
The Trouble With Robots - www.digitalchestnut.com/trouble

#6 JWBaker   Members   -  Reputation: 235

Like
0Likes
Like

Posted 13 July 2012 - 08:00 AM

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' (http://www.rw-design...om/cursor-maker). 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.


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
http://msdn.microsoft.com/en-us/library/system.windows.forms.cursor

This says somethign else...
http://msdn.microsoft.com/en-us/library/system.windows.input.cursor

#7 Geoffrey   Members   -  Reputation: 499

Like
1Likes
Like

Posted 13 July 2012 - 08:18 AM

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.


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!
The Trouble With Robots - www.digitalchestnut.com/trouble

#8 JWBaker   Members   -  Reputation: 235

Like
0Likes
Like

Posted 13 July 2012 - 09:37 AM


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.


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!


Ok, ill give it another look, thanks!

#9 JWBaker   Members   -  Reputation: 235

Like
0Likes
Like

Posted 13 July 2012 - 08:40 PM

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
http://stackoverflow.com/questions/6897274/c-how-to-load-cursor-from-resource-file

#10 JWBaker   Members   -  Reputation: 235

Like
0Likes
Like

Posted 18 July 2012 - 08:36 AM

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?

#11 JWBaker   Members   -  Reputation: 235

Like
0Likes
Like

Posted 18 July 2012 - 05:47 PM

It seems my issue involves dual monitors :/

http://forums.create...767/588184.aspx

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, 18 July 2012 - 06:09 PM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS