I am making a point and click horror game and I am wondering on how I can change cursors from being the arrow to another cursor. the examples are from a game called Bad Dream: Series.
The cursor changes from the first picture to the second picture that has the cursor on the door area.
Related
I have a small issue about a custom cursor made in react three fiber.
To track the mouse movement on the viewport and update the position of an element with it is quite easy but it get's trickier once you add camera movements in the equation.
I made a small codepen to showcase the problem, basically my custom cursor would only work if my camera was right in front of the scene, for instance if the position was [0,0,5] which is not the case in my project.
https://codesandbox.io/s/simple-serotoninene-forked-shwiw?file=/src/ThreeElements/CanvasContainer.js
To add more complexity i also have camera animation on mouse movement on my real pro, which gets the cursor even wronger.
Anyone has a trick to resolve my problem ?
Thanks !
I am trying to implement the following feature using C/GTK3/Cairo:
-Left click on an GtkDrawingArea Widget and printf the coordinates Xo and Yo.
-While keeping the left button down, move the mouse and draw a line conecting (Xo,Yo) to the current mouse position.
-Release the left mouse button and printf("something")
How do I do this? Anyone knows of a good tutorial showing how to handle mouse clicl-move events?
So far, the best I found was this zetcode lines (which shows how to handle mouse click events but not button-down/move/button-up and this , which explains how to change the mouse cursor when hovering over a Widget.
Thanks
Did you see this GtkDrawingArea demo from the Gtk people? This one is written in C, but there is a Python version of the same program (links updated - thanks #kyuuhachi).
Anyway, in the constructor (__init__), calls are connected to the motion_notify_event.
You also need to connect to the button_press_event and the button_release_event.
Then, on button press, you save the coordinates of the start point. (and save it to the end point too, which are the same for now).
On each motion_notify_event, you delete the previous line (by overwriting), and redraw it to the new end point.
Finally, when the button is released, the line is final.
It's much easier if you use a canvas widget, for example GooCanvas, which takes care of most of the updating. You can just update the coordinates of the line object, and it will move itself. Also you can easily remove lines. The 'algorithm' is similar as above:
Connect button_press_event, button_release_event, and motion_notifyevent to the canvas,
When a button press occurs, create a GooCanvas.polyline object, and set begin and endpoint,
Update the endpoint on each motion_notify_event
Finalize with a button_release_event.
I want to drag an image to one line by using the mouse and when the image is close to the line, the image will automatically move on to the line, like some "floor planner" program ------------you create wall and drag the door to this wall and when the door is close to the wall, the door will automatically show up on the wall.
Can OpenGL do it?
if it can, can anyone tell me how? If it can not, can anyone tell me how I can do it?
Show me an example.
OpenGL is a rendering API, it's purpose is to generate rasterized images based on descriptions provided to it by an application.
It knows nothing about user input, and even less about the application's "domain objects" such as doors, walls, and so on. All it deals with is abstract coordinates and matrices that describe the transforms and projections to take those 3D coordinates into 2D for rasterization, as well as shading for surfaces and so on.
So, it's up to you to implement that, so that the coordinates you eventually pass to OpenGL end up being what you want them to be.
Snapping is typically a combination of measuring the distance to some guiding object, and the following quantization of the input coordinates to correspond to the the guide.
I"d like to find some good, basic mouse cursor graphics (like the pointing finger used when mousing over a hyperlink).
Any suggestions of some good sources for that?
Try the Open Cursor Library. Comes with a preview of each cursor.
I'm having amazing difficulties with a high-precision pixel-oriented image program in WPF and starting to suspect that the Cursors.Cross cursor hotspot is not at its centre, as you would expect.
I'm debugging using Magnifier at 16x and mouse set to the lowest acceleration. The code is based on DrawTools from CodeProject.
Is this the same cursor as you get in Winforms? If so, I can look at that cursor's hotspot - the Cursor class in System.Windows.Input doesn't have the HotSpot property.
UPDATE
In case anyone is looking for a workaround, in my case I already have a delegate being invoked to filter the points so I can implement snap-to-grid behaviour. It was trivial to offset the point by 1 to compensate. This was a lot easier than creating a custom cursor and has the advantage that I'm still using the stock cursor if its appearance should change.
I have an empirical answer that yes, the hotspot is offset.
I modified the program to be able to trigger graphics modes by pressing keys, so you don't need to move the mouse.
Using the same Magnifier view as the snapshot above, just pressing a key to change the mode toggles the cursor between arrow and cross.
When I switch it draws the cursor so the black lines centre on the top-left point of the normal arrow cursor.
The arrow cursor hotspot is at the pixel it points to (not a black pixel) so yes, the cross cursor hotspot is NOT at the centre of the crosshairs!
sigh