English Mouse position incorrect

8 replies
Goto Page
To the start Previous 1 Next To the start
01.09.23 03:51:45 pm
Up
JonyFrosta
User
Offline Off
When I change the screen resolution from 850x480 to some other (larger) one, the player(id, 'mousex') outputs a value only in the range up to x850 and y480
01.09.23 04:58:13 pm
Up
Cure Pikachu
User
Offline Off
I might be wrong but aren't the higher resolutions essentially just upscaling from the game's native 850x480 resolution?

And
player(id,"mousex")
and
player(id,"mousey")
are based off how we used to fetch their mouse position using cs2d lua cmd reqcld and cs2d lua hook clientdata , which scales off that native resolution (which is affected by cs2d cmd mp_hudscale)?
edited 1×, last 01.09.23 05:25:49 pm
IMG:https://i.imgur.com/DeSeUxC.png
IMG:https://i.imgur.com/xpsyQRX.png
01.09.23 05:09:52 pm
Up
JonyFrosta
User
Offline Off
Yes, but when you create a image, it is in the range above 850x480 and the mouse does not go beyond these ranges. More precisely,
player(id, 'mousex')
does not output values higher than 850x480.

mp_hudscale 0
01.09.23 06:03:04 pm
Up
Changing resolution explode everything, I confirm.
www.CS2D.com.br | www.dsc.gg/CS2D | Join our CS2D community! IMG:https://cdn.discordapp.com/attachments/1048445028361584671/1064255558372302979/cs2dbr.png
01.09.23 06:22:18 pm
Up
SQ
Moderator
Offline Off
Mouse position is in the context of gameplay pixel unit (world space)
Increasing resolution, does not increase your field of view.

This way you can check whether mouse is pointing on some object on the map regardless resolution. This is by design.
01.09.23 06:35:19 pm
Up
JonyFrosta
User
Offline Off
Thus, need adjusting the position of the images based on the resolution of 850x480? Im mean to scale the position based on 850x480?
01.09.23 07:35:34 pm
Up
SQ
Moderator
Offline Off
@user JonyFrosta: In case you are doing UI, use mp_hudscale, resolution will be adjusted automatically.

https://www.cs2d.com/help.php?cmd=mp_hudscale
01.09.23 08:01:52 pm
Up
Cure Pikachu
User
Offline Off
Question is are you trying to draw an image on the client's mouse cursor or something?
IMG:https://i.imgur.com/DeSeUxC.png
IMG:https://i.imgur.com/xpsyQRX.png
01.09.23 08:11:23 pm
Up
JonyFrosta
User
Offline Off
@user Cure Pikachu: Yes, but that's not the only question.

@user SQ:
mp_hudscale
greatly distorts the image, makes it fuzzy if you change the resolution from smaller to larger.

I decided to completely rewrite the adaptation of the screen resolution, but when trying to find out the resolution from the player
player(id,'screenw')
it sometimes outputs incorrect values (slightly incorrect). Also, these values do not change or change crookedly for the Host (Starting the server through New Game and testing). Similarly for the
clientsetting
hook.
To the start Previous 1 Next To the start