Added joystick and gamepad element display in testgamepad

This commit is contained in:
Sam Lantinga
2023-07-10 17:06:42 -07:00
parent 4a53dc5b8d
commit d44ada59fb
6 changed files with 1348 additions and 307 deletions

View File

@@ -10,24 +10,6 @@
freely.
*/
/* Joystick element display */
typedef struct JoystickDisplay JoystickDisplay;
extern JoystickDisplay *CreateJoystickDisplay(SDL_Renderer *renderer);
extern void SetJoystickDisplayArea(JoystickDisplay *ctx, int x, int y, int w, int h);
extern void UpdateJoystickDisplayFromJoystick(JoystickDisplay *ctx, SDL_Joystick *joystick);
extern void RenderJoystickDisplay(JoystickDisplay *ctx);
/* Gamepad element display */
typedef struct GamepadDisplay GamepadDisplay;
extern GamepadDisplay *CreateGamepadDisplay(SDL_Renderer *renderer);
extern void SetGamepadDisplayArea(GamepadDisplay *ctx, int x, int y, int w, int h);
extern void UpdateGamepadDisplayFromGamepad(GamepadDisplay *ctx, SDL_Gamepad *joystick);
extern void RenderGamepadDisplay(GamepadDisplay *ctx);
/* Gamepad image */
typedef struct GamepadImage GamepadImage;
@@ -53,3 +35,21 @@ extern void UpdateGamepadImageFromGamepad(GamepadImage *ctx, SDL_Gamepad *gamepa
extern void RenderGamepadImage(GamepadImage *ctx);
extern void DestroyGamepadImage(GamepadImage *ctx);
/* Gamepad element display */
typedef struct GamepadDisplay GamepadDisplay;
extern GamepadDisplay *CreateGamepadDisplay(SDL_Renderer *renderer);
extern void SetGamepadDisplayArea(GamepadDisplay *ctx, int x, int y, int w, int h);
extern void RenderGamepadDisplay(GamepadDisplay *ctx, SDL_Gamepad *gamepad);
extern void DestroyGamepadDisplay(GamepadDisplay *ctx);
/* Joystick element display */
typedef struct JoystickDisplay JoystickDisplay;
extern JoystickDisplay *CreateJoystickDisplay(SDL_Renderer *renderer);
extern void SetJoystickDisplayArea(JoystickDisplay *ctx, int x, int y, int w, int h);
extern void RenderJoystickDisplay(JoystickDisplay *ctx, SDL_Joystick *joystick);
extern void DestroyJoystickDisplay(JoystickDisplay *ctx);