With SDL 1.2 I was using SDL_WM_GrabInput to center the (hidden) mouse on screen. This gave me unlimited turning freedom for a first person shooter. SDL2 no longer provides this function but has SDL_SetWindowGrab. This does not seem to be repositioning the mouse to the center of the screen after each loop (event read). I can turn the player around only 1 and a half times before the mouse has hit the edge of the window and will no longer produce xrel values. Is this a bug or is there another function I should be using?
Give SDL_SetRelativeMouseMode() and SDL_GetRelativeMouseState() a try.
Alternatively recenter the mouse each frame yourself with SDL_WarpMouseInWindow().
Related
When I use the timeline box in Choregraphe I set the movements in the keyframes via the inspector widget. I saw people using a motion widget but in my version it doesn't appear, instead there is the inspector widget which is similar but it doesn't have the drawing of the art that you selected. Now the problem is that if I set a position (for ex right arm elbow 30 degrees) and then switch arm to set other parameters the previus position (the right elbow) doesn't get saved. Also when I set a new position nao does it quickly and then returns in the standing position (this problem is both in the virtual and real robot) (also it's not a problem related to the frames that are too high or the position of the keyframe in the timeline). Can someone help me?
In choregraphe, you need to click to the bullet next to the joint slider, if the bullet is red then it's recorded, else it's not.
The problem
As the cursor locks, the cursor is set to the position of the screen where i clicked. But i would like to have my cursor centered to the screen. As that is not possible for security reasons, the only available option is to move the camera(maybe with lookAt) towards the cursor position.
In my example i would like that when the cursor is locked that the little gray square in the center of the screen provokes a hover. This meaning that the cursor is exactly in the center of my camera.
The reason i want to achieve this is because i would like my clicks to be performed from the center of the screen, if i for instance want to trigger the onclick of a 3D object in front of the camera.
I would like to know if it is possible to do so with the pointerlockcontrols and if yes, how could one proceed ?
What i have so far
At the time i've just tried the basic implementation of pointerlockcontrols but can't figure out the way to put the cursor in the desired position.
Unfortunately pointerlockcontrols does not work on my codesandbox example.
The code sandbox that unfortunately does not work
Thanks in advance for your help.
Found my answer here :
Screen centered pointer lock controls
the trick is just to move the raycast to the center of the screen.
I'm using Amcharts JavaScript library in Windows application (Xojo,HTMLViewer). It works well.
However, I have an issue.
https://www.dropbox.com/s/e68evm1f0selw2p/IMG_0396.jpg?dl=0
https://www.dropbox.com/s/qgge5kiz1x87qj9/IMG_0397.jpg?dl=0
Mouse position doesn't match to the cursor of Charts, all the time mouse stands leftside of it when I increase the Windows size.
In opposite, when I decrease the windows size, mouse position is right side.
When I start my application for the first time, it matches correctly but in case I increase or maximize the Windows screen, this issue happens.
Do you think this is an issue of HTMLViewer or Amcharts?
Any workaround would be helpful.
Using the mouse I am drawing 2D shapes on the client area of a MDIChildFrame. Recently I have added a wxToolBar to the frame and when I now draw a shape on the client area it seems that the points have shifted by the size the toolbar. Imagine that with mouse I am clicking on (100,100) and drawing a line to (150,150); however, the line appears somewhere (75,75) to (125,125). By the way, wxMouseEvent GetPosition(); reports (100,100) to me.
Removing the toolbar fixes the problem however, I want to keep the toolbar for ease of tool selection.
I use the code:
m_ToolBar=new wxToolBar(this, wxID_ANY);
m_ToolBar->AddTool() //
m_ToolBar->Realize();
this->SetToolBar(m_ToolBar);
Any ideas will be appreciated.
You can always use wxWindow::GetClientAreaOrigin() to manually offset the coordinates by the toolbar height but normally this shouldn't be necessary, and if this doesn't happen with a "normal" frame but only happens with wxMDIChildFrame it would be a bug in wxWidgets that should be reported as usual.
It's also recommended to not draw over wxFrame itself but rather put a wxWindow into it and draw on it. This should also take care of your problem.
I'm using a VB6 PictureBox on my User Control. I set the PictureBox's picture, I set the BorderStyle to 0, and I set the BackColor to the User Control's BackColor. The idea is that I want a "floating" icon. However, I want that icon to appear clickable when the mouse hovers over it.
Two questions:
Which events do I use? MouseMove seems to be the closest to a "MouseOver" event. Are there any cleaner alternatives?
How should I change the style? I've tried a few things, but none of them quite look right.
MouseMove is the correct event in VB6. You'll have to do some work to manually detect when the mouse leaves the client area cleanly. (My experiments in this world, lo those many years ago, always found implementing this behavior to be tricky.)
For changing the style, I'd recommend using GDI to: (a) shift the image one pixel up and to the left; (b) draw a single pixel line in the ButtonHighlightColor along the top and left edges; and (c) draw a single pixel line in the ButtonShadowColor along the bottom and right edges. This is trickier than it sounds, particularly in VB6, so ultimately I'd recommend ...
That you look at vbAccelerator's toolbar controls. They're free, and they'll probably get you most of where you want to be. (And yes, they're "classic" VB -- that is, VB6.)