opengl – Transform the mouse coordinates to the GLSL plane

I am creating a 2D map editor in C ++ with GLFW. I want move and drag entities with the mouse, but I have a problem, the mouse coords are in the window size range (1200, 720) and the entity is in the GLSL range (100×100 I think), I compare the mouse coord with the 4 entity edges. How can I do this?

PD: Sorry for bad english.

Godot: How to get mouse button input for a Tilemap for Cellular Automata

Conway’s Game of Life

I have been working with a tilemap for the implementation of a cellular automata game. My current method for getting mouse button input is using an Area2D as a child of the Tilemap and detecting mouse button input like that.

I have done this and have since been wondering if there is something built in that I can use for this. I have looked into it and cannot find anything better.

Is there something built-in to Node2Ds or Canvas Items that I can use.

Wake from sleep with external Keyboard or mouse after these have been unplugged and replugged on Windows 10

I am working with two computers, an Asus laptop with Windows 10 and a Dell Optiflex Desktop PC with Ubuntu 20.04. The Asus laptop is also used as if it was a a desktop computer, i.e. the lid is always closed, so it is inconvenient to open and close it to use the built-in keyboard or power button. For both computers, I use an external keyboard and mouse.

During the day, I have to switch between the two computers. When I switch computers, I set the one I will stop using for a while (say, computer A) in sleep mode, I unplug the external keyboard and mouse and plug them to computer B (since I do not have a KVM switch). When I want to use again computer A, I do the inverse operation – I unplug the mouse and keyboard from computer B and plug them to A.

Now, suppose I set to sleep the Windows 10 laptop, I unplug the keyboard and mouse, plug them to the Ubuntu PC, then replug everything to the Windows 10 laptop. If I do this, I am no longer able to wake-up the Windows laptop from sleep. Note that if I set the Windows laptop to sleep without unplugging anything, I am perfectly able to wake it up (both with the mouse and the external keyboard). Is there any way to wake-up my Windows laptop after all the unplugging/replugging? Is there any other workaround I could use that does not involve opening the lid of my laptop? E.g. wake-up after plugging a pendrive, if such a thing exists.

My question is similar to this one, where, however, the problem involved a computer running Linux (while mine is running Windows 10) and using a KVM switch (which I do not have).

xcode – macos laptop WakeUp with mouse

Closed. This question is off-topic. It is not currently accepting answers.

This question does not appear to be about Apple hardware or software within the scope defined in the help center.

Closed 12 hours ago by nohillside‚ô¶.

(Private feedback for you)
Edit question

MacOs, How with a laptop, use the mouse or the keyboard (connected in USB) To WakeUp?

On a laptop the WakeUp with MacOs is always achieved by pressing the PowerButton key, the USB ports are made inactive during standby.

DSDT or SSDT does not seem to be the solution. Maybe with the Kernel and a Kext dedicated to the mouse and the keyboard in USB?

Thank you for your answers.

sharepoint online – How to customize the tooltip when user hover mouse over title of a webpart ContentEditor

Stack Exchange Network


Stack Exchange network consists of 177 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

java – LibGDX Change mouse cursor to custom image……and keep it there

I’m able to create a custom cursor no problem using the following code running in my GameScreen’s Show method:

Pixmap pixmap = new Pixmap(Gdx.files.internal("ui/cursor.png"));
Cursor cursor = Gdx.graphics.newCursor(pixmap, pixmap.getWidth() / 2, pixmap.getHeight() / 2);
Gdx.graphics.setCursor(cursor);
pixmap.dispose();

The problem is…if I deselect the game window and return back…the cursor has returned back to the default one. At least that happens for me on Mac desktop. If I move the cursor out of the screen (without deselecting) and then back again I get the custom cursor image back but I don’t think people would know to do that.

But after searching I couldn’t find any way for LibGDX to detect when the game window is deselected? I thought I would be able to find that since it would seem useful for something like automatically pausing when deselecting the game window and such.

That would seem to be the way to reset the cursor every time returning to the game window, unless there’s some other way to make it more permanent?

java – How to calculate FOV angle range based on facing and mouse aim position

The title is not that clear so I’ll explain. In my top down shooter game the player can be faced in any of the 8 directions using the keyboard. Then depending on the direction he will have a 90 degree field of view to turn based on the angle selected by mouse position. Obviously the mouse can go anywhere so it has to be restricted within -45 and 45 of the faced angle.

The eight direction angles:

    135 90 45
180             0
    225 270 305

So if he’s facing to the left at 180 his range will be -45 and 45 of that ie 135 to 225. So simply it’s mouseAngle - facingAngle which works fine except if he’s facing at around 0, 45 or 305 degrees where the mouse angle passes zero causing issues in calculation.

As it is I’m using this formula.

private void setAngleFOV() {
    if (facing == 0 || facing == 360)
        facing = mouseAngle < 360 && mouseAngle >= 180 ? 360 : 0;
    angleFOV = mouseAngle - facing;
    angleFOV = Math.max(Math.min(angleFOV, 45), -45);
}

It can either be 0 or 360 for either facing or mouseAngle, whichever works best but I haven’t found an ideal solution. The above formula works for facing right at angle 0, but not with diagonal angles 45 and 305.

It could maybe work with lots of if statements and such, but I feel there must be a better way?

autohotkey – AHK code issue – Defining variables and getting mouse click at location?

I’m pretty new to AHK. I just started like a couple days ago, and I’ve hit a stump and need help debugging.

I would like this code to go to a specified mouse position and click the coordinate, and import my variables since I will have many AHK scripts referring to the same variables.

PROBLEM: The code currently does not move the mouse and click in the desired location. I am not even sure if it is clicking. It simply displays the ToolTip message as well as the msgbox message. (The messages that will display are marked in the code as working via (works)). I think this might be because the variables are somehow not defined… When the variable displayed in the msgbox was defined in the if/else statement, the msgbox would be empty. The Clicks aren’t working either, and I think it’s because the values aren’t existent. I have no idea why in the world this is happening.

What is wrong with my code and what is going on? Please help me!

#include C:UsersusernameDesktopvars.txt
CoordMode, Mouse, Screen
clickThing(whichThing) { ;START FUNCTION
    Sleep, 1000 ; sleep 1 sec
    Send ^h ; control h
    Sleep, 3000 ; sleep 3 sec
    if (whichThing = 1){
        goTox = %x1%
        goToy = %y1%
        ToolTip, option 1 ; display "option 1" @ cursor tip ; (works)
    } else if (person = 2) {
        goTox = %x2%
        goToy = %y2%
        ToolTip, option 2 ; display "option 2" @ cursor tip ; (works)
    } else if (person) = 3 {
        goTox = %x3%
        goToy = %y3%
        ToolTip, option 3; display "option 3" @ cursor tip ; (works)
    } else {
        msgbox that isn't a valid choice. ; (works)
        return
    }
    msgbox %goTox% %goToy% ; msgbox will be empty...
    ; I tried this
    Sleep 1000
    MouseMove, %goTox%, %goToy%, 30
    MouseClick, left, %goTox%, %goToy%
    Sleep 500
    MouseClick, left, %goTox%, %goToy%
    Sleep 1000
    ; I also tried this
    Click %goTox%, %goToy%
} ;END OF FUNCTION

;START MAIN CODE
IfWinActive, window_name {
    clickThing(1)}
else{
    msgbox, window not active ; (works)
}

msgbox, finished ; (works)
return

Get Excel VBA Application.InputBox Range by mouse left click and drag?

I know using the code below that I can have VBA ask a user to enter a range to select but can this be achieved by a user Left Clicking on the starting cell and then (holding the mouse left button down) drag down to select the range?

The idea is that once a range has been selected the VBA would then copy the content of one cell on a different worksheet into each cell within the range that the user selected.

Nothing comes up when I search for this so maybe it is not possibe?

Public Sub SelectRange()
  Dim aRange As Range
      
  On Error Resume Next
  Set aRange = Application.InputBox(prompt:="Enter range", Type:=8)
  If aRange Is Nothing Then
    MsgBox "Operation Cancelled"
  Else
    aRange.Select
  End If
End Sub

How do i Make the windows mouse cursor speed the same as in macOS

I’ve Googled a Bit But Couldn’t Find the Answer
I think I also need to adjust acceleration too