@kmamal/sdl 0.9.4 → 0.9.6-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -15
- package/binding.gyp +25 -5
- package/package.json +7 -4
- package/src/javascript/audio/audio-instance.js +9 -6
- package/src/javascript/cleanup.js +1 -1
- package/src/javascript/clipboard/index.js +2 -1
- package/src/javascript/controller/controller-instance.js +6 -0
- package/src/javascript/enums.js +1 -1
- package/src/javascript/events/index.js +302 -305
- package/src/javascript/index.js +1 -1
- package/src/javascript/joystick/joystick-instance.js +7 -0
- package/src/javascript/keyboard/index.js +3 -3
- package/src/javascript/keyboard/key-mapping.js +14 -6
- package/src/javascript/mouse/index.js +13 -12
- package/src/javascript/power/index.js +0 -2
- package/src/javascript/sensor/sensor-instance.js +1 -5
- package/src/javascript/video/window.js +17 -16
- package/src/native/audio.cpp +178 -0
- package/src/native/audio.h +21 -0
- package/src/native/clipboard.cpp +45 -0
- package/src/native/clipboard.h +13 -0
- package/src/native/cocoa-global.h +8 -0
- package/src/native/cocoa-global.mm +8 -0
- package/src/native/cocoa-window.h +9 -4
- package/src/native/cocoa-window.mm +6 -9
- package/src/native/controller.cpp +154 -0
- package/src/native/controller.h +17 -0
- package/src/native/enums.cpp +477 -0
- package/src/native/enums.h +67 -0
- package/src/native/events.cpp +339 -0
- package/src/native/events.h +15 -0
- package/src/native/global.cpp +187 -0
- package/src/native/global.h +15 -0
- package/src/native/joystick.cpp +388 -0
- package/src/native/joystick.h +22 -0
- package/src/native/keyboard.cpp +55 -0
- package/src/native/keyboard.h +18 -0
- package/src/native/module.cpp +98 -0
- package/src/native/mouse.cpp +186 -0
- package/src/native/mouse.h +21 -0
- package/src/native/power.cpp +18 -0
- package/src/native/power.h +12 -0
- package/src/native/sensor.cpp +117 -0
- package/src/native/sensor.h +15 -0
- package/src/native/video.cpp +90 -0
- package/src/native/video.h +12 -0
- package/src/native/window.cpp +755 -0
- package/src/native/window.h +29 -0
- package/src/types/index.d.ts +7 -4
- package/scripts/test.mjs +0 -12
- package/src/native/asprintf.c +0 -47
- package/src/native/asprintf.h +0 -37
- package/src/native/binding.cpp +0 -1680
- package/src/native/sdl-helpers.cpp +0 -2619
- package/src/native/sdl-helpers.h +0 -182
package/src/native/sdl-helpers.h
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
#ifndef _SDL_H_
|
|
2
|
-
#define _SDL_H_
|
|
3
|
-
|
|
4
|
-
#include <variant>
|
|
5
|
-
#include <map>
|
|
6
|
-
#include <vector>
|
|
7
|
-
#include <string>
|
|
8
|
-
|
|
9
|
-
namespace SdlHelpers {
|
|
10
|
-
|
|
11
|
-
class ErrorMessage
|
|
12
|
-
{
|
|
13
|
-
public:
|
|
14
|
-
|
|
15
|
-
ErrorMessage(const char * _message, bool _should_dispose = true);
|
|
16
|
-
~ErrorMessage();
|
|
17
|
-
|
|
18
|
-
const char * message;
|
|
19
|
-
bool should_dispose;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class Variant : public std::variant<
|
|
24
|
-
std::monostate, // 0
|
|
25
|
-
std::map<const char *, Variant>, // 1
|
|
26
|
-
std::vector<Variant>, // 2
|
|
27
|
-
double, // 3
|
|
28
|
-
const char *, // 4
|
|
29
|
-
bool // 5
|
|
30
|
-
> {} ;
|
|
31
|
-
using VariantMap = std::map<const char *, Variant>;
|
|
32
|
-
using VariantList = std::vector<Variant>;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
ErrorMessage * enum_getEventFamilies (Variant & object);
|
|
36
|
-
ErrorMessage * enum_getEventTypes (Variant & object);
|
|
37
|
-
ErrorMessage * enum_getPixelFormats (Variant & object);
|
|
38
|
-
ErrorMessage * enum_getAudioFormats (Variant & object);
|
|
39
|
-
ErrorMessage * enum_getScancodes (Variant & object);
|
|
40
|
-
ErrorMessage * enum_getMouseButtons (Variant & object);
|
|
41
|
-
ErrorMessage * enum_getCursors (Variant & object);
|
|
42
|
-
ErrorMessage * enum_getHatPositions (Variant & object);
|
|
43
|
-
ErrorMessage * enum_getPowerLevels (Variant & object);
|
|
44
|
-
ErrorMessage * enum_getJoystickTypes (Variant & object);
|
|
45
|
-
ErrorMessage * enum_getControllerAxes (Variant & object);
|
|
46
|
-
ErrorMessage * enum_getControllerButtons (Variant & object);
|
|
47
|
-
ErrorMessage * enum_getSensorTypes (Variant & object);
|
|
48
|
-
ErrorMessage * enum_getPowerStates (Variant & object);
|
|
49
|
-
|
|
50
|
-
ErrorMessage * initialize (Variant & object);
|
|
51
|
-
ErrorMessage * cleanup ();
|
|
52
|
-
|
|
53
|
-
ErrorMessage * events_poll (Variant & event);
|
|
54
|
-
ErrorMessage * events_wait (int timeout, Variant & event);
|
|
55
|
-
|
|
56
|
-
ErrorMessage * video_getDisplays (Variant & list);
|
|
57
|
-
|
|
58
|
-
ErrorMessage * window_create (
|
|
59
|
-
const char * title, int display,
|
|
60
|
-
int ** x, int ** y, int ** width, int ** height,
|
|
61
|
-
int * pixel_width, int * pixel_height,
|
|
62
|
-
bool visible,
|
|
63
|
-
bool * fullscreen,
|
|
64
|
-
bool * resizable,
|
|
65
|
-
bool * borderless,
|
|
66
|
-
bool * alwaysOnTop,
|
|
67
|
-
bool * accelerated,
|
|
68
|
-
bool * vsync,
|
|
69
|
-
bool opengl,
|
|
70
|
-
bool webgpu,
|
|
71
|
-
bool * skipTaskbar,
|
|
72
|
-
bool * popupMenu,
|
|
73
|
-
bool * tooltip,
|
|
74
|
-
bool * utility,
|
|
75
|
-
int * window_id, void ** native_pointer, int * native_size
|
|
76
|
-
);
|
|
77
|
-
ErrorMessage * window_setTitle (int window_id, const char * title);
|
|
78
|
-
ErrorMessage * window_setPosition (int window_id, int x, int y);
|
|
79
|
-
ErrorMessage * window_setSize (
|
|
80
|
-
int window_id, int width, int height,
|
|
81
|
-
int * pixel_width, int * pixel_height
|
|
82
|
-
);
|
|
83
|
-
ErrorMessage * window_setFullscreen (int window_id, bool * fullscreen);
|
|
84
|
-
ErrorMessage * window_setResizable (int window_id, bool * resizable);
|
|
85
|
-
ErrorMessage * window_setBorderless (int window_id, bool * borderless);
|
|
86
|
-
ErrorMessage * window_setAcceleratedAndVsync (
|
|
87
|
-
int window_id,
|
|
88
|
-
bool * accelerated,
|
|
89
|
-
bool * vsync
|
|
90
|
-
);
|
|
91
|
-
ErrorMessage * window_focus (int window_id);
|
|
92
|
-
ErrorMessage * window_show (int window_id);
|
|
93
|
-
ErrorMessage * window_hide (int window_id);
|
|
94
|
-
ErrorMessage * window_maximize (int window_id);
|
|
95
|
-
ErrorMessage * window_minimize (int window_id);
|
|
96
|
-
ErrorMessage * window_restore (int window_id);
|
|
97
|
-
ErrorMessage * window_render (
|
|
98
|
-
int window_id,
|
|
99
|
-
int w, int h, int stride,
|
|
100
|
-
unsigned int format,
|
|
101
|
-
void * pixels
|
|
102
|
-
);
|
|
103
|
-
ErrorMessage * window_setIcon (
|
|
104
|
-
int window_id,
|
|
105
|
-
int w, int h, int stride,
|
|
106
|
-
unsigned int format,
|
|
107
|
-
void * pixels
|
|
108
|
-
);
|
|
109
|
-
ErrorMessage * window_flash (int window_id, int type);
|
|
110
|
-
ErrorMessage * window_destroy (int window_id);
|
|
111
|
-
|
|
112
|
-
ErrorMessage * keyboard_getKey (int scancode, const char ** key);
|
|
113
|
-
ErrorMessage * keyboard_getScancode (const char * key, int * scancode);
|
|
114
|
-
ErrorMessage * keyboard_getState (Variant & list);
|
|
115
|
-
|
|
116
|
-
ErrorMessage * mouse_getButton (int button, int * state);
|
|
117
|
-
ErrorMessage * mouse_getPosition (Variant & position);
|
|
118
|
-
ErrorMessage * mouse_setPosition (int x, int y);
|
|
119
|
-
ErrorMessage * mouse_capture (bool capture);
|
|
120
|
-
ErrorMessage * mouse_setCursor (int cursor_id);
|
|
121
|
-
ErrorMessage * mouse_setCursorImage (
|
|
122
|
-
int w, int h, int stride,
|
|
123
|
-
unsigned int format,
|
|
124
|
-
void * pixels,
|
|
125
|
-
int x, int y
|
|
126
|
-
);
|
|
127
|
-
ErrorMessage * mouse_showCursor (bool show);
|
|
128
|
-
|
|
129
|
-
ErrorMessage * joystick_getDevices (Variant & list);
|
|
130
|
-
ErrorMessage * joystick_open (int index, Variant & device);
|
|
131
|
-
ErrorMessage * joystick_close (int joystick_id);
|
|
132
|
-
ErrorMessage * joystick_getPower (int joystick_id, int * power);
|
|
133
|
-
ErrorMessage * joystick_setLed (
|
|
134
|
-
int joystick_id,
|
|
135
|
-
double red,
|
|
136
|
-
double green,
|
|
137
|
-
double blue
|
|
138
|
-
);
|
|
139
|
-
ErrorMessage * joystick_setPlayer (int joystick_id, int player);
|
|
140
|
-
ErrorMessage * joystick_rumble (
|
|
141
|
-
int joystick_id,
|
|
142
|
-
double low_freq_rumble,
|
|
143
|
-
double high_freq_rumble,
|
|
144
|
-
int duration
|
|
145
|
-
);
|
|
146
|
-
ErrorMessage * joystick_rumbleTriggers (
|
|
147
|
-
int joystick_id,
|
|
148
|
-
double left_rumble,
|
|
149
|
-
double right_rumble,
|
|
150
|
-
int duration
|
|
151
|
-
);
|
|
152
|
-
|
|
153
|
-
ErrorMessage * controller_open (int index, Variant & object);
|
|
154
|
-
ErrorMessage * controller_close (int controller_id);
|
|
155
|
-
ErrorMessage * controller_addMappings (char ** mappings, int length);
|
|
156
|
-
|
|
157
|
-
ErrorMessage * sensor_getDevices (Variant & list);
|
|
158
|
-
ErrorMessage * sensor_open (int index);
|
|
159
|
-
ErrorMessage * sensor_close (int sensor_id);
|
|
160
|
-
ErrorMessage * sensor_getData (int sensor_id, Variant & object);
|
|
161
|
-
|
|
162
|
-
ErrorMessage * audio_getDevices (bool capture, Variant & list);
|
|
163
|
-
ErrorMessage * audio_openDevice (
|
|
164
|
-
const char * name, bool capture,
|
|
165
|
-
int freq, int format, int channels, int samples,
|
|
166
|
-
int * audio_id
|
|
167
|
-
);
|
|
168
|
-
ErrorMessage * audio_close (int audio_id);
|
|
169
|
-
ErrorMessage * audio_play (int audio_id, bool play);
|
|
170
|
-
ErrorMessage * audio_getQueueSize (int audio_id, unsigned int * size);
|
|
171
|
-
ErrorMessage * audio_clearQueue (int audio_id);
|
|
172
|
-
ErrorMessage * audio_enqueue (int audio_id, void * src, int size);
|
|
173
|
-
ErrorMessage * audio_dequeue (int audio_id, void * dst, int size, int * num);
|
|
174
|
-
|
|
175
|
-
ErrorMessage * clipboard_getText (const char ** text);
|
|
176
|
-
ErrorMessage * clipboard_setText (const char * text);
|
|
177
|
-
|
|
178
|
-
ErrorMessage * power_getInfo (Variant & info);
|
|
179
|
-
|
|
180
|
-
} // namespace
|
|
181
|
-
|
|
182
|
-
#endif // _SDL_H_
|