SDL 2.0
SDL_sysjoystick.c
Go to the documentation of this file.
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20*/
21#include "../../SDL_internal.h"
22
23#if defined(SDL_JOYSTICK_DUMMY) || defined(SDL_JOYSTICK_DISABLED)
24
25/* This is the dummy implementation of the SDL joystick API */
26
27#include "SDL_joystick.h"
28#include "../SDL_sysjoystick.h"
29#include "../SDL_joystick_c.h"
30
31
32static int
33DUMMY_JoystickInit(void)
34{
35 return 0;
36}
37
38static int
39DUMMY_JoystickGetCount(void)
40{
41 return 0;
42}
43
44static void
45DUMMY_JoystickDetect(void)
46{
47}
48
49static const char *
50DUMMY_JoystickGetDeviceName(int device_index)
51{
52 return NULL;
53}
54
55static int
56DUMMY_JoystickGetDevicePlayerIndex(int device_index)
57{
58 return -1;
59}
60
62DUMMY_JoystickGetDeviceGUID(int device_index)
63{
65 SDL_zero(guid);
66 return guid;
67}
68
69static SDL_JoystickID
70DUMMY_JoystickGetDeviceInstanceID(int device_index)
71{
72 return -1;
73}
74
75static int
76DUMMY_JoystickOpen(SDL_Joystick * joystick, int device_index)
77{
78 return SDL_SetError("Logic error: No joysticks available");
79}
80
81static int
82DUMMY_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms)
83{
84 return SDL_Unsupported();
85}
86
87static void
88DUMMY_JoystickUpdate(SDL_Joystick * joystick)
89{
90}
91
92static void
93DUMMY_JoystickClose(SDL_Joystick * joystick)
94{
95}
96
97static void
98DUMMY_JoystickQuit(void)
99{
100}
101
103{
104 DUMMY_JoystickInit,
105 DUMMY_JoystickGetCount,
106 DUMMY_JoystickDetect,
107 DUMMY_JoystickGetDeviceName,
108 DUMMY_JoystickGetDevicePlayerIndex,
109 DUMMY_JoystickGetDeviceGUID,
110 DUMMY_JoystickGetDeviceInstanceID,
111 DUMMY_JoystickOpen,
112 DUMMY_JoystickRumble,
113 DUMMY_JoystickUpdate,
114 DUMMY_JoystickClose,
115 DUMMY_JoystickQuit,
116};
117
118#endif /* SDL_JOYSTICK_DUMMY || SDL_JOYSTICK_DISABLED */
119
120/* vi: set ts=4 sw=4 expandtab: */
#define SDL_SetError
#define SDL_Unsupported()
Definition: SDL_error.h:53
Sint32 SDL_JoystickID
Definition: SDL_joystick.h:81
#define SDL_zero(x)
Definition: SDL_stdinc.h:416
uint32_t Uint32
Definition: SDL_stdinc.h:203
uint16_t Uint16
Definition: SDL_stdinc.h:191
SDL_JoystickDriver SDL_DUMMY_JoystickDriver
#define NULL
Definition: begin_code.h:167