comparison src/video/windx5/SDL_dx5events.c @ 1336:3692456e7b0f

Use SDL_ prefixed versions of C library functions. FIXME: Change #include <stdlib.h> to #include "SDL_stdlib.h" Change #include <string.h> to #include "SDL_string.h" Make sure nothing else broke because of this...
author Sam Lantinga <slouken@libsdl.org>
date Tue, 07 Feb 2006 06:59:48 +0000
parents 450721ad5436
children 604d73db6802
comparison
equal deleted inserted replaced
1335:c39265384763 1336:3692456e7b0f
110 break; 110 break;
111 case DIERR_NOTINITIALIZED: 111 case DIERR_NOTINITIALIZED:
112 error = "Device not initialized"; 112 error = "Device not initialized";
113 break; 113 break;
114 default: 114 default:
115 snprintf(errbuf, SDL_arraysize(errbuf), 115 SDL_snprintf(errbuf, SDL_arraysize(errbuf),
116 "%s: Unknown DirectInput error: 0x%x", 116 "%s: Unknown DirectInput error: 0x%x",
117 function, code); 117 function, code);
118 break; 118 break;
119 } 119 }
120 if ( ! errbuf[0] ) { 120 if ( ! errbuf[0] ) {
121 snprintf(errbuf, SDL_arraysize(errbuf), "%s: %s", function, error); 121 SDL_snprintf(errbuf, SDL_arraysize(errbuf), "%s: %s", function, error);
122 } 122 }
123 SDL_SetError("%s", errbuf); 123 SDL_SetError("%s", errbuf);
124 return; 124 return;
125 } 125 }
126 126
197 SetDIerror("DirectInputDevice::SetDataFormat", result); 197 SetDIerror("DirectInputDevice::SetDataFormat", result);
198 return(-1); 198 return(-1);
199 } 199 }
200 200
201 /* Set buffered input -- we aren't polling */ 201 /* Set buffered input -- we aren't polling */
202 memset(&dipdw, 0, sizeof(dipdw)); 202 SDL_memset(&dipdw, 0, sizeof(dipdw));
203 dipdw.diph.dwSize = sizeof(dipdw); 203 dipdw.diph.dwSize = sizeof(dipdw);
204 dipdw.diph.dwHeaderSize = sizeof(dipdw.diph); 204 dipdw.diph.dwHeaderSize = sizeof(dipdw.diph);
205 dipdw.diph.dwObj = 0; 205 dipdw.diph.dwObj = 0;
206 dipdw.diph.dwHow = DIPH_DEVICE; 206 dipdw.diph.dwHow = DIPH_DEVICE;
207 dipdw.dwData = INPUT_QSIZE; 207 dipdw.dwData = INPUT_QSIZE;
596 if ( SDL_GetAppState() & SDL_APPINPUTFOCUS ) { 596 if ( SDL_GetAppState() & SDL_APPINPUTFOCUS ) {
597 for ( i=0; i<SDL_DIndev; ++i ) { 597 for ( i=0; i<SDL_DIndev; ++i ) {
598 result = IDirectInputDevice2_Poll(SDL_DIdev[i]); 598 result = IDirectInputDevice2_Poll(SDL_DIdev[i]);
599 if ( (result == DIERR_INPUTLOST) || 599 if ( (result == DIERR_INPUTLOST) ||
600 (result == DIERR_NOTACQUIRED) ) { 600 (result == DIERR_NOTACQUIRED) ) {
601 if ( strcmp(inputs[i].name, "mouse") == 0 ) { 601 if ( SDL_strcmp(inputs[i].name, "mouse") == 0 ) {
602 mouse_lost = 1; 602 mouse_lost = 1;
603 } 603 }
604 IDirectInputDevice2_Acquire(SDL_DIdev[i]); 604 IDirectInputDevice2_Acquire(SDL_DIdev[i]);
605 IDirectInputDevice2_Poll(SDL_DIdev[i]); 605 IDirectInputDevice2_Poll(SDL_DIdev[i]);
606 } 606 }
619 result = IDirectInputDevice2_GetDeviceData( 619 result = IDirectInputDevice2_GetDeviceData(
620 SDL_DIdev[event], sizeof(DIDEVICEOBJECTDATA), 620 SDL_DIdev[event], sizeof(DIDEVICEOBJECTDATA),
621 evtbuf, &numevents, 0); 621 evtbuf, &numevents, 0);
622 if ( (result == DIERR_INPUTLOST) || 622 if ( (result == DIERR_INPUTLOST) ||
623 (result == DIERR_NOTACQUIRED) ) { 623 (result == DIERR_NOTACQUIRED) ) {
624 if ( strcmp(inputs[event].name, "mouse") == 0 ) { 624 if ( SDL_strcmp(inputs[event].name, "mouse") == 0 ) {
625 mouse_lost = 1; 625 mouse_lost = 1;
626 } 626 }
627 IDirectInputDevice2_Acquire(SDL_DIdev[event]); 627 IDirectInputDevice2_Acquire(SDL_DIdev[event]);
628 result = IDirectInputDevice2_GetDeviceData( 628 result = IDirectInputDevice2_GetDeviceData(
629 SDL_DIdev[event], sizeof(DIDEVICEOBJECTDATA), 629 SDL_DIdev[event], sizeof(DIDEVICEOBJECTDATA),
848 return(keysym); 848 return(keysym);
849 } 849 }
850 850
851 int DX5_CreateWindow(_THIS) 851 int DX5_CreateWindow(_THIS)
852 { 852 {
853 char *windowid = getenv("SDL_WINDOWID"); 853 char *windowid = SDL_getenv("SDL_WINDOWID");
854 int i; 854 int i;
855 855
856 /* Clear out DirectInput variables in case we fail */ 856 /* Clear out DirectInput variables in case we fail */
857 for ( i=0; i<MAX_INPUTS; ++i ) { 857 for ( i=0; i<MAX_INPUTS; ++i ) {
858 SDL_DIdev[i] = NULL; 858 SDL_DIdev[i] = NULL;
862 862
863 SDL_RegisterApp(NULL, 0, 0); 863 SDL_RegisterApp(NULL, 0, 0);
864 864
865 SDL_windowid = (windowid != NULL); 865 SDL_windowid = (windowid != NULL);
866 if ( SDL_windowid ) { 866 if ( SDL_windowid ) {
867 SDL_Window = (HWND)strtol(windowid, NULL, 0); 867 SDL_Window = (HWND)SDL_strtol(windowid, NULL, 0);
868 if ( SDL_Window == NULL ) { 868 if ( SDL_Window == NULL ) {
869 SDL_SetError("Couldn't get user specified window"); 869 SDL_SetError("Couldn't get user specified window");
870 return(-1); 870 return(-1);
871 } 871 }
872 872