Create an object that follows the mouse

La Hi 1 Reputation point
2022-01-21T13:06:42.627+00:00

Hello!

Here is my issue. When I stream a game through steam, some games are really bugged out due to trying to use the mouse from the host and from the client at the same time, causing some massive view jumping. This stops otherwise functioning streaming from taking place at all. I can counter this by disabling the mouse on the host computer, but this means, that there is no visible cursor on the client computer when playing games. This is equally unacceptable.

I would like to create a program that creates a sprite that follows a pointing device around. This way I can disable the mouse on the host machine, and still have a visible cursor being displayed on the client machine. This program should also always put the cursor on top, so that no program can hide the cursor behind it.

I am not well versed in coding, but I do understand the basics, so I can't really give you any code that would be of any significance here, other than:

objCursor.x = mouse.x;
objCursor.y = mouse.y;

Small BASIC
Small BASIC
A programming language created by Microsoft that serves a stepping stone for beginners from block-based coding languages to more complex text-based languages.
277 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Scout 541 Reputation points
    2022-01-21T16:13:45.51+00:00

    I thought that would be the solution, but the Snipping Tool grabbed the mouse.

    167296-catchthemouse.jpg

    GraphicsWindow.Height = 50  
    GraphicsWindow.Width  = 300  
    GraphicsWindow.Title  = "Catch the mouse"  
    GraphicsWindow.Show()  
    While 1 = 1   
      Program.Delay(20)  
      GraphicsWindow.Clear()  
      x = Mouse.MouseX  
      y = Mouse.MouseY  
      if x > GraphicsWindow.Left And x < GraphicsWindow.Left + 300 And y > GraphicsWindow.Top And y < GraphicsWindow.Top + 50 Then  
          
      Else  
        Program.Delay(200)  
        x = Mouse.MouseX  
        y = Mouse.MouseY  
        GraphicsWindow.Left = x - 200  
        GraphicsWindow.Top  = y - 30  
      EndIf  
      GraphicsWindow.DrawText(1,1 ," Mouse Position X = " + x)  
      GraphicsWindow.DrawText(1,15," Mouse Position Y = " + y)  
    EndWhile  
    
    0 comments No comments