HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: New SetCursor issues  (Read 966 times)

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
New SetCursor issues
« on: Jul 09, 15, 09:50:52 PM »

In a previous post I mentioned that SetCursorVisibility() does not seem to work unless it is set to the default cursor via SetCursor("").  That is still apparently the case.

But I had a work-around where in onCmdStart() of Input_Camera, when the DragRotate command was given, I would first call SetCursor("") then set it to invisible, and in OnCmdStop() set the cursor back to our custom one and make it visible again.

But recently (in the last month or so) the cursor stopped hiding when we rotate the camera.  I didn't have time to investigate until now, and here is what I found:

By running SetCursor("") off of a key command, I saw when I called that the cursor image only changed after I moved the cursor.  So I added in code that after calling SetCursor("") SetCursorPosition() was used to move the cursor a little.  That works off of a key command.  But it still did not work when I rotated the camera.   Looking at the difference between the commands, I saw that the key command was called in onCmdStop while the mouse command was in onCmdStart.  But if I put the key command in onCmdStart, it still worked.

So after I removed all of the commands from the mouse, the cursor still would not change when using the mouse.

As best I can tell, SetCursor("") does not reset the cursor image from a custom one (even when moving the cursor) while a mouse button is being held.  After releasing the mouse button, the image would finally change.

However, SetCursor() with a valid, non-empty FQN does change the image even while a mouse button is held.  So instead of using SetCursorVisibilty(false), we are using SetCursor() with a blank cursor image, and that seems to be working well.  So, we have a correctly disappearing cursor now, but thought I'd mention the issues with resetting the cursor.  Incidentally, we used a PNG image that is just a single transparent pixel, and it is fine.
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: New SetCursor issues
« Reply #1 on: Jul 10, 15, 12:23:54 AM »

I just found through further testing that it is very important that when SetCursor() is called to set it to the blank cursor it must be done before calling SetIgnoreCursor(true), and also only do those two functions if not GetIgnoreCursor().  If the cursor is already ignored when the cursor is changed, I was finding that the cursor would disappear never to return until I restarted the client.
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.