Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inconsistancy in API between 1.2 and 1.3 for SDL_GetMouseState #171

Closed
SDLBugzilla opened this issue Feb 10, 2021 · 0 comments
Closed

inconsistancy in API between 1.2 and 1.3 for SDL_GetMouseState #171

SDLBugzilla opened this issue Feb 10, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

Reported in version: HG 2.0
Reported for operating system, platform: All, All

Comments on the original bug report:

On 2009-06-26 22:25:30 +0000, Ken Bull wrote:

SDL_GetMouseState in 1.2 looks like this:
Uint8 SDL_GetMouseState (int* x, int* y);

SDL_GetMouseState in 1.3 looks like this:
Uint8 SDL_GetMouseState (int index, int* x, int* y);

SDL_GetMouseState in 1.3 should look like this:
Uint8 SDL_GetMouseState (int* x, int* y);

and work like this:
SDL_SelectMouse (index);
button = SDL_GetMouseState (&x, &y);

On 2009-06-28 20:57:21 +0000, Ryan C. Gordon wrote:

I'm not sure we should do a "SelectMouse" API, but we probably shouldn't change the signature of functions that were in 1.2...perhaps a different function name for the new version, and SDL_GetMouseState() will be equivalent to SDL_NewVersionOfGetMouseState(0,x,y), or something.

This is the approach I took in adding multiple audio devices to 1.3 ... the 1.2 functions, which can't address a specific piece of hardware, assume the most reasonable default device.

Are there other function signatures we've changed like this? I assume this specific one was a GSoC 2008 change.

--ryan.

On 2009-06-29 13:20:09 +0000, Ken Bull wrote:

(In reply to comment # 1)

I'm not sure we should do a "SelectMouse" API, but we probably shouldn't change
the signature of functions that were in 1.2...perhaps a different function name
for the new version, and SDL_GetMouseState() will be equivalent to
SDL_NewVersionOfGetMouseState(0,x,y), or something.

There is ALREADY a SDL_SelectMouse function in SDL 1.3. The doxygen documentation for SDL_GetMouseState in 1.3 even says that it uses the "currently selected mouse". It just doesn't. Same thing for SDL_GetRelativeMouseState, SDL_SetRelativeMouseMode, SDL_GetRelativeMouseMod and SDL_GetMouseFocusWindow.

SDL_WarpMouseInWindow, SDL_CreateCursor, SDL_SetCursor, SDL_GetCursor and SDL_ShowCursor are currently the only functions that could ask for an index but don't (though multiple cursors aren't really supported yet, each of these refers to SDL_current_mouse in the code), but they also refer to the "currently selected mouse" in the documentation.

I'd personally recommend SDL_GetMouseState use the device selected with SDL_SelectMouse and have a SDL_GetMouseStateEx (or similar) which takes a mouse index, and do the same for other similar functions.

On 2009-06-29 14:11:28 +0000, Ryan C. Gordon wrote:

There is ALREADY a SDL_SelectMouse function in SDL 1.3.

Ugh, that should be removed. I'm grabbing this bug, so I can look into this further.

--ryan.

On 2009-12-14 23:03:46 +0000, Sam Lantinga wrote:

Ryan, this needs to be fixed ASAP however we do it, because currently the iPhone demos don't compile.

On 2009-12-15 22:39:08 +0000, Ryan C. Gordon wrote:

Priority bump.

--ryan.

On 2009-12-16 11:51:01 +0000, Ryan C. Gordon wrote:

I cleaned this up. SDL_GetMouseState() is now as it was in 1.2. The SelectMouse stuff is still there, but this is a mess I have to sort through.

But this should get the iPhone demos, and other existing code, up and running again.

This is svn revision # 5420.

--ryan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant