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

Author Topic: Hiding Cursor in HSL  (Read 622 times)

Ratchet_Dev

  • General Accounts
  • *
  • Posts: 15
  • Ummm... yes?
    • View Profile
    • Omnivoid Site
Hiding Cursor in HSL
« on: Apr 30, 16, 02:35:57 PM »


Hello,
Does anyone know what the default Hide Cursor command is in HSL?


I'm using this script that gets called when a comma or period is pressed, and it has debugging.



It does call (as shown below in the console) but does not actually hide the cursor.

Does anyone know the actual code to hide and lock the cursor to the center, as I have had no luck so far on the Wiki.
Logged
IF YOU NEED ANY HELP PLEASE PRIVATE MESSAGE ME!

Lead Programmer for OmniVoid & CEO of Shattered Studios.

Thazager

  • General Accounts
  • *
  • Posts: 1129
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: Hiding Cursor in HSL
« Reply #1 on: Apr 30, 16, 07:48:09 PM »

A few ideas I had a by looking thru the code in _CursorClassMethods.

public function CursorDisplay()
    $Cursor._setCustomCursorEnabled(true)
    cursor as NodeRef of Class GUIControl = $Cursor._getCustomCursor()
    cursor.visible = true
.

public function CursorHide()
    $Cursor._setCustomCursorEnabled(true)
    cursor as NodeRef of Class GUIControl = $Cursor._getCustomCursor()
    cursor.visible = false
.


// or move cursor off screen to hide

  position as Vector3 = GetMousePosition()
  where cursor is kindof GUIControl
    cursor.position.x = -100 // off screen
    cursor.position.y = -100 // off screen
  .
Logged

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1405
    • View Profile
    • Forever Interactive, Inc.
Re: Hiding Cursor in HSL
« Reply #2 on: Apr 30, 16, 08:05:18 PM »

I believe the $Cursor system node usage is if you are using software cursors (i.e. drawn by the gui system) but does not affect hardware cursors (the built-in Windows system).

Are you using a custom hardware cursor via SetCursor()?  Because for some unknown reason, SetCursorVisibility(false) only works for the default Windows cursor, which is set via SetCursor("").

We use multiple custom cursors.  Previously we tried setting to the default cursor when we wanted to hide it, but it was not always consistent.  What we ended up doing to ensure it always works is to upload a fully transparent PNG image (1 pixel square works fine) as a blank "cursor", then when we want to hide the cursor we use SetCursor() to set it to our blank one.  Thus we are not using SetCursorVisibility().

Important Note: If you do use SetCursor() like we did, and pair it with a call to SetIgnoreCursor(), you MUST call SetCursor() BEFORE SetIgnoreCursor(), or we found that sometimes the cursor would become lost and no longer reappear.  A lot of frustrating trial-and-error to figure out that bug. :'(
« Last Edit: Apr 30, 16, 08:06:57 PM by FI-ScottZ »
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.