Mouse position incorrect
8 replies



01.09.23 03:51:45 pm
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
I might be wrong but aren't the higher resolutions essentially just upscaling from the game's native 850x480 resolution?
And
reqcld and
clientdata , which scales off that native resolution (which is affected by
mp_hudscale)?
And
player(id,"mousex")
and player(id,"mousey")
are based off how we used to fetch their mouse position using 


edited 1×, last 01.09.23 05:25:49 pm


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,
mp_hudscale 0
player(id, 'mousex')
does not output values higher than 850x480.mp_hudscale 0
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.
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.
Thus, need adjusting the position of the images based on the resolution of 850x480? Im mean to scale the position based on 850x480?
@
JonyFrosta: In case you are doing UI, use mp_hudscale, resolution will be adjusted automatically.
https://www.cs2d.com/help.php?cmd=mp_hudscale

https://www.cs2d.com/help.php?cmd=mp_hudscale
@
Cure Pikachu: Yes, but that's not the only question.
@
SQ:
I decided to completely rewrite the adaptation of the screen resolution, but when trying to find out the resolution from the player

@

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. 


