Sdl mouse position not working. It does not work for me though.

Kulmking (Solid Perfume) by Atelier Goetia
Sdl mouse position not working motio The cursor starts off displayed but can be turned off. It works wherever the mouse button is clicked. 04, SDL_GetGlobalMouseState will not return the actual current mouse position, but the position where the last mouse click occurred. Passing SDL_ENABLE displays the cursor and passing SDL_DISABLE hides it. Unfortunately I am unable to get the same behavior with SDL 2. 12 on Linux. I implemented the above as: SDL_Window* window; // Recently I have been trying to make a button using the lazyfoo. The first is that in the LTexture copy constructor, you only copy the pointer to the SDL_Texture. SDL Mouse event not working. I've tried using SDL_MOUSEMOTION -event but it &#111;nly returns the position when mouse cursor is inside the application window. Have you tried calling SDL_GetGlobalMouseState(&xMouse,&yMouse); without checking for a SDL_MOUSEMOTION event? So just get the mouse position in every execution of your main loop and check if that fixes the problem. 13 to SDL 1. There is no rotate property for sdl textures so I am kind of stuck at this point. h +++ b/include/SDL_hints. I use SDL, so I have no trouble implementing this). Set relative mouse mode. Compile fine, but in the bottom of update function, the following lines make crash the program: (*m_mousePosition). In order to do that I need a command for mouse that when I'm holding the left button and moving the mouse, a line would be drawing in where the mouse is going. But, if I were to use the exact same code but just with SDL_BUTTON_RIGHT, nothing happens! It's as though SDL needs another way of understanding the right mouse button. To test, the following code was used - On each mouse button down, the state of the SDL_WINDOW_BORDERLESS flag is checked and reversed. Unfortunately for you, SDL doesn't work this way out But is there such a system with the mouse? I tried working with the "default way", by checking the components of SDL_Event. When I declare Button class above the int main, I get the right results, but when create a new class Button, the mouse coordinates are wrong. I tested your program on linux, so I had to remove the winAPI stuff. /configure options: The window position is shifted also. 12 + GNU/Linux Ubuntu 14. This is called a shallow copy. My code explanation: 1st) I create a resizable window (SDL_Window with 1280x720 pixels) 2nd) I create a small rectangle inside it to act as a button (SDL_Rect with 150x50 pixels) 3rd) To get the mouse position and the rectangle area, I use this code: Now I draw two windows: there is a way to obtain mouse position only when it is inside the first window? Mouse Over in SDL/C++ not working. So, it's very hard to use mouse on guest OS desktop to, say, open an application or to close it. yrel) -- no need to call SDL_GetMouseState. h @@ -989,10 +989,10 @@ extern "C" { * \brief A variable controlling whether the mouse is captured while mouse buttons are pressed * * This variable can be set to the following values: -* "0" - The mouse is not I'm currently learning SDL by reading Lazy foo tutorials. I'm using the SDL library, but what I'm trying to load a *. 3 SVN revision 4488 (the latest revision as of now) and built the libs for Windows, the methods related to mouse warping no longer work (ie, SDL_WarpMouseInWindow()). This function should only be called on the main thread. far outnumbered by mouse events. This function, however, queries the * OS for the current mouse position, and as such, might Our SDL_PollEvent(&Event) statement will update our Event object with any mouse action that the user performs. This will only push an event when the mouse button is pressed or released. SDL_SetWindowGrab(window, SDL_TRUE); SDL_SetRelativeMouseMode(SDL_TRUE); int prev_x, curr_x, rel_x; // previous, current and relative x-coordinates int prev_y, curr_y, rel_y; // previous, current and relative y-coordinates // I am trying to make a controller for a game with SDL 2(didn't want to ask on gamedev since it is not a game issue directly) I use SDL_GetKeyboardEvent to see if the navigation arrows are being pressed but it apparently doesn't work, it is supposed to print a value 1 or -1 if one of those keys is pressed but it doesn't it just prints 0 even if I hold the key down Fixes libsdl-org/SDL#5371 * Try not forcing activation when grabbing the mouse in fullscreen windows * Workaround for bug in Microsoft WGI support Fixes libsdl-org/SDL#5270 * Use SDL_Log instead of printf * Added a hint to capture the mouse when mouse buttons are pressed, defaulting on Fixes libsdl-org/SDL#5301 * Fixed memory leak in WIN Greetings, I have upgraded from SDL 1. The SDL event type is a union, so what data is accessible and valid depends on what type of event is represented. It is probably cropping that mouse position after the window is cropped. Well that's what I'm trying to do to implement a camera for DirectX. I'm not sure why it works, unless somehow the mouse Is Mouse. SDL provides SDL_GetMouseState() to retrieve the current mouse position, but it is not expressed in the same coordinate system:. I do not want to use SDL! The defines USE_EVDEV and EVDEV_NAME “/dev/input/event1” are used. Forget the winAPI calls and just use the SDL mouse position. event. 5. . I had a similar problem some time ago, and it was due to multiple updates of my mouse position in one SDL eventloop. A quick precision: Mouse Over in SDL/C++ not working. And then adjust opengl viewport and projection with glViewport and glOrtho, so your opengl view and sdl window size is in sync. If you want to do something when the mouse is moved, your best option is to do it as direct response to the * * This works similarly to SDL_GetMouseState(), but the coordinates will be * reported relative to the top-left of the desktop. Annoyingly on a right click event. I have found an event for it, SDL_MouseButtonDown. Version. I wanted to move a SDL_Texture around by dragging with the mouse but it failed after resizing, because somehow the mouse coordinates were messed up. I tried lot of stuff but no way to warp the cursor on the center of the screen. I noticed that there is now SDL_PumpEvents(); SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT); If required, you can check actual values of event types in SDL_event. 0-rc2 using the following . As does the SDL_GetMouseState -function. button = event. Math This works, because SDL_PollEvent will only return exactly once for every Event. enabled Whether or not to enable relative mode. If no, maybe we could add a function to get the renderer of a Window : SDL_renderer * SDL_GetRendererOfWindow(SDL_window*) Also. \note SDL_GetMouseState() returns the mouse position as SDL understands it from the last pump of My question is if GLFW has an easy way of 'grabbing' the mouse cursor. setY(event. 04. SetCursor doesn't work. See Also. Not really annoying at first until you need to do non-linear movement or quick (for mouse position) may be part of the problem. The position and size of the window are reported before and after each change. If theres no new Event, it will return an empty Event. It's basically: Move mouse->Update Variable With Coordinates->Reset Mouse Position. Mouse Over in SDL/C++ not working. Problem: Can this just be implemented using sin and cos angles? I tried doing it but it does not work. I know that sounds crazy so here is some of my code: std::pair<int, int> coords; // Will store the coordinates of the tile position that the mouse rests in bool pressed; // If the mouse was pressed (i should call I am new to SDL. This function can be useful if you need to track the mouse outside of a specific window and SDL_CaptureMouse() doesn't fit your needs. I think, that I most check the position of the mouse and draw the SDL_Surface at that position in a loop, . type) { case SDL_MOUSEMOTION: { YCam += e. Edit 1: If you want to render as it is now, by using larger view than windows, then you need to calculate mouse position by your self. What I want to do: When i click on "quitter" I want to leave the game. You can confirm You could instead use SDL_GetMouseState to figure out the position only when it mattered. If the mouse cursor is hidden, and input is grabbed to the current display the mouse will enter a virtual input mode, where the relative movements of the mouse will never be stopped by the borders of the screen. 3. If I then As soon as you press the mouse button, it resizes and then prints the button position. h b/include/SDL_hints. Relative mouse position of SDL_Surface. I think this is by design. net tutorials. It would also be enough is someone lists up bullet points which each step for creating a box like this 700, 600, 0); renderer = SDL_CreateRenderer(window, -1, 0); } void renderGame(Mouse mouse){ Use the SDL_WarpMouseInWindow() function, it sets the mouse position in the SDL Window. If the mouse was not pressed, then I check if the mouse is pressed that way the game can get the coordinates of the mouse position. button := SDL_BUTTON(SDL_BUTTON_RIGHT) (= 4) so it's not as clean as I'd have liked. button. Not really sure, but something seems to be Yes, I'm using RenderSetLogicalSize indeed. x); (*m_mousePosition). y gives you the mouse position so you can use that to calculate if the mouse click was on the encrypt button. These comments will probably not be deleted, and that'll clue in anyone else who gets here later. You should handle the mouse events inside the even loop like you do with the SDL_QUIT event. type) {case SDL_MOUSEMOTION: SDL_Cursor * cursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_HAND); SDL_SetCursor(cursor); break; default: break;} And while the mouse moving around, it occasionally changes to the shape I want but immediately switches back to the default point. (A bit Then, you can give the answer a checkmark (the way to signal that the answer is correct). has anybody managed to hide the cursor but still use mouse coordinates? and sending the mouse to the middle of the screen each time I got a timer event. type) { I tried to make a rectangle like you have in RTS games, so to speak a dynamic select box, but it does not work correctly. That is, the event represents a single instant in time. I have a slight problem with the mouse after updating to v6 of littlevgl. Other functions regarding the mouse like I was wondering why SDL2 does not have a function to get the mouse position relative to a given window. But then since SDL somehow must know how to letterboxing, they should provide a way to figure out what the mouse coordinate in relation of the texture placement, since it must has the code to do it, it's my sane assumption that I can ask that data, so I don't need that horrific code to do the So at that point you'd check the x and y positions. Asking for help, clarification, or responding to other answers. Viewed 761 times -1 . My loop always updates my mouse position, and the function takes the mouse position reduces it by the last mouse position and then moves the window by that distance. Sorry to forget to mention that. 1. SDL UI Menu Button - Mouse Over. You can check out the SDL2 wiki for more information. So far I have been able to get the mouse press and the mouse motion working separately, but not at the same time. This function will flush any pending mouse motion. SDL_WarpMouseInWindow doesn't warp the OS/Windows cursor when relative mouse is enabled. Instead, The SDL event queue continually returns the key On my machine, clicking in the corners of the white rectangle: This is true. If you plug in 10 mice, all ten move that one cursor. Please fix 🙂 Other functions regarding the mouse like SDL_WarpMouseInWindow allow you to specify a window, while SDL_GetMouseState only works relative to the focus window (this seems inconsistent to me). Related questions. I used the /dev/input/mice before and in v6 the support for that is gone. In the end, I need to be able to click on a object and find how much the mouse is dragged from that selected object. Here is my code: So the problem is that the mouse-hover detection is checking the mouse position relative to the window against the button positions in memory, but the button positions in memory are stored relative to the viewport. 2. yrel will be very strange, these will give an SDL_Event e; SDL_PollEvent(&e); switch (e. I could of course have a variable moving = true when I start the move and then update position until moving = false, but this seems to be I hope this isn't me just not understanding some of the concepts - but I receive d weird values for the global mouse state ``` Screen 0: minimum 16 x 16, current 5120 x 1440, maximum 32767 x 32767 XWAYLAND27 connected 2560x1440+0+0 (0x24) normal (normal left inverted right x axis y axis) 600mm x 340mm Identifier: 0x6d3 Timestamp: 38592 No warnings, no errors. This occurs even when I've stopped moving my mouse. So here is the modified LTexture class(now dubbed Texture):. Steps to reproduce Build qemu 6. Defined in <SDL3/SDL_mouse. Making When using SDL_WINDOW_FULLSCREEN_DESKTOP or SDL_WINDOW_FULLSCREEN parameter on SDL_CreateWindow, the mouse is not working (ImGui::IsMousePosValid() returns false). SDL_GetGlobalMouseState stops working. This is a really I'm using SDL 2. 4 + Code::Blocks 13. This function should only be called The SDL mouse position should remain in the upper right corner in your video. 2. It's not that I don't want the end user to use the mouse. Other functions regarding the mouse like SDL_WarpMouseInWindow allow you to specify a window, while SDL_GetMouseState only works relative to the focus window (this seems inconsistent to me). SDL_FlushEvents(SDL_MOUSEMOTION, SDL_MOUSEMOTION+0x50). I'm basically trying to display an image (which works great), but no matter how many times I This might solve your problem. 04 and Unity 2023. I want the I want to create a menu using SDL2 in C, and my button is not working when I press it. Even though I do know how to calculate the relative position using SDL_GetGlobalMouseState, I am curious about any specific reason behind the absence of I need to define rectangular areas on the sdl window so that when the mouse button is clicked on a particular area some action has to be performed. Implement drag-and-drop and other interactive features in your C++ games. xrel and event. I am experiencing a problem with the absolute mouse position in win2k, I am working in openGL. cpp , Dear I'm working on a touchscreen application and wanted to hide the mouse cursor, but the mouse position always gets corrupted, going to 0,0. Any help here would be appreciated. sdl gives you mouse relative to window size not opengl view and projection. This is bad, because it means that any duplicates of the LTexture now have pointers to textures that \$\begingroup\$ Note that if you're receiving mouse motion data via SDL_PollEvent, you can get the mouse's absolute position from event. 04, SDL_GetGlobalMouseState will not return the actual current mouse position, but the position The current button state is returned as a button bitmask, which can be tested using the SDL_BUTTON(X) macros (where X is generally 1 for the left, 2 for middle, 3 for the right button), and x and y are set to the mouse cursor position You're moving your mouse position based on relative motion, you're not querying what SDL thinks is the mouse position. I am processing the SDL_MOUSEMOTION message. Ask Question Asked 10 years, 8 months ago. but it only works for one second like I only click on the screen for one time! The correct method for trapping the mouse under SDL is: SDL_WM_GrabInput( SDL_GRAB_ON ); This tells SDL that your intention is to actually grab full control of mouse + keyboard (see the documentation), and to First we check if the event coming in is a mouse event specifically a mouse motion event (when the mouse moves), a mouse button down event (when you click a mouse button), or a mouse button up event (when you While the mouse is in relative mode, the cursor is hidden, the mouse position is constrained to the window, and SDL will report continuous relative mouse motion even if the mouse is at the edge of the window. 2 I think you misunderstand how mouse events work. the code in your SDL_PollEvent() loop should be very fast, so in most scenarios it I was wondering why SDL2 does not have a function to get the mouse position relative to a given window. button, You could instead use SDL_GetMouseState to figure out the position only when it mattered. In Relative Mode, the SDL-cursor's position usually contradicts the platform-cursor's position as manually calculated from SDL_GetGlobalMouseState() and SDL_GetWindowPosition. Instead you get a SDL_MOUSEMOTION event when the mouse is moved. Note that this function will Hey, I'm working on a map editor for my game, and I'm trying to convert the mouse position to a position in the game world, the view is set up using gluPerspective In SDL 1. #pragma once //Using SDL, SDL_image, standard IO, and strings #include <xstring> #include So if the player direction is left, I want to rotate my player sprite by 90 degrees to the left and so on for other directions. This way you print the current position when the mouse really clicked (SDL_MOUSEBUTTONDOWN) and then resize after it is released. That way you'll never reach the edge of the screen on can keep moving the mouse in any one direction if you wanted to. First: Got diff --git a/include/SDL_hints. h index b61eb32. SDL_GetGlobalMouseState; SDL The object is supposed to move when I hold the mouse button (which button does not really matter, so let us leave it there. The current mouse state is also continously updated apart from the button press an release, which I think is the best way to go. Thread Safety. How do I use the mouse via /dev/input/event1 in my case. I need to figure out the angle that a bullet sprite should be set to in order to move in the proper direction. state at all times. The problem is that GetMouseState () consults the x/y directly whereas when reported via events, When using x11vnc to stream the content of the screen on Ubuntu 22. I use SDL2, and I'm on windows 10. h file. 5. You can confirm that by looking at the x and y coordinates in the mousemoved handler. Other functions regarding the mouse like SDL_WarpMouseInWindow allow you to SDL provides functions for querying mouse state directly, giving us flexibility in how we handle mouse input beyond just responding to events. WarpCursorPosition(); working in Linux? Not working here within editor, Ubuntu 22. yrel; } break; } When I run the program, nothing happens, however, once I first move the mouse, the SDL_MOUSEMOTION event keeps firing and the mouse keeps moving. Learn how to track mouse position and button states in SDL2 using SDL_GetMouseState(). current. It calculates the relative motion by keeping track of previous and current absolute positions. But it should warp the "internal" SDL mouse position so that turning off relative mode will warp the OS cursor to the new position. bmp file and display it as my new cursor, instead of the black and white cursor. I'm using code blocks 13. (This doesn't answer your question -- it's just a side-note) \$\endgroup\$ If so, converting an "event" (mouse position) from Window Frame to Renderer Frame is king of buggy, we could only convert to 1 specific Renderer Frame (or to the only renderer if only 1 one exists). 5 C++ SDL2 Get Mouse Coordinates Without Delay I am trying to use case statments to get the mouse motion coordinates only while the left mouse button is pressed down. I'm using SDL and I'm trying to find a way to read the mouse position when cursor is outside the application window. Any questions just ask. The displayed mouse cursor is about 300x300 away from the actual mouse position. Even though I do know how to calculate the relative position For some reason it does not just move like it should but instead moves way slower than my mouse and flickers if I moved it by a good distance. The SDL mouse position should remain in the upper right corner in your video. 2 it the way to implement full screen or windowed applications with "no cursor" you did the following: SDL_ShowCursor(SDL_DISABLE); SDL_WM_GrabInput(SDL_GRAB_ON); See Trap mouse in SDL. This is how I did it, position being the position of the object that needs to be rotated angle being the angle of the object, The negative x in the y's place actually worked perfectly,its pretty much the exact same as yours just SDL2 Toggle fullscreen: Window position gets reset. This function is available since SDL 2. Try resizing the window only on SDL_MOUSEBUTTONUP. If I set the cursor to GLFW_CURSOR_DISABLED do I have to manually keep track of the mouse position if I want to keep the x,y coords clamped to Asking for help, clarification, or responding @RowlandShaw. So reading the content of this variable would return the "held down" information. – Jongware. And since you only take one event from the queue every frame, the number of mouse events in the queue will just keep increasing and the keydown/up events will get "lost" in the queue. Return 0 on success, or -1 if relative mode is not supported. When I upgraded to SDL 1. SDL_GetRelativeMouseMode In Relative Mode, the SDL-cursor's position usually contradicts the platform-cursor's position as manually calculated from SDL_GetGlobalMouseState() and SDL_GetWindowPosition. I'm unable to get event handling to work correctly. This can be useful if you need to track the mouse outside of a specific window and SDL_CaptureMouse() doesn't fit your needs. While the mouse is in relative mode, the cursor is hidden, and the driver will try to report continuous motion in the current window. 1. SDL_CreateCursor; SDL_SetCursor (Maybe other methods like joystick works too but i'm not sure) Vector2i position = sf::Mouse::getPosition(); SDL Mouse Click. when is SDL_MOUSEBUTTONUP fired? 2. SDL_Event event; while (SDL_WaitEvent(&event)) { switch (event. So 1 click = 1 times SDL_PollEvent() with e being of type SDL_MOUSEBUTTONDOWN afterwards and 1 times SDL_PollEvent() with e being of type SDL_MOUSEBUTTONUP afterwards. The button example they code didn't fit what I needed (especially since I modified the LTexture class) so I modified it and, of course, it didn't work. motion. 0. Contrary to MouseMotionEvent, MouseWheelEvent does not provide the mouse location (the fields x and y are used for horizontal and vertical scrolling instead). In other words, the mouse position data will not always be valid/accessible. Well, I'm about to make a program like Paint. There, you call SDL_PollEvent but you don't check what type of event you are getting back, so accessing myEvent. setX(event. * * Note: SDL_GetMouseState() returns the mouse position as SDL understands it * from the last pump of the event queue. 0 SDL (C)- Window Won't Appear without Event Loop. Please note that this ONLY discusses "mice" with the notion of the desktop GUI. 3 revision 4488 in order to gain SDL iPhone support for a cross platform game engine I am working on. For many applications and games this is perfect, and this API has served hundreds of SDL programs well since its birth. 1 SDL Window does not show even with Event Loop. What am I doing wrong here? When a mouse button is pressed inside the area you defined, the program goes into moveRectangle and stays there until a mouse button is released. From my understanding a state machine should do the trick. The other way to do the same is to process entire event queue I was wondering why SDL2 does not have a function to get the mouse position relative to a given window. motion is potentially undefined behavior. 0. As explained in the last comment, it should be sufficient to add videodata->global_mouse_changed This does work - though it seems from a brief experiment that event. y (and its motion from event. I've worked with GLFW, SFML, GLUT, Qt, and for SDL to not have consistency in grepping right mouse button events is dazzling imo. The current state of the mouse cursor can be queried by passing SDL_QUERY; either SDL_DISABLE or SDL_ENABLE will be returned. void SDL_WarpMouseInWindow(SDL_Window if relative mode is not enabled. I guess my question is what is the easiest / most effective way of doing this. SDL_ShowCursor(SDL_DISABLE); SDL_SetRelativeMouseMode(SDL_TRUE); SDL_WarpMouseInWindow(window, In my application I need to return the relative mouse position from an SDL_Surface, the problem is the mouse position that gets returned is relative to the SDL window and not the SDL_Surface. Making statements based on opinion; back them up with references or There's two problems with this code that I can see. C++ SDL2 Get Mouse Coordinates Without Delay. Add a comment | 2 Answers Sorted by: Reset to default 4 . 1 SDL_WINDOWEVENT_SIZE_CHANGED and SDL_WINDOWEVENT_RESIZED not working? 1 SDL_GetWindowID always returns 1. My code so far: //Declare SDL_Surface pointers SDL_Surface *cursor; SDL_Surface *image; SDL_ShowCursor( Hi, When using x11vnc to stream the content of the screen on Ubuntu 22. SDL - Why moving the mouse changes button state? 0. edit: Turns out it does work but only for X11 and not Wayland. This works just like SDL_GetMouseState(), but the coordinates will be reported relative to the top-left of the desktop. Handle mouse events SFML. before the main loop. 9ef7d2f 100644 --- a/include/SDL_hints. Then, in the destructor of LTexture, you call free(), which deletes the SDL_Texture. I used GetMouseState(x,y) to get the mouse click event. Thanks. 1 . This function is available since SDL 3. I've read that relative mouse should help. Can someone help me please ? while( When using SDL 1. Move the mouse cursor to the given position within the window. x and event. Modified 10 years, 8 months ago. SDL_GetMouseState doesn't work to get initial mouse position. For example, it could be useful if you With -display gtk,gl=on, the cursor of the mouse does not show correctly. Moreover, you do not check the return value It's 2D. Key topics covered: Using SDL_PollEvent(&event); switch (event. button := SDL_BUTTON_RIGHT (= 3) and on a right click motion, event. You (usually) have one system cursor, and the OS hides the hardware details from you. How to register a mouse click in SFML 2. What it means is if my window is 1280 width I cannot rotate more if mouse coordinates rich 0 or 1279. g. Hot Network Questions I realize if I just press down the mouse left button once, and move the mouse in the same direction, the whole functional works normally, but what if I hold the mouse left button all the time and move the mouse in the same direction, the relative mouse return value event. Commented Sep 20, 2015 at 11:30. It does not work for me though. You do not get a SDL_MOUSEMOTION event while the mouse is moving. If relative mode is enabled, you can force mouse events for the warp by setting the SDL_HINT_MOUSE_RELATIVE_WARP_MOTION hint. Only relative motion events will be delivered, the mouse position will not SDL tends to spam mouse events even if you just move the mouse a little. 3. 2 the mouse virtual input mode works as described in the pygame mouse docs:. Hi, I use SDL_SetRelativeMouseMode to hide the mouse cursor and block the mouse cursor in the window. When A is pressed mouse left button also pressed in SFML 2. But, to be honest, it might not be worth the effort in this case, since this isn't a general question at all that anyone else will be looking for. Whenever a key is held down, the SDL event queue has no mouse movement, nor will the mouse move on my screen. 3 mouse position using c. SDL has a grab cursor function that clamps the mouse inside the window area. If you only want to clear mouse events, it would be e. – In Relative Mode, the platform-cursor's position usually contradicts the SDL-cursor's position as manually calculated from SDL_GetMouseState() and SDL_GetWindowPosition. the code in your SDL_PollEvent() loop should be very fast, so in most scenarios it would consume events from the The only guess I can make based on the info you've provided is that you're trying to access the mouse coordinates when the event is not a 'mouse' event. 3 SDL_GetMouseState doesn't work to get initial mouse position. After printing mouse position via SDL_MOUSEMOTION event, the mouse positions are correct (But as far as I inspected imgui_impl_sdl. h> Syntax. The player aims with the mouse, and I need to find the distance between the player's sprite and the cursor in order to get the proper angle. All works fine but the cursor start on the position upper-left of the window. Header File. b2 Doc says, it should work on all platforms. We’ll then detect and react to those actions within the body of the loop. Demonstration: Asking for help, clarification, or responding to other answers. If you detect a MB Down event (SDL_PRESSED), set a variable to hold that information for you, if you detect a MB Up event (SDL_RELEASED), reset the variable. No matter what I use to get mouse position, there is a delay. This since mouse position does not necessary need to lead to an action (except moving the Icon which is handled by windows). When I move the mouse slowly, the coords track correctly, but when I move the mouse quickly from left to right they are off by up to 500 pixels by the time I reach the right side of the screen. qrxinhz yyw jcrys tqql lxwyyr fkicmq fvgv gsaxeezn nff vjv