Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What do you guys like to use for mouse mapping?
#10
Here's a quick demo of what I was talking of.  Just some basic math for input areas.  Tongue

Code: (Select All)
$Color:32
Data One,Two,Three,Four,Five,Six,Seven,Eight,Nine
Screen _NewImage(640, 480, 32)
Dim Shared Caption(1 To 3, 1 To 3) As String
Dim As _Unsigned _Integer64 num, c
For x = 1 To 3: For y = 1 To 3: Read Caption(x, y): Next y, x

Do
DrawMenus
c = CheckMenus
If c Then num = 10&& * num + c
Locate 1, 1: Print num,
If c <> 0 Then Print c
_Limit 30
Loop Until _MouseButton(2) Or _KeyDown(27) Or num > 123456789123456789
System


Sub DrawMenus
For x = 1 To 3
For y = 1 To 3
Line (120 * x, 100 * y)-Step(120, 100), White, B
_PrintString (120 * x + 60 - .5 * _PrintWidth(Caption(x, y)), 100 * y + 50 - .5 * _FontHeight), Caption(x, y)
Next
Next
End Sub

Function CheckMenus
Static oldmouse
While _MouseInput: Wend
xp = Int(_MouseX / 120): yp = Int(_MouseY / 100)
If xp > 0 And xp < 4 And yp > 0 And yp < 4 Then t = xp * 3 + yp - 3
If _MouseButton(1) And Not oldmouse Then CheckMenus = t
oldmouse = _MouseButton(1)
End Function

(12-22-2024, 01:53 AM)bplus Wrote: @Pete I am reviewing your Mouse routine and immediately stumped by this autoKey$ business:
Code: (Select All)
Sub MyMouse_and_Keyboard (lb, mb, rb, my, mx, mw, shift%, clkcnt, drag, b$)
    Static oldmy, oldmx, z1, hover, mwy, oldmwy
    If Len(autokey$) Then
        b$ = Mid$(autokey$, 1, InStr(autokey$ + ",", ",") - 1)
        autokey$ = Mid$(autokey$, InStr(autokey$ + ",", ",") + 1)
    Else
        b$ = InKey$
    End If

That is the only place autokey$ is used so the first part of If never is true!

Some may even say it is nonsense, not me, but some might Big Grin

Perhaps an artifact from another sub this code was created from?
Code: (Select All)
    For i = 1 To nob ' number of buttons.
        If my >= y_btl(i) And my <= y_bbr(i) And mx >= x_btl(i) And mx <= x_bbr(i) Then
            b_hover = i
            Exit For
        End If
    Next

Pete's saying you can code yourself a set of autokeys to process...  
autokey$ = "A,B,C,D"  'for example

Then the above would take "A" as the first key press, process it as b$, and make autokey$ = "B,C,D".

It's for processing comma delimited key strings.  Wink
Reply


Messages In This Thread
RE: What do you guys like to use for mouse mapping? - by SMcNeill - 12-22-2024, 02:08 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Polynomial Regression + Mouse Interpolation ' QB64-PE Example ajax12 11 1,210 10-30-2025, 08:23 PM
Last Post: Pete
  Aloha from Maui guys. Cobalt 18 2,971 01-20-2025, 07:33 PM
Last Post: Pete
  Hey guys, riddle me this... Pete 8 1,331 01-01-2025, 02:23 AM
Last Post: Pete
  Clearing the mouse and keyboard buffers Donald Foster 1 599 03-09-2024, 07:47 AM
Last Post: a740g
  IDE' mouse problem with 3.4.1 on macOS Fifi 8 1,872 01-13-2023, 01:06 PM
Last Post: Fifi

Forum Jump:


Users browsing this thread: 1 Guest(s)