December 09, 2019, 10:17:16 PM

Author Topic: Getting Raw Mouse Input?  (Read 338 times)

Offline Kippykip

  • Full Member
  • ***
  • Posts: 111
    • Kippykip Forums!
Getting Raw Mouse Input?
« on: August 14, 2019, 04:34:40 PM »
Alrighty so I'm trying to find a way of using Win32 WM_INPUT commands into BlitzMax.
The MouseX() and MouseY() are great for cursor stuff, but for games it's a bit tricky messing with mouse movement since most computers by default have "Enhance pointer precision" turned on and high DPI mouses have enough precision to be measured by raw input but not enough to move the cursor.

The closest thing I could find is this code archive:
https://www.syntaxbomb.com/index.php?topic=1026.0

But every Win32 Extern example relating to inputs I've come across so far isn't compatible with BlitzMax-NG, and I haven't had much luck porting code over and compiling successfully.
I remember a while ago running into a similar problem trying to set the Window Icon to what's set in the executable, but just involved encasing an old codearchive piece with LParam() or something.
Here's that code if you're interested:
Code: [Select]
'Windows only
Function SetIcon()
?Win32
SendMessageW(GetActiveWindow(), WM_SETICON, 0, LParam(LoadIconW(GetModuleHandleW(Null), 101)))
?
End Function

I really would appreciate any help!

Offline markcwm

  • Sr. Member
  • ****
  • Posts: 409
Re: Getting Raw Mouse Input?
« Reply #1 on: August 16, 2019, 04:13:45 PM »
To make it 64-bit compatible you need to change Int to Byte Ptr when Int is a 32-bit handle or address, this is in Externs and in Types mirroring a structure. You have to be careful and look everything up. Another gotcha is Int Ptr, that will be cast to Long Ptr in 64-bit but it will be declared as Int Ptr in Externs. Also there is struct alignment, in 64-bit this is 8 bytes minimum so any Int field will actually occupy 8 bytes.

Offline Kippykip

  • Full Member
  • ***
  • Posts: 111
    • Kippykip Forums!
Re: Getting Raw Mouse Input?
« Reply #2 on: December 07, 2019, 01:46:47 PM »
Hmm... bump perhaps?

I also noticed MouseZ / MouseZSpeed get messed up values the frame after when things are loaded?