Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [BUG?] Multiple calls to SetRawMouseVisible()

Author
Message
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 21st Feb 2018 11:29
Hello I have multiple calls to SetRawMouseVisible(). I call it at the start of my app setting it to 1 or 0 depending on saved settings. I then have an options menu where you can toggle window/fullscreen window which also toggles SetRawMouseVisible(), and it doesn't work unless I remove the call to SetRawMouseVisible() at the start of my app. Also, calling SetRawMouseVisible(1) twice (right after each other) also breaks SetRawMouseVisible functionality. I am using Windows 7 x64, Intel CPU and Nvidia GFX.
13/0
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 21st Feb 2018 20:35 Edited at: 21st Feb 2018 20:37
Having quickly checked this...your right and I have get similar results.... and it is a bug.

However, two calls to SetRawMouseVisible(1) can be undone by two calls to SetRawMouseVisible(0)

It returns the function to working again so it would seem like it doesnt break but works in some weird cumulative fashion. Quite odd.
(Windows 10 x64, Intel CPU and Nvidia GFX here too)

Simply storing your own internal variable and then only calling the SetRawMouseVisible() when it has to be changed is a quick workaround.
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 22nd Feb 2018 10:06
Thanks Bengismo
13/0
Preben
AGK Studio Developer
20
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 22nd Feb 2018 12:58
Yes this is how it works in windows , it has a mouse visible counter per window, so if you call SetRawMouseVisible(0) 3 times you have to call SetRawMouseVisible(1) 3 times to get the mouse visible counter down. This is how windows works and is not a bug in AppGameKit , also it works different in Mac/Linux , and can give different results if you also switch to fullscreen. The only way i found that seams to always work on all platforms is this:


or:


Looks strange but works on all platforms , even if you also change fullscreen in the same sync.


Subscribe and checkout great AppGameKit video's here: Videos click here
Latest GameGuru Loader news: News click here
Get GameGuru Loader PBR version here: Steam click here
best regards Preben Eriksen,
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 22nd Feb 2018 13:17
Yes, that is how it works on windows ....but its not how AGK's documentation explains it. The documentation simply gives 1 for show or 0 for hide.

At the least AppGameKit should only make a call the windows ShowCursor() once in either direction to hide or show the cursor and then do nothing on further calls of of the AppGameKit SetRawMouseVisible() function so that the AppGameKit functions will always work.

Either that or the documentation for SetRawMouseVisible() should be updated to reflect that it is simply wrapping a win32 function and explain that a counter is used.
Preben
AGK Studio Developer
20
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 22nd Feb 2018 13:30
Yes guess Paul could loop it until GetCursorInfo is actually visible or not visible , then there is only the Mac problem , it will not work while the "going from window to fullscreen animation" is playing , so i also had to call it multiply times with the sync to make it work on mac , but perhaps there is also a way on mac to loop it for Paul
Subscribe and checkout great AppGameKit video's here: Videos click here
Latest GameGuru Loader news: News click here
Get GameGuru Loader PBR version here: Steam click here
best regards Preben Eriksen,

Login to post a reply

Server time is: 2024-11-24 00:47:39
Your offset time is: 2024-11-24 00:47:39