Changed enums to use XXX_COUNT for the count or number of values

Fixes https://github.com/libsdl-org/SDL/issues/10763
This commit is contained in:
Sam Lantinga
2024-09-11 08:08:18 -07:00
parent 64f12bea4a
commit 37c9fb490e
49 changed files with 197 additions and 174 deletions

View File

@@ -165,44 +165,30 @@ extern SDL_DECLSPEC char * SDLCALL SDL_GetPrefPath(const char *org, const char *
*/
typedef enum SDL_Folder
{
/** The folder which contains all of the current user's data, preferences,
and documents. It usually contains most of the other folders. If a
requested folder does not exist, the home folder can be considered a safe
fallback to store a user's documents. */
SDL_FOLDER_HOME,
/** The folder of files that are displayed on the desktop. Note that the
existence of a desktop folder does not guarantee that the system does
show icons on its desktop; certain GNU/Linux distros with a graphical
environment may not have desktop icons. */
SDL_FOLDER_DESKTOP,
/** User document files, possibly application-specific. This is a good
place to save a user's projects. */
SDL_FOLDER_DOCUMENTS,
/** Standard folder for user files downloaded from the internet. */
SDL_FOLDER_DOWNLOADS,
/** Music files that can be played using a standard music player (mp3,
ogg...). */
SDL_FOLDER_MUSIC,
/** Image files that can be displayed using a standard viewer (png,
jpg...). */
SDL_FOLDER_PICTURES,
/** Files that are meant to be shared with other users on the same
computer. */
SDL_FOLDER_PUBLICSHARE,
/** Save files for games. */
SDL_FOLDER_SAVEDGAMES,
/** Application screenshots. */
SDL_FOLDER_SCREENSHOTS,
/** Template files to be used when the user requests the desktop environment
to create a new file in a certain folder, such as "New Text File.txt".
Any file in the Templates folder can be used as a starting point for a
new file. */
SDL_FOLDER_TEMPLATES,
/** Video files that can be played using a standard video player (mp4,
webm...). */
SDL_FOLDER_VIDEOS,
/** total number of types in this enum, not a folder type by itself. */
SDL_FOLDER_TOTAL
SDL_FOLDER_HOME, /**< The folder which contains all of the current user's data, preferences, and documents. It usually contains most of the other folders. If a requested folder does not exist, the home folder can be considered a safe fallback to store a user's documents. */
SDL_FOLDER_DESKTOP, /**< The folder of files that are displayed on the desktop. Note that the existence of a desktop folder does not guarantee that the system does show icons on its desktop; certain GNU/Linux distros with a graphical environment may not have desktop icons. */
SDL_FOLDER_DOCUMENTS, /**< User document files, possibly application-specific. This is a good place to save a user's projects. */
SDL_FOLDER_DOWNLOADS, /**< Standard folder for user files downloaded from the internet. */
SDL_FOLDER_MUSIC, /**< Music files that can be played using a standard music player (mp3, ogg...). */
SDL_FOLDER_PICTURES, /**< Image files that can be displayed using a standard viewer (png, jpg...). */
SDL_FOLDER_PUBLICSHARE, /**< Files that are meant to be shared with other users on the same computer. */
SDL_FOLDER_SAVEDGAMES, /**< Save files for games. */
SDL_FOLDER_SCREENSHOTS, /**< Application screenshots. */
SDL_FOLDER_TEMPLATES, /**< Template files to be used when the user requests the desktop environment to create a new file in a certain folder, such as "New Text File.txt". Any file in the Templates folder can be used as a starting point for a new file. */
SDL_FOLDER_VIDEOS, /**< Video files that can be played using a standard video player (mp4, webm...). */
SDL_FOLDER_COUNT /**< Total number of types in this enum, not a folder type by itself. */
} SDL_Folder;
/**
@@ -243,11 +229,11 @@ typedef enum SDL_PathType
typedef struct SDL_PathInfo
{
SDL_PathType type; /* the path type */
Uint64 size; /* the file size in bytes */
SDL_Time create_time; /* the time when the path was created */
SDL_Time modify_time; /* the last time the path was modified */
SDL_Time access_time; /* the last time the path was read */
SDL_PathType type; /**< the path type */
Uint64 size; /**< the file size in bytes */
SDL_Time create_time; /**< the time when the path was created */
SDL_Time modify_time; /**< the last time the path was modified */
SDL_Time access_time; /**< the last time the path was read */
} SDL_PathInfo;
/**

View File

@@ -100,7 +100,7 @@ typedef enum SDL_GamepadType
SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_LEFT,
SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT,
SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_PAIR,
SDL_GAMEPAD_TYPE_MAX
SDL_GAMEPAD_TYPE_COUNT
} SDL_GamepadType;
/**
@@ -155,7 +155,7 @@ typedef enum SDL_GamepadButton
SDL_GAMEPAD_BUTTON_MISC4, /* Additional button */
SDL_GAMEPAD_BUTTON_MISC5, /* Additional button */
SDL_GAMEPAD_BUTTON_MISC6, /* Additional button */
SDL_GAMEPAD_BUTTON_MAX
SDL_GAMEPAD_BUTTON_COUNT
} SDL_GamepadButton;
/**
@@ -205,7 +205,7 @@ typedef enum SDL_GamepadAxis
SDL_GAMEPAD_AXIS_RIGHTY,
SDL_GAMEPAD_AXIS_LEFT_TRIGGER,
SDL_GAMEPAD_AXIS_RIGHT_TRIGGER,
SDL_GAMEPAD_AXIS_MAX
SDL_GAMEPAD_AXIS_COUNT
} SDL_GamepadAxis;
/**

View File

@@ -120,7 +120,8 @@ typedef enum SDL_JoystickType
SDL_JOYSTICK_TYPE_GUITAR,
SDL_JOYSTICK_TYPE_DRUM_KIT,
SDL_JOYSTICK_TYPE_ARCADE_PAD,
SDL_JOYSTICK_TYPE_THROTTLE
SDL_JOYSTICK_TYPE_THROTTLE,
SDL_JOYSTICK_TYPE_COUNT
} SDL_JoystickType;
/**

View File

@@ -126,7 +126,7 @@ typedef enum SDL_LogPriority
SDL_LOG_PRIORITY_WARN,
SDL_LOG_PRIORITY_ERROR,
SDL_LOG_PRIORITY_CRITICAL,
SDL_NUM_LOG_PRIORITIES
SDL_LOG_PRIORITY_COUNT
} SDL_LogPriority;

View File

@@ -96,7 +96,7 @@ typedef enum SDL_MessageBoxColorType
SDL_MESSAGEBOX_COLOR_BUTTON_BORDER,
SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND,
SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED,
SDL_MESSAGEBOX_COLOR_MAX /**< Size of the colors array of SDL_MessageBoxColorScheme. */
SDL_MESSAGEBOX_COLOR_COUNT /**< Size of the colors array of SDL_MessageBoxColorScheme. */
} SDL_MessageBoxColorType;
/**
@@ -106,7 +106,7 @@ typedef enum SDL_MessageBoxColorType
*/
typedef struct SDL_MessageBoxColorScheme
{
SDL_MessageBoxColor colors[SDL_MESSAGEBOX_COLOR_MAX];
SDL_MessageBoxColor colors[SDL_MESSAGEBOX_COLOR_COUNT];
} SDL_MessageBoxColorScheme;
/**

View File

@@ -87,7 +87,7 @@ typedef enum SDL_SystemCursor
SDL_SYSTEM_CURSOR_S_RESIZE, /**< Window resize bottom. May be NS_RESIZE. */
SDL_SYSTEM_CURSOR_SW_RESIZE, /**< Window resize bottom-left. May be NESW_RESIZE. */
SDL_SYSTEM_CURSOR_W_RESIZE, /**< Window resize left. May be EW_RESIZE. */
SDL_NUM_SYSTEM_CURSORS
SDL_SYSTEM_CURSOR_COUNT
} SDL_SystemCursor;
/**

View File

@@ -419,9 +419,14 @@
#define SDL_LogSetAllPriority SDL_SetLogPriorities
#define SDL_LogSetOutputFunction SDL_SetLogOutputFunction
#define SDL_LogSetPriority SDL_SetLogPriority
#define SDL_NUM_LOG_PRIORITIES SDL_LOG_PRIORITY_COUNT
/* ##SDL_messagebox.h */
#define SDL_MESSAGEBOX_COLOR_MAX SDL_MESSAGEBOX_COLOR_COUNT
/* ##SDL_mouse.h */
#define SDL_FreeCursor SDL_DestroyCursor
#define SDL_NUM_SYSTEM_CURSORS SDL_SYSTEM_CURSOR_COUNT
#define SDL_SYSTEM_CURSOR_ARROW SDL_SYSTEM_CURSOR_DEFAULT
#define SDL_SYSTEM_CURSOR_HAND SDL_SYSTEM_CURSOR_POINTER
#define SDL_SYSTEM_CURSOR_IBEAM SDL_SYSTEM_CURSOR_TEXT
@@ -558,6 +563,7 @@
#define SDL_WriteLE64 SDL_WriteU64LE
/* ##SDL_scancode.h */
#define SDL_NUM_SCANCODES SDL_SCANCODE_COUNT
#define SDL_SCANCODE_AUDIOFASTFORWARD SDL_SCANCODE_MEDIA_FAST_FORWARD
#define SDL_SCANCODE_AUDIOMUTE SDL_SCANCODE_MUTE
#define SDL_SCANCODE_AUDIONEXT SDL_SCANCODE_MEDIA_NEXT_TRACK
@@ -1043,9 +1049,14 @@
#define SDL_LogSetAllPriority SDL_LogSetAllPriority_renamed_SDL_SetLogPriorities
#define SDL_LogSetOutputFunction SDL_LogSetOutputFunction_renamed_SDL_SetLogOutputFunction
#define SDL_LogSetPriority SDL_LogSetPriority_renamed_SDL_SetLogPriority
#define SDL_NUM_LOG_PRIORITIES SDL_NUM_LOG_PRIORITIES_renamed_SDL_LOG_PRIORITY_COUNT
/* ##SDL_messagebox.h */
#define SDL_MESSAGEBOX_COLOR_MAX SDL_MESSAGEBOX_COLOR_MAX_renamed_SDL_MESSAGEBOX_COLOR_COUNT
/* ##SDL_mouse.h */
#define SDL_FreeCursor SDL_FreeCursor_renamed_SDL_DestroyCursor
#define SDL_NUM_SYSTEM_CURSORS SDL_NUM_SYSTEM_CURSORS_renamed_SDL_SYSTEM_CURSOR_COUNT
#define SDL_SYSTEM_CURSOR_ARROW SDL_SYSTEM_CURSOR_ARROW_renamed_SDL_SYSTEM_CURSOR_DEFAULT
#define SDL_SYSTEM_CURSOR_HAND SDL_SYSTEM_CURSOR_HAND_renamed_SDL_SYSTEM_CURSOR_POINTER
#define SDL_SYSTEM_CURSOR_IBEAM SDL_SYSTEM_CURSOR_IBEAM_renamed_SDL_SYSTEM_CURSOR_TEXT
@@ -1182,6 +1193,7 @@
#define SDL_WriteLE64 SDL_WriteLE64_renamed_SDL_WriteU64LE
/* ##SDL_scancode.h */
#define SDL_NUM_SCANCODES SDL_NUM_SCANCODES_renamed_SDL_SCANCODE_COUNT
#define SDL_SCANCODE_AUDIOFASTFORWARD SDL_SCANCODE_AUDIOFASTFORWARD_renamed_SDL_SCANCODE_MEDIA_FAST_FORWARD
#define SDL_SCANCODE_AUDIOMUTE SDL_SCANCODE_AUDIOMUTE_renamed_SDL_SCANCODE_MUTE
#define SDL_SCANCODE_AUDIONEXT SDL_SCANCODE_AUDIONEXT_renamed_SDL_SCANCODE_MEDIA_NEXT_TRACK

View File

@@ -101,7 +101,7 @@ typedef enum SDL_PenAxis
SDL_PEN_AXIS_ROTATION, /**< Pen barrel rotation. Bidirectional: -180 to 179.9 (clockwise, 0 is facing up, -180.0 is facing down). */
SDL_PEN_AXIS_SLIDER, /**< Pen finger wheel or slider (e.g., Airbrush Pen). Unidirectional: 0 to 1.0 */
SDL_PEN_AXIS_TANGENTIAL_PRESSURE, /**< Pressure from squeezing the pen ("barrel pressure"). */
SDL_PEN_NUM_AXES /**< Total known pen axis types in this version of SDL. This number may grow in future releases! */
SDL_PEN_AXIS_COUNT /**< Total known pen axis types in this version of SDL. This number may grow in future releases! */
} SDL_PenAxis;
/* Ends C function definitions when using C++ */

View File

@@ -417,8 +417,8 @@ typedef enum SDL_Scancode
SDL_SCANCODE_RESERVED = 400, /**< 400-500 reserved for dynamic keycodes */
SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes
for array bounds */
SDL_SCANCODE_COUNT = 512 /**< not a key, just marks the number of scancodes for array bounds */
} SDL_Scancode;
#endif /* SDL_scancode_h_ */