On screen cursor

I would like to hear from you about the following implementation of ac cursor in the various platforms.

  1. Mobile: no cursor at all.

  2. Consoles: cursor as a go moved on screen via the analog left stick of the controller.

  3. PC: hardware cursor with custom icon (set using defos), the cursor is moved via the mouse. If there is a controller attached then also the left stick of the controller moves the mouse as long as the mouse is inside the game window (also this is implemented using defos).

Thanks for any advice! Ciao!

1 Like

This works, although for 3 with a gamepad what we do is switch to the console/gamepad cursor on gamepad movement, and switch back on mouse movement. You might also want to support gamepads on mobile (I’ve not tested that but they do exist and are popular for some genres there) and then use 2 in addition to touch.

1 Like

@Pkeod thanks!

Yes, for mobile I have also the go-mouse via controller if attached.

But let me see if I understand correctly what you say about PC. You have a go-cursor (and the hardware cursor); one of them is shown on screen at any moment. If there is a mouse input then the hardware cursor is used (and the go-cursor is disabled), whereas if there is an input via the left-stick then the go-cursor is enabled and the hardware cursor is hidden. Is this your design? If so, what happens if there is both input: left-stick and mouse movement?

1 Like

We do not support controllers on mobile (but it is something we definitely want to support going forward)!

2 Likes

We use a GUI node for the gamepad cursor on PC with the GUI scene at the very top number render order.

If there is both movement we favor the mouse.

Make sure you have good dead zone amounts since if it’s too low you can have cursor drift that will annoy people with old gamepads connected. You may also want to display some hint that gamepad input is being selected when switching.

1 Like

Yes, we have the same behaviour in Interrogation.

  1. When using touch (no way to differentiate between touch and mouse in Defold right now, so we just assume touch on mobile and Switch), no cursor is shown, no gamepad prompts

  2. When using mouse, hardware cursor is shown, no gamepad prompts

  3. When using gamepad, hardware cursor is hidden, software cursor is shown as a game object, gamepad prompts are shown.

Hardware cursor is moved using DefOS when switching between software/hardware cursors to maintain a continuity.

3 Likes

Many many thanks @britzl @Pkeod @dapetcu21.

About PC. In order to keep the aspect ratio above a minimum I have implemented letterboxing (top and bottom black rectangles to adjust for an aspect ratio less than (say) 1.2) (see here Aspect ratio control). The letterboxing uses a smaller viewport, hence I cannot draw a go-cursor. So, my question is: why implementing also a go-cursor (and the hardware-go switching) and not just continuously update the hardware cursor position (via defos) when there is a controller input?

GUI nodes can draw above that and still look like a normal cursor. You can ensure the scaling is always 1:1 too by knowing the scale ratio.

Setting the hardware cursor position via gamepad input may be fine but it’s just not the pattern some of us use. You’ll need to test and see if any problems appear.

1 Like

thanks @Pkeod

I have already implemented this only-hardware-scenario and it seems to run fine. On the other hand I have never used gui in Defold and would prefer to avoid learning other api. (I am more minimalistic than Defold is :sweat_smile: )

2 Likes

The reason for us was because we wanted a larger gamepad cursor than the hardware cursor we already got (which has size constraints on some platforms). But I guess if it works for you, then I see no problems.

Also, I don’t mind the software cursor being clipped when it reaches the edges of the viewport (in Interrogation that’s even less of a problem due to the full screen vignette that eases the transition around the edges of the viewport).

2 Likes