mtasa-blue icon indicating copy to clipboard operation
mtasa-blue copied to clipboard

showCursor bug can't disable cursor from another resource

Open Proxy-99 opened this issue 1 year ago • 14 comments

Describe the bug

use showCursor(true) in a resource folder

try to disable it from another resource folder

bindKey ("F", "down", function() 
		showCursor(false)
	end) 

won't work for some reason

Steps to reproduce

as described above

Version

Multi Theft Auto v1.6-release-22650

Additional context

No response

Relevant log output

No response

Security Policy

  • [X] I have read and understood the Security Policy and this issue is not security related.

Proxy-99 avatar Aug 11 '24 21:08 Proxy-99

Read #891

FileEX avatar Aug 11 '24 22:08 FileEX

Read #891

We need to fix that issue. For some reason the cursor is being managed by a resource and not game itself which is ridiculous.

Client\mods\deathmatch\logic\CResource.cpp

TracerDS avatar Aug 12 '24 08:08 TracerDS

Read #891

We need to fix that issue. For some reason the cursor is being managed by a resource and not game itself which is ridiculous.

Client\mods\deathmatch\logic\CResource.cpp

hope someone put the time and effort to fix this and add like isServerCursorEnabled() and check from it the cursor status

Proxy-99 avatar Aug 12 '24 12:08 Proxy-99

It's not a bug. Current behavior prevents additional cursor managment in scripts. You can use showCursor without thinking about other resources. Global behavior adds much pain for scripters.

It looks like you are doing something nasty, if you need this.

TheNormalnij avatar Aug 12 '24 17:08 TheNormalnij

It's not a bug. Current behavior prevents additional cursor managment in scripts. You can use showCursor without thinking about other resources. Global behavior adds much pain for scripters.

It looks like you are doing something nasty, if you need this.

Quite the opposite actually. If you need to show cursor depending on the state, you have isCursorShowing. Thats the point: to not care about other resources otherwise it causes chaos like in this case. Its completely pointless to have the cursor dependant on other resources instead of making it like a simple switch.

TracerDS avatar Aug 12 '24 18:08 TracerDS

It's not a bug. Current behavior prevents additional cursor managment in scripts. You can use showCursor without thinking about other resources. Global behavior adds much pain for scripters.

It looks like you are doing something nasty, if you need this.

Well, I have two resources one for login page and the other for lobby page I do not see why can't force it to works on others

Proxy-99 avatar Aug 12 '24 19:08 Proxy-99

If you need to show cursor depending on the state, you have isCursorShowing.

You should use events and binds to control the state. isCursorShowing has many edge cases.

Its completely pointless to have the cursor dependant on other resources instead of making it like a simple switch.

You can't have a simple switch, You need sync a moment when you can hide cursor in independent resources.

Simple case: You have two resources and they show independent windows. First resource uses binds to show/hide his window, second resource shows his window after onMarkerHit event and a player should fill some data to close it. You can't have a simple switch in first resource, because the switch soft locks a player.

There are many cases like this.

Current behavior is simplest solution, i see no reason for changes

TheNormalnij avatar Aug 13 '24 16:08 TheNormalnij

You should use events and binds to control the state. isCursorShowing has many edge cases.

like?

Simple case: You have two resources and they show independent windows. First resource uses binds to show/hide his window, second resource shows his window after onMarkerHit event and a player should fill some data to close it. You can't have a simple switch in first resource, because the switch soft locks a player.

if you properly utilise isCursorShowing then you wont soft lock any player.

TracerDS avatar Aug 13 '24 16:08 TracerDS

if you properly utilise isCursorShowing then you wont soft lock any player.

Only if you put this check with 'onClientRender' to show cursor when it returns false. And you need this check in every gui resource. Otherwise you can't be sure, when you are allowed to hide cursor.

like?

Chatbox, console, pause menu activate cursor.

TheNormalnij avatar Aug 13 '24 17:08 TheNormalnij

Only if you put this check with 'onClientRender' to show cursor when it returns false. And you need this check in every gui resource. Otherwise you can't be sure, when you are allowed to hide cursor.

huh? Why onClientRender?

Chatbox, console, pause menu activate cursor.

I mean, what are the edge cases? Can you explain them?

TracerDS avatar Aug 13 '24 17:08 TracerDS

huh? Why onClientRender?

Because there is no another option to do it with isCursorShowing in independent resources. If you know one, provide it. There is always a combination of opening and closing when your logic doesn't work. I've solved this issue by using reference counter in my gui library.

I mean, what are the edge cases? Can you explain them?

You can't control these menus and can't hide cursor when they are open (it's not allowed).

TheNormalnij avatar Aug 13 '24 17:08 TheNormalnij

Well, I have two resources one for login page and the other for lobby page I do not see why can't force it to works on others

When the login page shows the window, do showCursor(true) in the login resource. When it closes the window, do showCursor(false). Same with the lobby. And what is wrong with it in your case?

dmi7ry avatar Aug 14 '24 09:08 dmi7ry

Well, I have two resources one for login page and the other for lobby page I do not see why can't force it to works on others

When the login page shows the window, do showCursor(true) in the login resource. When it closes the window, do showCursor(false). Same with the lobby. And what is wrong with it in your case?

well after login you will be moved to lobby which you can't control the cursor so I have to use export or disable the cursor within login resource before loading the lobby page which is thing I do not like, simply you can't override showCursor(false) won't work

Proxy-99 avatar Aug 15 '24 09:08 Proxy-99

well after login you will be moved to lobby which you can't control the cursor so I have to use export or disable the cursor within login resource before loading the lobby page which is thing I do not like, simply you can't override showCursor(false) won't work

If lobby needs cursor then let the lobby turn on the cursor when it needs it and turn it off when it doesn't. Same for login page. Show cursor only when it really needed. If you don't, it means, that your architecture is wrong.

dmi7ry avatar Aug 16 '24 06:08 dmi7ry