Page 1 of 1

HideMouse(1)

Posted: Fri Sep 13, 2024 11:00 am
by SPH
Hi, :D

I would like to hide the mouse to make way for an improved arrow sprite. ChatGPT tells me that we can use HideMouse(1) but this instruction does not exist/no longer exists.
What instruction should I use (no API please because it must be Linux compatible)?

Many thanks for this insignificant problem... :shock:

Re: HideMouse(1)

Posted: Fri Sep 13, 2024 11:21 am
by RASHAD
Maybe you can use ReleaseMouse(State)

Re: HideMouse(1)

Posted: Fri Sep 13, 2024 11:54 am
by SPH
Ho, thank you

It had to be put with an examinemouse() !


Thx

Re: HideMouse(1)

Posted: Fri Sep 13, 2024 11:58 am
by RASHAD
You are welcome :)

Re: HideMouse(1)

Posted: Fri Sep 13, 2024 1:00 pm
by moulder61
@SPH

I might be misunderstanding what you are trying to do, but it sounds a bit like the problem I had trying to convert Puzzle of Mystralia to work in Linux and had 2 cursors showing? The original plus your custom one.

In that case, ExamineMouse() would hide the standard cursor, but then you lost the use of the mouse. Not ideal in a mouse based game!

ReleaseMouse(#True) restores both the usage of the mouse and the standard cursor too, so you're no better off.

I found some code on the forum that solved the problem perfectly, but trimmed it down to just the necessary to get the job done.
It was from a post by Shardik. viewtopic.php?p=525626#p525626

This is what I ended up with.

Moulder.

Code: Select all

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Added code to hide cursor in Linux
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#GDK_BLANK_CURSOR = -2

ImportC ""
  gtk_widget_get_window(*Widget.GtkWidget)
EndImport
Cursor = gdk_cursor_new_(#GDK_BLANK_CURSOR)

gdk_window_set_cursor_(gtk_widget_get_window(WindowID(win)), Cursor)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Re: HideMouse(1)

Posted: Fri Sep 13, 2024 1:37 pm
by Axolotl
Hi,
on windows you can use ShowCursor_(#False)
MSDN:

Code: Select all

int ShowCursor(
  [in] BOOL bShow
);
MSDN ShowCursor()

Sorry, I must have missed that he needs a Linux solution.

Re: HideMouse(1)

Posted: Fri Sep 13, 2024 2:02 pm
by moulder61
@Axolotl

Those commands don't work on Linux, so I had to find a way around it.

SPH mentioned he wanted it compatible with Linux, but my fix probably makes it incompatible with Windows? Doh!

Moulder.