Forum

> > CS2D > Scripts > Mouse position incorrect
Forums overviewCS2D overview Scripts overviewLog in to reply

English Mouse position incorrect

8 replies
To the start Previous 1 Next To the start

old Mouse position incorrect

JonyFrosta
User Off Offline

Quote
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

old Re: Mouse position incorrect

Cure Pikachu
User Off Offline

Quote
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

old Re: Mouse position incorrect

JonyFrosta
User Off Offline

Quote
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

old Re: Mouse position incorrect

SQ
Moderator Off Offline

Quote
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.

old Re: Mouse position incorrect

JonyFrosta
User Off Offline

Quote
Thus, need adjusting the position of the images based on the resolution of 850x480? Im mean to scale the position based on 850x480?

old Re: Mouse position incorrect

JonyFrosta
User Off Offline

Quote
@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
Log in to reply Scripts overviewCS2D overviewForums overview