Scripts / Mouse Cursor Preciseness

Author
Message
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 7th Jun 2020 18:09
Is there any way to make a mouse cursor more precise and smooth?

I'm using
PasteSpritePosition(cursor,g_MouseX, g_MouseY )

However, when I move the mouse around i notice it jumps a number of pixels. I'm assuming due to everything being in percents. However when I use: Prompt(g_MouseX.."/"..g_MouseY) for example i notice its showing values that the cursor on screen isn't updating to, maybe due to being in point form? Is there any way to move the cursor by say 1.5 or alike? or is it only whole numbers values?
Store Assets - Store Link

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 7th Jun 2020 18:41 Edited at: 7th Jun 2020 18:44
PastSpritePosition() converts it's arguments to integers. SetSpritePosition() doesn't.

Looks like a bug to me.

Edited to Add:

Here is the dodgy bit of code from PasteSpritePosition:
float fX = lua_tointeger(L, 2);
float fY = lua_tointeger(L, 3);

Whereas the SetSpritePosition has:
float x = lua_tonumber(L, 2);
float y = lua_tonumber(L, 3);
Been there, done that, got all the T-Shirts!
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 7th Jun 2020 18:53
Question back atcha though, do you know what effect these commands have?:
DrawSpritesFirst()
DrawSpritesLast()
BackdropOff()
BackdropOn()
Been there, done that, got all the T-Shirts!
PM
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 8th Jun 2020 08:33 Edited at: 8th Jun 2020 08:38
Quote: "PastSpritePosition() converts it's arguments to integers. SetSpritePosition() doesn't."


Thanks a lot! setspriteposition works perfectly. Should I post this issue to github?

For the 4 commands, Not sure about the other two but I think BackdropOff() BackdropOn() were being used in the main menus for their backgrounds? Though i dont see those commands in any of the titlebank lua files
Store Assets - Store Link

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 8th Jun 2020 19:15
If you could add that to GitHub that would be great, all the sprite commands should use the same coordinate values, i.e. floating point.

I tried the 4 commands in some Lua scripts and they basically don't seem to do anything useful, DrawSpritesFirst() seems particularly useless as it just makes the sprites invisible, I assume because it draws the sprites and then renders over the top of them.

The Backdrop commands seem to be related to the camera but I couldn't work out what it does.
Been there, done that, got all the T-Shirts!
PM
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 11th Jun 2020 10:24
Those commands look like LUA commands calling internal code, they are not on my global.lua (20-05-05 may fixes here), and they only appear to be related to standalone ones.
It looks to me such as some sort of sleep(), I think they give the support than the game engine gives by itself, via test mode. IMHO.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM

Login to post a reply

Server time is: 2024-04-20 16:25:35
Your offset time is: 2024-04-20 16:25:35