mirror of https://github.com/libsdl-org/SDL
Renamed SDL_GetKeyboardInstanceName() and SDL_GetMouseInstanceName()
For consistency with other device APIs
This commit is contained in:
parent
d154b37b41
commit
9358333286
|
@ -80,7 +80,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasKeyboard(void);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_GetKeyboardInstanceName
|
||||
* \sa SDL_GetKeyboardNameFromID
|
||||
* \sa SDL_HasKeyboard
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_KeyboardID *SDLCALL SDL_GetKeyboards(int *count);
|
||||
|
@ -100,7 +100,7 @@ extern SDL_DECLSPEC SDL_KeyboardID *SDLCALL SDL_GetKeyboards(int *count);
|
|||
*
|
||||
* \sa SDL_GetKeyboards
|
||||
*/
|
||||
extern SDL_DECLSPEC const char *SDLCALL SDL_GetKeyboardInstanceName(SDL_KeyboardID instance_id);
|
||||
extern SDL_DECLSPEC const char *SDLCALL SDL_GetKeyboardNameFromID(SDL_KeyboardID instance_id);
|
||||
|
||||
/**
|
||||
* Query the window which currently has keyboard focus.
|
||||
|
|
|
@ -142,7 +142,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasMouse(void);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_GetMouseInstanceName
|
||||
* \sa SDL_GetMouseNameFromID
|
||||
* \sa SDL_HasMouse
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_MouseID *SDLCALL SDL_GetMice(int *count);
|
||||
|
@ -162,7 +162,7 @@ extern SDL_DECLSPEC SDL_MouseID *SDLCALL SDL_GetMice(int *count);
|
|||
*
|
||||
* \sa SDL_GetMice
|
||||
*/
|
||||
extern SDL_DECLSPEC const char *SDLCALL SDL_GetMouseInstanceName(SDL_MouseID instance_id);
|
||||
extern SDL_DECLSPEC const char *SDLCALL SDL_GetMouseNameFromID(SDL_MouseID instance_id);
|
||||
|
||||
/**
|
||||
* Get the window which currently has mouse focus.
|
||||
|
|
|
@ -327,7 +327,7 @@ SDL3_0.0.0 {
|
|||
SDL_GetKeyFromScancode;
|
||||
SDL_GetKeyName;
|
||||
SDL_GetKeyboardFocus;
|
||||
SDL_GetKeyboardInstanceName;
|
||||
SDL_GetKeyboardNameFromID;
|
||||
SDL_GetKeyboardState;
|
||||
SDL_GetKeyboards;
|
||||
SDL_GetLogOutputFunction;
|
||||
|
@ -339,7 +339,7 @@ SDL3_0.0.0 {
|
|||
SDL_GetMice;
|
||||
SDL_GetModState;
|
||||
SDL_GetMouseFocus;
|
||||
SDL_GetMouseInstanceName;
|
||||
SDL_GetMouseNameFromID;
|
||||
SDL_GetMouseState;
|
||||
SDL_GetNaturalDisplayOrientation;
|
||||
SDL_GetNumAllocations;
|
||||
|
|
|
@ -352,7 +352,7 @@
|
|||
#define SDL_GetKeyFromScancode SDL_GetKeyFromScancode_REAL
|
||||
#define SDL_GetKeyName SDL_GetKeyName_REAL
|
||||
#define SDL_GetKeyboardFocus SDL_GetKeyboardFocus_REAL
|
||||
#define SDL_GetKeyboardInstanceName SDL_GetKeyboardInstanceName_REAL
|
||||
#define SDL_GetKeyboardNameFromID SDL_GetKeyboardNameFromID_REAL
|
||||
#define SDL_GetKeyboardState SDL_GetKeyboardState_REAL
|
||||
#define SDL_GetKeyboards SDL_GetKeyboards_REAL
|
||||
#define SDL_GetLogOutputFunction SDL_GetLogOutputFunction_REAL
|
||||
|
@ -364,7 +364,7 @@
|
|||
#define SDL_GetMice SDL_GetMice_REAL
|
||||
#define SDL_GetModState SDL_GetModState_REAL
|
||||
#define SDL_GetMouseFocus SDL_GetMouseFocus_REAL
|
||||
#define SDL_GetMouseInstanceName SDL_GetMouseInstanceName_REAL
|
||||
#define SDL_GetMouseNameFromID SDL_GetMouseNameFromID_REAL
|
||||
#define SDL_GetMouseState SDL_GetMouseState_REAL
|
||||
#define SDL_GetNaturalDisplayOrientation SDL_GetNaturalDisplayOrientation_REAL
|
||||
#define SDL_GetNumAllocations SDL_GetNumAllocations_REAL
|
||||
|
|
|
@ -372,7 +372,7 @@ SDL_DYNAPI_PROC(SDL_Keycode,SDL_GetKeyFromName,(const char *a),(a),return)
|
|||
SDL_DYNAPI_PROC(SDL_Keycode,SDL_GetKeyFromScancode,(SDL_Scancode a, SDL_Keymod b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GetKeyName,(SDL_Keycode a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_Window*,SDL_GetKeyboardFocus,(void),(),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GetKeyboardInstanceName,(SDL_KeyboardID a),(a),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GetKeyboardNameFromID,(SDL_KeyboardID a),(a),return)
|
||||
SDL_DYNAPI_PROC(const Uint8*,SDL_GetKeyboardState,(int *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_KeyboardID*,SDL_GetKeyboards,(int *a),(a),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_GetLogOutputFunction,(SDL_LogOutputFunction *a, void **b),(a,b),)
|
||||
|
@ -384,7 +384,7 @@ SDL_DYNAPI_PROC(void,SDL_GetMemoryFunctions,(SDL_malloc_func *a, SDL_calloc_func
|
|||
SDL_DYNAPI_PROC(SDL_MouseID*,SDL_GetMice,(int *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_Keymod,SDL_GetModState,(void),(),return)
|
||||
SDL_DYNAPI_PROC(SDL_Window*,SDL_GetMouseFocus,(void),(),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GetMouseInstanceName,(SDL_MouseID a),(a),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GetMouseNameFromID,(SDL_MouseID a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_MouseButtonFlags,SDL_GetMouseState,(float *a, float *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_DisplayOrientation,SDL_GetNaturalDisplayOrientation,(SDL_DisplayID a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GetNumAllocations,(void),(),return)
|
||||
|
|
|
@ -201,7 +201,7 @@ SDL_KeyboardID *SDL_GetKeyboards(int *count)
|
|||
return keyboards;
|
||||
}
|
||||
|
||||
const char *SDL_GetKeyboardInstanceName(SDL_KeyboardID instance_id)
|
||||
const char *SDL_GetKeyboardNameFromID(SDL_KeyboardID instance_id)
|
||||
{
|
||||
int keyboard_index = SDL_GetKeyboardIndex(instance_id);
|
||||
if (keyboard_index < 0) {
|
||||
|
|
|
@ -312,7 +312,7 @@ void SDL_RemoveMouse(SDL_MouseID mouseID, SDL_bool send_event)
|
|||
return;
|
||||
}
|
||||
|
||||
SDL_FreeLater(SDL_mice[mouse_index].name); // SDL_GetMouseInstanceName returns this pointer.
|
||||
SDL_FreeLater(SDL_mice[mouse_index].name); // SDL_GetMouseNameFromID returns this pointer.
|
||||
|
||||
if (mouse_index != SDL_mouse_count - 1) {
|
||||
SDL_memcpy(&SDL_mice[mouse_index], &SDL_mice[mouse_index + 1], (SDL_mouse_count - mouse_index - 1) * sizeof(SDL_mice[mouse_index]));
|
||||
|
@ -370,7 +370,7 @@ SDL_MouseID *SDL_GetMice(int *count)
|
|||
return mice;
|
||||
}
|
||||
|
||||
const char *SDL_GetMouseInstanceName(SDL_MouseID instance_id)
|
||||
const char *SDL_GetMouseNameFromID(SDL_MouseID instance_id)
|
||||
{
|
||||
int mouse_index = SDL_GetMouseIndex(instance_id);
|
||||
if (mouse_index < 0) {
|
||||
|
|
|
@ -103,13 +103,13 @@ int main(int argc, char *argv[])
|
|||
keepGoing = SDL_FALSE;
|
||||
break;
|
||||
case SDL_EVENT_KEYBOARD_ADDED:
|
||||
SDL_Log("Keyboard '%s' added : %" SDL_PRIu32 "\n", SDL_GetKeyboardInstanceName(event.kdevice.which), event.kdevice.which);
|
||||
SDL_Log("Keyboard '%s' added : %" SDL_PRIu32 "\n", SDL_GetKeyboardNameFromID(event.kdevice.which), event.kdevice.which);
|
||||
break;
|
||||
case SDL_EVENT_KEYBOARD_REMOVED:
|
||||
SDL_Log("Keyboard removed: %" SDL_PRIu32 "\n", event.kdevice.which);
|
||||
break;
|
||||
case SDL_EVENT_MOUSE_ADDED:
|
||||
SDL_Log("Mouse '%s' added : %" SDL_PRIu32 "\n", SDL_GetMouseInstanceName(event.mdevice.which), event.mdevice.which);
|
||||
SDL_Log("Mouse '%s' added : %" SDL_PRIu32 "\n", SDL_GetMouseNameFromID(event.mdevice.which), event.mdevice.which);
|
||||
break;
|
||||
case SDL_EVENT_MOUSE_REMOVED:
|
||||
SDL_Log("Mouse removed: %" SDL_PRIu32 "\n", event.mdevice.which);
|
||||
|
|
Loading…
Reference in New Issue