mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-01-06 21:37:47 +00:00
Remove newlines from log messages
This commit is contained in:
committed by
Sam Lantinga
parent
17625e20df
commit
718034f5fa
@@ -66,7 +66,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize SDL (Note: video is required to start event loop) */
|
||||
if (!SDL_Init(init_subsystems)) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s", SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -75,18 +75,18 @@ int main(int argc, char *argv[])
|
||||
*/
|
||||
|
||||
SDL_free(SDL_GetKeyboards(&num_keyboards));
|
||||
SDL_Log("There are %d keyboards at startup\n", num_keyboards);
|
||||
SDL_Log("There are %d keyboards at startup", num_keyboards);
|
||||
|
||||
SDL_free(SDL_GetMice(&num_mice));
|
||||
SDL_Log("There are %d mice at startup\n", num_mice);
|
||||
SDL_Log("There are %d mice at startup", num_mice);
|
||||
|
||||
SDL_free(SDL_GetJoysticks(&num_joysticks));
|
||||
SDL_Log("There are %d joysticks at startup\n", num_joysticks);
|
||||
SDL_Log("There are %d joysticks at startup", num_joysticks);
|
||||
|
||||
if (enable_haptic) {
|
||||
int num_haptics;
|
||||
SDL_free(SDL_GetHaptics(&num_haptics));
|
||||
SDL_Log("There are %d haptic devices at startup\n", num_haptics);
|
||||
SDL_Log("There are %d haptic devices at startup", num_haptics);
|
||||
}
|
||||
|
||||
while (keepGoing) {
|
||||
@@ -97,46 +97,46 @@ int main(int argc, char *argv[])
|
||||
keepGoing = false;
|
||||
break;
|
||||
case SDL_EVENT_KEYBOARD_ADDED:
|
||||
SDL_Log("Keyboard '%s' added : %" SDL_PRIu32 "\n", SDL_GetKeyboardNameForID(event.kdevice.which), event.kdevice.which);
|
||||
SDL_Log("Keyboard '%s' added : %" SDL_PRIu32, SDL_GetKeyboardNameForID(event.kdevice.which), event.kdevice.which);
|
||||
break;
|
||||
case SDL_EVENT_KEYBOARD_REMOVED:
|
||||
SDL_Log("Keyboard removed: %" SDL_PRIu32 "\n", event.kdevice.which);
|
||||
SDL_Log("Keyboard removed: %" SDL_PRIu32, event.kdevice.which);
|
||||
break;
|
||||
case SDL_EVENT_MOUSE_ADDED:
|
||||
SDL_Log("Mouse '%s' added : %" SDL_PRIu32 "\n", SDL_GetMouseNameForID(event.mdevice.which), event.mdevice.which);
|
||||
SDL_Log("Mouse '%s' added : %" SDL_PRIu32, SDL_GetMouseNameForID(event.mdevice.which), event.mdevice.which);
|
||||
break;
|
||||
case SDL_EVENT_MOUSE_REMOVED:
|
||||
SDL_Log("Mouse removed: %" SDL_PRIu32 "\n", event.mdevice.which);
|
||||
SDL_Log("Mouse removed: %" SDL_PRIu32, event.mdevice.which);
|
||||
break;
|
||||
case SDL_EVENT_JOYSTICK_ADDED:
|
||||
if (joystick) {
|
||||
SDL_Log("Only one joystick supported by this test\n");
|
||||
SDL_Log("Only one joystick supported by this test");
|
||||
} else {
|
||||
joystick = SDL_OpenJoystick(event.jdevice.which);
|
||||
instance = event.jdevice.which;
|
||||
SDL_Log("Joy Added : %" SDL_PRIu32 " : %s\n", event.jdevice.which, SDL_GetJoystickName(joystick));
|
||||
SDL_Log("Joy Added : %" SDL_PRIu32 " : %s", event.jdevice.which, SDL_GetJoystickName(joystick));
|
||||
if (enable_haptic) {
|
||||
if (SDL_IsJoystickHaptic(joystick)) {
|
||||
haptic = SDL_OpenHapticFromJoystick(joystick);
|
||||
if (haptic) {
|
||||
SDL_Log("Joy Haptic Opened\n");
|
||||
SDL_Log("Joy Haptic Opened");
|
||||
if (!SDL_InitHapticRumble(haptic)) {
|
||||
SDL_Log("Could not init Rumble!: %s\n", SDL_GetError());
|
||||
SDL_Log("Could not init Rumble!: %s", SDL_GetError());
|
||||
SDL_CloseHaptic(haptic);
|
||||
haptic = NULL;
|
||||
}
|
||||
} else {
|
||||
SDL_Log("Joy haptic open FAILED!: %s\n", SDL_GetError());
|
||||
SDL_Log("Joy haptic open FAILED!: %s", SDL_GetError());
|
||||
}
|
||||
} else {
|
||||
SDL_Log("No haptic found\n");
|
||||
SDL_Log("No haptic found");
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SDL_EVENT_JOYSTICK_REMOVED:
|
||||
if (instance == event.jdevice.which) {
|
||||
SDL_Log("Joy Removed: %" SDL_PRIs32 "\n", event.jdevice.which);
|
||||
SDL_Log("Joy Removed: %" SDL_PRIs32, event.jdevice.which);
|
||||
instance = 0;
|
||||
if (enable_haptic && haptic) {
|
||||
SDL_CloseHaptic(haptic);
|
||||
@@ -145,29 +145,29 @@ int main(int argc, char *argv[])
|
||||
SDL_CloseJoystick(joystick);
|
||||
joystick = NULL;
|
||||
} else {
|
||||
SDL_Log("Unknown joystick disconnected\n");
|
||||
SDL_Log("Unknown joystick disconnected");
|
||||
}
|
||||
break;
|
||||
case SDL_EVENT_JOYSTICK_AXIS_MOTION:
|
||||
/*
|
||||
// SDL_Log("Axis Move: %d\n", event.jaxis.axis);
|
||||
// SDL_Log("Axis Move: %d", event.jaxis.axis);
|
||||
*/
|
||||
if (enable_haptic) {
|
||||
SDL_PlayHapticRumble(haptic, 0.25, 250);
|
||||
}
|
||||
break;
|
||||
case SDL_EVENT_JOYSTICK_BUTTON_DOWN:
|
||||
SDL_Log("Button Press: %d\n", event.jbutton.button);
|
||||
SDL_Log("Button Press: %d", event.jbutton.button);
|
||||
if (enable_haptic && haptic) {
|
||||
SDL_PlayHapticRumble(haptic, 0.25, 250);
|
||||
}
|
||||
if (event.jbutton.button == 0) {
|
||||
SDL_Log("Exiting due to button press of button 0\n");
|
||||
SDL_Log("Exiting due to button press of button 0");
|
||||
keepGoing = false;
|
||||
}
|
||||
break;
|
||||
case SDL_EVENT_JOYSTICK_BUTTON_UP:
|
||||
SDL_Log("Button Release: %d\n", event.jbutton.button);
|
||||
SDL_Log("Button Release: %d", event.jbutton.button);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user