mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-13 21:35:59 +00:00
Use C++ style comments consistently in SDL source code
Implemented using this script: find . -type f -exec sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' {} \; git checkout \ core/linux/SDL_evdev_kbd_default_keymap.h \ events/imKStoUCS.* \ hidapi \ joystick/controller_type.c \ joystick/controller_type.h \ joystick/hidapi/steam/controller_constants.h \ joystick/hidapi/steam/controller_structs.h \ joystick/SDL_gamepad_db.h \ libm \ render/*/*Shader*.h \ render/vitagxm/SDL_render_vita_gxm_shaders.h \ render/metal/SDL_shaders_metal_*.h \ stdlib/SDL_malloc.c \ stdlib/SDL_qsort.c \ stdlib/SDL_strtokr.c \ test/ \ video/directx/SDL_d3d12_xbox_cmacros.h \ video/directx/d3d12.h \ video/directx/d3d12sdklayers.h \ video/khronos \ video/x11/edid-parse.c \ video/x11/xsettings-client.* \ video/yuv2rgb sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' hidapi/SDL_hidapi.c
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
|
||||
#ifdef SDL_JOYSTICK_ANDROID
|
||||
|
||||
#include <stdio.h> /* For the definition of NULL */
|
||||
#include <stdio.h> // For the definition of NULL
|
||||
|
||||
#include "SDL_sysjoystick_c.h"
|
||||
#include "../SDL_joystick_c.h"
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
#include "android/keycodes.h"
|
||||
|
||||
/* As of platform android-14, android/keycodes.h is missing these defines */
|
||||
// As of platform android-14, android/keycodes.h is missing these defines
|
||||
#ifndef AKEYCODE_BUTTON_1
|
||||
#define AKEYCODE_BUTTON_1 188
|
||||
#define AKEYCODE_BUTTON_2 189
|
||||
@@ -66,10 +66,10 @@ static int numjoysticks = 0;
|
||||
*/
|
||||
static int keycode_to_SDL(int keycode)
|
||||
{
|
||||
/* FIXME: If this function gets too unwieldy in the future, replace with a lookup table */
|
||||
// FIXME: If this function gets too unwieldy in the future, replace with a lookup table
|
||||
int button = 0;
|
||||
switch (keycode) {
|
||||
/* Some gamepad buttons (API 9) */
|
||||
// Some gamepad buttons (API 9)
|
||||
case AKEYCODE_BUTTON_A:
|
||||
button = SDL_GAMEPAD_BUTTON_SOUTH;
|
||||
break;
|
||||
@@ -118,7 +118,7 @@ static int keycode_to_SDL(int keycode)
|
||||
button = 18;
|
||||
break;
|
||||
|
||||
/* D-Pad key codes (API 1) */
|
||||
// D-Pad key codes (API 1)
|
||||
case AKEYCODE_DPAD_UP:
|
||||
button = SDL_GAMEPAD_BUTTON_DPAD_UP;
|
||||
break;
|
||||
@@ -132,12 +132,12 @@ static int keycode_to_SDL(int keycode)
|
||||
button = SDL_GAMEPAD_BUTTON_DPAD_RIGHT;
|
||||
break;
|
||||
case AKEYCODE_DPAD_CENTER:
|
||||
/* This is handled better by applications as the A button */
|
||||
/*button = 19;*/
|
||||
// This is handled better by applications as the A button
|
||||
// button = 19;
|
||||
button = SDL_GAMEPAD_BUTTON_SOUTH;
|
||||
break;
|
||||
|
||||
/* More gamepad buttons (API 12), these get mapped to 20...35*/
|
||||
// More gamepad buttons (API 12), these get mapped to 20...35
|
||||
case AKEYCODE_BUTTON_1:
|
||||
case AKEYCODE_BUTTON_2:
|
||||
case AKEYCODE_BUTTON_3:
|
||||
@@ -159,7 +159,7 @@ static int keycode_to_SDL(int keycode)
|
||||
|
||||
default:
|
||||
return -1;
|
||||
/* break; -Wunreachable-code-break */
|
||||
// break; -Wunreachable-code-break
|
||||
}
|
||||
|
||||
/* This is here in case future generations, probably with six fingers per hand,
|
||||
@@ -190,7 +190,7 @@ static SDL_Scancode button_to_scancode(int button)
|
||||
return SDL_SCANCODE_RIGHT;
|
||||
}
|
||||
|
||||
/* Unsupported button */
|
||||
// Unsupported button
|
||||
return SDL_SCANCODE_UNKNOWN;
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ int Android_OnPadUp(int device_id, int keycode)
|
||||
int Android_OnJoy(int device_id, int axis, float value)
|
||||
{
|
||||
Uint64 timestamp = SDL_GetTicksNS();
|
||||
/* Android gives joy info normalized as [-1.0, 1.0] or [0.0, 1.0] */
|
||||
// Android gives joy info normalized as [-1.0, 1.0] or [0.0, 1.0]
|
||||
SDL_joylist_item *item;
|
||||
|
||||
SDL_LockJoysticks();
|
||||
@@ -311,7 +311,7 @@ int Android_AddJoystick(int device_id, const char *name, const char *desc, int v
|
||||
SDL_LockJoysticks();
|
||||
|
||||
if (!SDL_GetHintBoolean(SDL_HINT_TV_REMOTE_AS_JOYSTICK, SDL_TRUE)) {
|
||||
/* Ignore devices that aren't actually controllers (e.g. remotes), they'll be handled as keyboard input */
|
||||
// Ignore devices that aren't actually controllers (e.g. remotes), they'll be handled as keyboard input
|
||||
if (naxes < 2 && nhats < 1) {
|
||||
goto done;
|
||||
}
|
||||
@@ -330,7 +330,7 @@ int Android_AddJoystick(int device_id, const char *name, const char *desc, int v
|
||||
#endif
|
||||
|
||||
if (nhats > 0) {
|
||||
/* Hat is translated into DPAD buttons */
|
||||
// Hat is translated into DPAD buttons
|
||||
button_mask |= ((1 << SDL_GAMEPAD_BUTTON_DPAD_UP) |
|
||||
(1 << SDL_GAMEPAD_BUTTON_DPAD_DOWN) |
|
||||
(1 << SDL_GAMEPAD_BUTTON_DPAD_LEFT) |
|
||||
@@ -340,7 +340,7 @@ int Android_AddJoystick(int device_id, const char *name, const char *desc, int v
|
||||
|
||||
guid = SDL_CreateJoystickGUID(SDL_HARDWARE_BUS_BLUETOOTH, vendor_id, product_id, 0, NULL, desc, 0, 0);
|
||||
|
||||
/* Update the GUID with capability bits */
|
||||
// Update the GUID with capability bits
|
||||
{
|
||||
Uint16 *guid16 = (Uint16 *)guid.data;
|
||||
guid16[6] = SDL_Swap16LE(button_mask);
|
||||
@@ -381,7 +381,7 @@ int Android_AddJoystick(int device_id, const char *name, const char *desc, int v
|
||||
SDL_joylist_tail = item;
|
||||
}
|
||||
|
||||
/* Need to increment the joystick count before we post the event */
|
||||
// Need to increment the joystick count before we post the event
|
||||
++numjoysticks;
|
||||
|
||||
SDL_PrivateJoystickAdded(item->device_instance);
|
||||
@@ -406,7 +406,7 @@ int Android_RemoveJoystick(int device_id)
|
||||
|
||||
SDL_LockJoysticks();
|
||||
|
||||
/* Don't call JoystickByDeviceId here or there'll be an infinite loop! */
|
||||
// Don't call JoystickByDeviceId here or there'll be an infinite loop!
|
||||
while (item) {
|
||||
if (item->device_id == device_id) {
|
||||
break;
|
||||
@@ -433,7 +433,7 @@ int Android_RemoveJoystick(int device_id)
|
||||
SDL_joylist_tail = prev;
|
||||
}
|
||||
|
||||
/* Need to decrement the joystick count before we post the event */
|
||||
// Need to decrement the joystick count before we post the event
|
||||
--numjoysticks;
|
||||
|
||||
SDL_PrivateJoystickRemoved(item->device_instance);
|
||||
@@ -482,7 +482,7 @@ static void ANDROID_JoystickDetect(void)
|
||||
|
||||
static SDL_bool ANDROID_JoystickIsDevicePresent(Uint16 vendor_id, Uint16 product_id, Uint16 version, const char *name)
|
||||
{
|
||||
/* We don't override any other drivers */
|
||||
// We don't override any other drivers
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
@@ -514,7 +514,7 @@ static SDL_joylist_item *JoystickByDeviceId(int device_id)
|
||||
item = item->next;
|
||||
}
|
||||
|
||||
/* Joystick not found, try adding it */
|
||||
// Joystick not found, try adding it
|
||||
ANDROID_JoystickDetect();
|
||||
|
||||
while (item) {
|
||||
@@ -652,7 +652,7 @@ static void ANDROID_JoystickQuit(void)
|
||||
SDL_joylist = SDL_joylist_tail = NULL;
|
||||
|
||||
numjoysticks = 0;
|
||||
#endif /* 0 */
|
||||
#endif // 0
|
||||
}
|
||||
|
||||
static SDL_bool ANDROID_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out)
|
||||
@@ -684,4 +684,4 @@ SDL_JoystickDriver SDL_ANDROID_JoystickDriver = {
|
||||
ANDROID_JoystickGetGamepadMapping
|
||||
};
|
||||
|
||||
#endif /* SDL_JOYSTICK_ANDROID */
|
||||
#endif // SDL_JOYSTICK_ANDROID
|
||||
|
Reference in New Issue
Block a user