@dayme/bunraylib 0.1.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 +31 -0
- package/package.json +39 -0
- package/src/Raylib.ts +3679 -0
- package/src/c/audio.c +344 -0
- package/src/c/camera.c +161 -0
- package/src/c/collision.c +176 -0
- package/src/c/color.c +100 -0
- package/src/c/common.h +67 -0
- package/src/c/draw3d.c +222 -0
- package/src/c/filesystem.c +36 -0
- package/src/c/font.c +163 -0
- package/src/c/image.c +458 -0
- package/src/c/input.c +85 -0
- package/src/c/model.c +243 -0
- package/src/c/registries.c +111 -0
- package/src/c/shader.c +56 -0
- package/src/c/shapes.c +283 -0
- package/src/c/texture.c +139 -0
- package/src/c/window.c +150 -0
- package/src/constants.ts +396 -0
- package/src/index.ts +29 -0
- package/src/main.c +15 -0
- package/src/main.d.ts +4 -0
- package/src/symbols/audio.ts +64 -0
- package/src/symbols/camera.ts +46 -0
- package/src/symbols/collision.ts +116 -0
- package/src/symbols/color.ts +22 -0
- package/src/symbols/draw3d.ts +137 -0
- package/src/symbols/filesystem.ts +30 -0
- package/src/symbols/font.ts +40 -0
- package/src/symbols/image.ts +90 -0
- package/src/symbols/input.ts +51 -0
- package/src/symbols/model.ts +38 -0
- package/src/symbols/shader.ts +15 -0
- package/src/symbols/shapes.ts +92 -0
- package/src/symbols/texture.ts +56 -0
- package/src/symbols/window.ts +83 -0
- package/src/symbols.ts +131 -0
- package/src/types.ts +73 -0
- package/src/utils.ts +25 -0
package/src/c/image.c
ADDED
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
#include "common.h"
|
|
2
|
+
|
|
3
|
+
int LoadImageW(const char* fileName) {
|
|
4
|
+
int slot = imageAlloc();
|
|
5
|
+
if (slot < 0) return -1;
|
|
6
|
+
imageRegistry[slot] = LoadImage(fileName);
|
|
7
|
+
return slot;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
int LoadImageRawW(const char* fileName, int width, int height, int format, int headerSize) {
|
|
11
|
+
int slot = imageAlloc();
|
|
12
|
+
if (slot < 0) return -1;
|
|
13
|
+
imageRegistry[slot] = LoadImageRaw(fileName, width, height, format, headerSize);
|
|
14
|
+
return slot;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
void LoadImageAnimW(int* outSlot, int* outFrames, const char* fileName) {
|
|
18
|
+
int slot = imageAlloc();
|
|
19
|
+
if (slot < 0) { *outSlot = -1; *outFrames = 0; return; }
|
|
20
|
+
imageRegistry[slot] = LoadImageAnim(fileName, outFrames);
|
|
21
|
+
*outSlot = slot;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
int LoadImageFromMemoryW(const char* fileType, const unsigned char* fileData, int dataSize) {
|
|
25
|
+
int slot = imageAlloc();
|
|
26
|
+
if (slot < 0) return -1;
|
|
27
|
+
imageRegistry[slot] = LoadImageFromMemory(fileType, fileData, dataSize);
|
|
28
|
+
return slot;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
int LoadImageFromTextureW(unsigned int texId, int texW, int texH) {
|
|
32
|
+
int slot = imageAlloc();
|
|
33
|
+
if (slot < 0) return -1;
|
|
34
|
+
Texture2D tex = { texId, texW, texH, 1, 7 };
|
|
35
|
+
imageRegistry[slot] = LoadImageFromTexture(tex);
|
|
36
|
+
return slot;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
int LoadImageFromScreenW() {
|
|
40
|
+
int slot = imageAlloc();
|
|
41
|
+
if (slot < 0) return -1;
|
|
42
|
+
imageRegistry[slot] = LoadImageFromScreen();
|
|
43
|
+
return slot;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
bool IsImageValidW(int id) {
|
|
47
|
+
if (id < 0 || id >= MAX_IMAGES || !imageUsed[id]) return false;
|
|
48
|
+
return IsImageValid(imageRegistry[id]);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
void UnloadImageW(int id) {
|
|
52
|
+
if (id < 0 || id >= MAX_IMAGES || !imageUsed[id]) return;
|
|
53
|
+
UnloadImage(imageRegistry[id]);
|
|
54
|
+
imageUsed[id] = false;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
bool ExportImageW(int id, const char* fileName) {
|
|
58
|
+
if (id < 0 || id >= MAX_IMAGES || !imageUsed[id]) return false;
|
|
59
|
+
return ExportImage(imageRegistry[id], fileName);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
bool ExportImageAsCodeW(int id, const char* fileName) {
|
|
63
|
+
if (id < 0 || id >= MAX_IMAGES || !imageUsed[id]) return false;
|
|
64
|
+
return ExportImageAsCode(imageRegistry[id], fileName);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
int GenImageColorW(int width, int height, Color color) {
|
|
68
|
+
int slot = imageAlloc();
|
|
69
|
+
if (slot < 0) return -1;
|
|
70
|
+
imageRegistry[slot] = GenImageColor(width, height, color);
|
|
71
|
+
return slot;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
int GenImageGradientLinearW(int width, int height, int direction, Color start, Color end) {
|
|
75
|
+
int slot = imageAlloc();
|
|
76
|
+
if (slot < 0) return -1;
|
|
77
|
+
imageRegistry[slot] = GenImageGradientLinear(width, height, direction, start, end);
|
|
78
|
+
return slot;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
int GenImageGradientRadialW(int width, int height, int density, Color inner, Color outer) {
|
|
82
|
+
float d;
|
|
83
|
+
memcpy(&d, &density, sizeof(float));
|
|
84
|
+
int slot = imageAlloc();
|
|
85
|
+
if (slot < 0) return -1;
|
|
86
|
+
imageRegistry[slot] = GenImageGradientRadial(width, height, d, inner, outer);
|
|
87
|
+
return slot;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
int GenImageGradientSquareW(int width, int height, int density, Color inner, Color outer) {
|
|
91
|
+
float d;
|
|
92
|
+
memcpy(&d, &density, sizeof(float));
|
|
93
|
+
int slot = imageAlloc();
|
|
94
|
+
if (slot < 0) return -1;
|
|
95
|
+
imageRegistry[slot] = GenImageGradientSquare(width, height, d, inner, outer);
|
|
96
|
+
return slot;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
int GenImageCheckedW(int width, int height, int checksX, int checksY, Color col1, Color col2) {
|
|
100
|
+
int slot = imageAlloc();
|
|
101
|
+
if (slot < 0) return -1;
|
|
102
|
+
imageRegistry[slot] = GenImageChecked(width, height, checksX, checksY, col1, col2);
|
|
103
|
+
return slot;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
int GenImageWhiteNoiseW(int width, int height, int factor) {
|
|
107
|
+
float f;
|
|
108
|
+
memcpy(&f, &factor, sizeof(float));
|
|
109
|
+
int slot = imageAlloc();
|
|
110
|
+
if (slot < 0) return -1;
|
|
111
|
+
imageRegistry[slot] = GenImageWhiteNoise(width, height, f);
|
|
112
|
+
return slot;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
int GenImagePerlinNoiseW(int width, int height, int offsetX, int offsetY, int scale) {
|
|
116
|
+
float s;
|
|
117
|
+
memcpy(&s, &scale, sizeof(float));
|
|
118
|
+
int slot = imageAlloc();
|
|
119
|
+
if (slot < 0) return -1;
|
|
120
|
+
imageRegistry[slot] = GenImagePerlinNoise(width, height, offsetX, offsetY, s);
|
|
121
|
+
return slot;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
int GenImageCellularW(int width, int height, int tileSize) {
|
|
125
|
+
int slot = imageAlloc();
|
|
126
|
+
if (slot < 0) return -1;
|
|
127
|
+
imageRegistry[slot] = GenImageCellular(width, height, tileSize);
|
|
128
|
+
return slot;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
int GenImageTextW(int width, int height, const char* text) {
|
|
132
|
+
int slot = imageAlloc();
|
|
133
|
+
if (slot < 0) return -1;
|
|
134
|
+
imageRegistry[slot] = GenImageText(width, height, text);
|
|
135
|
+
return slot;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
int ImageCopyW(int id) {
|
|
139
|
+
if (id < 0 || id >= MAX_IMAGES || !imageUsed[id]) return -1;
|
|
140
|
+
int slot = imageAlloc();
|
|
141
|
+
if (slot < 0) return -1;
|
|
142
|
+
imageRegistry[slot] = ImageCopy(imageRegistry[id]);
|
|
143
|
+
return slot;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
int ImageFromImageW(int id, int rx, int ry, int rw, int rh) {
|
|
147
|
+
if (id < 0 || id >= MAX_IMAGES || !imageUsed[id]) return -1;
|
|
148
|
+
int slot = imageAlloc();
|
|
149
|
+
if (slot < 0) return -1;
|
|
150
|
+
Rectangle rec = { rx, ry, rw, rh };
|
|
151
|
+
imageRegistry[slot] = ImageFromImage(imageRegistry[id], rec);
|
|
152
|
+
return slot;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
int ImageFromChannelW(int id, int selectedChannel) {
|
|
156
|
+
if (id < 0 || id >= MAX_IMAGES || !imageUsed[id]) return -1;
|
|
157
|
+
int slot = imageAlloc();
|
|
158
|
+
if (slot < 0) return -1;
|
|
159
|
+
imageRegistry[slot] = ImageFromChannel(imageRegistry[id], selectedChannel);
|
|
160
|
+
return slot;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
int ImageTextW(const char* text, int fontSize, Color color) {
|
|
164
|
+
int slot = imageAlloc();
|
|
165
|
+
if (slot < 0) return -1;
|
|
166
|
+
imageRegistry[slot] = ImageText(text, fontSize, color);
|
|
167
|
+
return slot;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
int ImageTextExW(int fontId, const char* text, int fontSize, int spacing, Color tint) {
|
|
171
|
+
float sp;
|
|
172
|
+
memcpy(&sp, &spacing, sizeof(float));
|
|
173
|
+
int slot = imageAlloc();
|
|
174
|
+
if (slot < 0) return -1;
|
|
175
|
+
imageRegistry[slot] = ImageTextEx(fontRegistry[fontId], text, fontSize, sp, tint);
|
|
176
|
+
return slot;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
void ImageFormatW(int id, int newFormat) {
|
|
180
|
+
if (id < 0 || id >= MAX_IMAGES || !imageUsed[id]) return;
|
|
181
|
+
ImageFormat(&imageRegistry[id], newFormat);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
void ImageCropW(int id, int rx, int ry, int rw, int rh) {
|
|
185
|
+
if (id < 0 || id >= MAX_IMAGES || !imageUsed[id]) return;
|
|
186
|
+
Rectangle rec = { rx, ry, rw, rh };
|
|
187
|
+
ImageCrop(&imageRegistry[id], rec);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
void ImageAlphaCropW(int id, int threshold) {
|
|
191
|
+
if (id < 0 || id >= MAX_IMAGES || !imageUsed[id]) return;
|
|
192
|
+
float t;
|
|
193
|
+
memcpy(&t, &threshold, sizeof(float));
|
|
194
|
+
ImageAlphaCrop(&imageRegistry[id], t);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
void ImageAlphaClearW(int id, Color color, int threshold) {
|
|
198
|
+
if (id < 0 || id >= MAX_IMAGES || !imageUsed[id]) return;
|
|
199
|
+
float t;
|
|
200
|
+
memcpy(&t, &threshold, sizeof(float));
|
|
201
|
+
ImageAlphaClear(&imageRegistry[id], color, t);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
void ImageAlphaMaskW(int id, int alphaMaskId) {
|
|
205
|
+
if (id < 0 || id >= MAX_IMAGES || !imageUsed[id]) return;
|
|
206
|
+
if (alphaMaskId < 0 || alphaMaskId >= MAX_IMAGES || !imageUsed[alphaMaskId]) return;
|
|
207
|
+
ImageAlphaMask(&imageRegistry[id], imageRegistry[alphaMaskId]);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
void ImageAlphaPremultiplyW(int id) {
|
|
211
|
+
if (id < 0 || id >= MAX_IMAGES || !imageUsed[id]) return;
|
|
212
|
+
ImageAlphaPremultiply(&imageRegistry[id]);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
void ImageBlurGaussianW(int id, int blurSize) {
|
|
216
|
+
if (id < 0 || id >= MAX_IMAGES || !imageUsed[id]) return;
|
|
217
|
+
ImageBlurGaussian(&imageRegistry[id], blurSize);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
void ImageResizeW(int id, int newWidth, int newHeight) {
|
|
221
|
+
if (id < 0 || id >= MAX_IMAGES || !imageUsed[id]) return;
|
|
222
|
+
ImageResize(&imageRegistry[id], newWidth, newHeight);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
void ImageResizeNNW(int id, int newWidth, int newHeight) {
|
|
226
|
+
if (id < 0 || id >= MAX_IMAGES || !imageUsed[id]) return;
|
|
227
|
+
ImageResizeNN(&imageRegistry[id], newWidth, newHeight);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
void ImageResizeCanvasW(int id, int newWidth, int newHeight, int offsetX, int offsetY, Color fill) {
|
|
231
|
+
if (id < 0 || id >= MAX_IMAGES || !imageUsed[id]) return;
|
|
232
|
+
ImageResizeCanvas(&imageRegistry[id], newWidth, newHeight, offsetX, offsetY, fill);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
void ImageMipmapsW(int id) {
|
|
236
|
+
if (id < 0 || id >= MAX_IMAGES || !imageUsed[id]) return;
|
|
237
|
+
ImageMipmaps(&imageRegistry[id]);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
void ImageDitherW(int id, int rBpp, int gBpp, int bBpp, int aBpp) {
|
|
241
|
+
if (id < 0 || id >= MAX_IMAGES || !imageUsed[id]) return;
|
|
242
|
+
ImageDither(&imageRegistry[id], rBpp, gBpp, bBpp, aBpp);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
void ImageFlipVerticalW(int id) {
|
|
246
|
+
if (id < 0 || id >= MAX_IMAGES || !imageUsed[id]) return;
|
|
247
|
+
ImageFlipVertical(&imageRegistry[id]);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
void ImageFlipHorizontalW(int id) {
|
|
251
|
+
if (id < 0 || id >= MAX_IMAGES || !imageUsed[id]) return;
|
|
252
|
+
ImageFlipHorizontal(&imageRegistry[id]);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
void ImageRotateW(int id, int degrees) {
|
|
256
|
+
if (id < 0 || id >= MAX_IMAGES || !imageUsed[id]) return;
|
|
257
|
+
float d;
|
|
258
|
+
memcpy(&d, °rees, sizeof(float));
|
|
259
|
+
ImageRotate(&imageRegistry[id], d);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
void ImageRotateCWW(int id) {
|
|
263
|
+
if (id < 0 || id >= MAX_IMAGES || !imageUsed[id]) return;
|
|
264
|
+
ImageRotateCW(&imageRegistry[id]);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
void ImageRotateCCWW(int id) {
|
|
268
|
+
if (id < 0 || id >= MAX_IMAGES || !imageUsed[id]) return;
|
|
269
|
+
ImageRotateCCW(&imageRegistry[id]);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
void ImageColorTintW(int id, Color color) {
|
|
273
|
+
if (id < 0 || id >= MAX_IMAGES || !imageUsed[id]) return;
|
|
274
|
+
ImageColorTint(&imageRegistry[id], color);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
void ImageColorInvertW(int id) {
|
|
278
|
+
if (id < 0 || id >= MAX_IMAGES || !imageUsed[id]) return;
|
|
279
|
+
ImageColorInvert(&imageRegistry[id]);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
void ImageColorGrayscaleW(int id) {
|
|
283
|
+
if (id < 0 || id >= MAX_IMAGES || !imageUsed[id]) return;
|
|
284
|
+
ImageColorGrayscale(&imageRegistry[id]);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
void ImageColorContrastW(int id, int contrast) {
|
|
288
|
+
if (id < 0 || id >= MAX_IMAGES || !imageUsed[id]) return;
|
|
289
|
+
float c;
|
|
290
|
+
memcpy(&c, &contrast, sizeof(float));
|
|
291
|
+
ImageColorContrast(&imageRegistry[id], c);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
void ImageColorBrightnessW(int id, int brightness) {
|
|
295
|
+
if (id < 0 || id >= MAX_IMAGES || !imageUsed[id]) return;
|
|
296
|
+
ImageColorBrightness(&imageRegistry[id], brightness);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
void ImageColorReplaceW(int id, Color color, Color replace) {
|
|
300
|
+
if (id < 0 || id >= MAX_IMAGES || !imageUsed[id]) return;
|
|
301
|
+
ImageColorReplace(&imageRegistry[id], color, replace);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
void GetImageAlphaBorderW(float* out, int id, int threshold) {
|
|
305
|
+
Rectangle rec = {0};
|
|
306
|
+
if (id >= 0 && id < MAX_IMAGES && imageUsed[id]) {
|
|
307
|
+
float t;
|
|
308
|
+
memcpy(&t, &threshold, sizeof(float));
|
|
309
|
+
rec = GetImageAlphaBorder(imageRegistry[id], t);
|
|
310
|
+
}
|
|
311
|
+
out[0] = rec.x; out[1] = rec.y; out[2] = rec.width; out[3] = rec.height;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
int GetImageColorW(int id, int x, int y) {
|
|
315
|
+
if (id < 0 || id >= MAX_IMAGES || !imageUsed[id]) return 0;
|
|
316
|
+
Color c = GetImageColor(imageRegistry[id], x, y);
|
|
317
|
+
return *((int*)&c);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
void ImageClearBackgroundW(int dstId, Color color) {
|
|
321
|
+
if (dstId < 0 || dstId >= MAX_IMAGES || !imageUsed[dstId]) return;
|
|
322
|
+
ImageClearBackground(&imageRegistry[dstId], color);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
void ImageDrawPixelW(int dstId, int posX, int posY, Color color) {
|
|
326
|
+
if (dstId < 0 || dstId >= MAX_IMAGES || !imageUsed[dstId]) return;
|
|
327
|
+
ImageDrawPixel(&imageRegistry[dstId], posX, posY, color);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
void ImageDrawPixelVW(int dstId, int posX, int posY, Color color) {
|
|
331
|
+
if (dstId < 0 || dstId >= MAX_IMAGES || !imageUsed[dstId]) return;
|
|
332
|
+
ImageDrawPixelV(&imageRegistry[dstId], (Vector2){posX, posY}, color);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
void ImageDrawLineW(int dstId, int startX, int startY, int endX, int endY, Color color) {
|
|
336
|
+
if (dstId < 0 || dstId >= MAX_IMAGES || !imageUsed[dstId]) return;
|
|
337
|
+
ImageDrawLine(&imageRegistry[dstId], startX, startY, endX, endY, color);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
void ImageDrawLineVW(int dstId, int startX, int startY, int endX, int endY, Color color) {
|
|
341
|
+
if (dstId < 0 || dstId >= MAX_IMAGES || !imageUsed[dstId]) return;
|
|
342
|
+
ImageDrawLineV(&imageRegistry[dstId], (Vector2){startX, startY}, (Vector2){endX, endY}, color);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
void ImageDrawLineExW(int dstId, int startX, int startY, int endX, int endY, int thick, Color color) {
|
|
346
|
+
if (dstId < 0 || dstId >= MAX_IMAGES || !imageUsed[dstId]) return;
|
|
347
|
+
ImageDrawLineEx(&imageRegistry[dstId], (Vector2){startX, startY}, (Vector2){endX, endY}, thick, color);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
void ImageDrawCircleW(int dstId, int centerX, int centerY, int radius, Color color) {
|
|
351
|
+
if (dstId < 0 || dstId >= MAX_IMAGES || !imageUsed[dstId]) return;
|
|
352
|
+
ImageDrawCircle(&imageRegistry[dstId], centerX, centerY, radius, color);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
void ImageDrawCircleVW(int dstId, int centerX, int centerY, int radius, Color color) {
|
|
356
|
+
if (dstId < 0 || dstId >= MAX_IMAGES || !imageUsed[dstId]) return;
|
|
357
|
+
ImageDrawCircleV(&imageRegistry[dstId], (Vector2){centerX, centerY}, radius, color);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
void ImageDrawCircleLinesW(int dstId, int centerX, int centerY, int radius, Color color) {
|
|
361
|
+
if (dstId < 0 || dstId >= MAX_IMAGES || !imageUsed[dstId]) return;
|
|
362
|
+
ImageDrawCircleLines(&imageRegistry[dstId], centerX, centerY, radius, color);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
void ImageDrawCircleLinesVW(int dstId, int centerX, int centerY, int radius, Color color) {
|
|
366
|
+
if (dstId < 0 || dstId >= MAX_IMAGES || !imageUsed[dstId]) return;
|
|
367
|
+
ImageDrawCircleLinesV(&imageRegistry[dstId], (Vector2){centerX, centerY}, radius, color);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
void ImageDrawRectangleW(int dstId, int posX, int posY, int w, int h, Color color) {
|
|
371
|
+
if (dstId < 0 || dstId >= MAX_IMAGES || !imageUsed[dstId]) return;
|
|
372
|
+
ImageDrawRectangle(&imageRegistry[dstId], posX, posY, w, h, color);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
void ImageDrawRectangleVW(int dstId, int posX, int posY, int w, int h, Color color) {
|
|
376
|
+
if (dstId < 0 || dstId >= MAX_IMAGES || !imageUsed[dstId]) return;
|
|
377
|
+
ImageDrawRectangleV(&imageRegistry[dstId], (Vector2){posX, posY}, (Vector2){w, h}, color);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
void ImageDrawRectangleRecW(int dstId, int rx, int ry, int rw, int rh, Color color) {
|
|
381
|
+
if (dstId < 0 || dstId >= MAX_IMAGES || !imageUsed[dstId]) return;
|
|
382
|
+
Rectangle rec = { rx, ry, rw, rh };
|
|
383
|
+
ImageDrawRectangleRec(&imageRegistry[dstId], rec, color);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
void ImageDrawRectangleLinesW(int dstId, int rx, int ry, int rw, int rh, int thick, Color color) {
|
|
387
|
+
if (dstId < 0 || dstId >= MAX_IMAGES || !imageUsed[dstId]) return;
|
|
388
|
+
Rectangle rec = { rx, ry, rw, rh };
|
|
389
|
+
ImageDrawRectangleLines(&imageRegistry[dstId], rec, thick, color);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
void ImageDrawTriangleW(int dstId, int x1, int y1, int x2, int y2, int x3, int y3, Color color) {
|
|
393
|
+
if (dstId < 0 || dstId >= MAX_IMAGES || !imageUsed[dstId]) return;
|
|
394
|
+
ImageDrawTriangle(&imageRegistry[dstId], (Vector2){x1, y1}, (Vector2){x2, y2}, (Vector2){x3, y3}, color);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
void ImageDrawTriangleExW(int dstId, int x1, int y1, int x2, int y2, int x3, int y3, Color c1, Color c2, Color c3) {
|
|
398
|
+
if (dstId < 0 || dstId >= MAX_IMAGES || !imageUsed[dstId]) return;
|
|
399
|
+
ImageDrawTriangleEx(&imageRegistry[dstId], (Vector2){x1, y1}, (Vector2){x2, y2}, (Vector2){x3, y3}, c1, c2, c3);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
void ImageDrawTriangleLinesW(int dstId, int x1, int y1, int x2, int y2, int x3, int y3, Color color) {
|
|
403
|
+
if (dstId < 0 || dstId >= MAX_IMAGES || !imageUsed[dstId]) return;
|
|
404
|
+
ImageDrawTriangleLines(&imageRegistry[dstId], (Vector2){x1, y1}, (Vector2){x2, y2}, (Vector2){x3, y3}, color);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
void ImageDrawTriangleFanW(int dstId, const float* points, int pointCount, Color color) {
|
|
408
|
+
if (dstId < 0 || dstId >= MAX_IMAGES || !imageUsed[dstId]) return;
|
|
409
|
+
ImageDrawTriangleFan(&imageRegistry[dstId], (Vector2*)points, pointCount, color);
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
void ImageDrawTriangleStripW(int dstId, const float* points, int pointCount, Color color) {
|
|
413
|
+
if (dstId < 0 || dstId >= MAX_IMAGES || !imageUsed[dstId]) return;
|
|
414
|
+
ImageDrawTriangleStrip(&imageRegistry[dstId], (Vector2*)points, pointCount, color);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
void ImageDrawW(int dstId, int srcId, int srcRX, int srcRY, int srcRW, int srcRH, int dstRX, int dstRY, int dstRW, int dstRH, Color tint) {
|
|
418
|
+
if (dstId < 0 || dstId >= MAX_IMAGES || !imageUsed[dstId]) return;
|
|
419
|
+
if (srcId < 0 || srcId >= MAX_IMAGES || !imageUsed[srcId]) return;
|
|
420
|
+
Rectangle srcRec = { srcRX, srcRY, srcRW, srcRH };
|
|
421
|
+
Rectangle dstRec = { dstRX, dstRY, dstRW, dstRH };
|
|
422
|
+
ImageDraw(&imageRegistry[dstId], imageRegistry[srcId], srcRec, dstRec, tint);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
void ImageDrawTextW(int dstId, const char* text, int posX, int posY, int fontSize, Color color) {
|
|
426
|
+
if (dstId < 0 || dstId >= MAX_IMAGES || !imageUsed[dstId]) return;
|
|
427
|
+
ImageDrawText(&imageRegistry[dstId], text, posX, posY, fontSize, color);
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
void ImageDrawTextExW(int dstId, int fontId, const char* text, int posX, int posY, int fontSize, int spacing, Color tint) {
|
|
431
|
+
if (dstId < 0 || dstId >= MAX_IMAGES || !imageUsed[dstId]) return;
|
|
432
|
+
float sp;
|
|
433
|
+
memcpy(&sp, &spacing, sizeof(float));
|
|
434
|
+
ImageDrawTextEx(&imageRegistry[dstId], fontRegistry[fontId], text, (Vector2){posX, posY}, fontSize, sp, tint);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
void ImageToPOTW(int id, int fill) {
|
|
438
|
+
if (id < 0 || id >= MAX_IMAGES || !imageUsed[id]) return;
|
|
439
|
+
Color c;
|
|
440
|
+
memcpy(&c, &fill, sizeof(int));
|
|
441
|
+
ImageToPOT(&imageRegistry[id], c);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
void ImageKernelConvolutionW(int id, const float* kernel, int kernelSize) {
|
|
445
|
+
if (id < 0 || id >= MAX_IMAGES || !imageUsed[id]) return;
|
|
446
|
+
ImageKernelConvolution(&imageRegistry[id], kernel, kernelSize);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
void UnloadImageColorsW(void* ptr) { MemFree(ptr); }
|
|
450
|
+
void UnloadImagePaletteW(void* ptr) { MemFree(ptr); }
|
|
451
|
+
|
|
452
|
+
int LoadImageAnimFromMemoryW(const char* fileType, const unsigned char* fileData, int dataSize, int* frames) {
|
|
453
|
+
int slot = imageAlloc();
|
|
454
|
+
if (slot < 0) return -1;
|
|
455
|
+
imageRegistry[slot] = LoadImageAnimFromMemory(fileType, fileData, dataSize, frames);
|
|
456
|
+
if (imageRegistry[slot].data == NULL) { imageUsed[slot] = false; return -1; }
|
|
457
|
+
return slot;
|
|
458
|
+
}
|
package/src/c/input.c
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#include "common.h"
|
|
2
|
+
|
|
3
|
+
bool IsKeyPressedW(int key) { return IsKeyPressed(key); }
|
|
4
|
+
bool IsKeyPressedRepeatW(int key) { return IsKeyPressedRepeat(key); }
|
|
5
|
+
bool IsKeyDownW(int key) { return IsKeyDown(key); }
|
|
6
|
+
bool IsKeyReleasedW(int key) { return IsKeyReleased(key); }
|
|
7
|
+
bool IsKeyUpW(int key) { return IsKeyUp(key); }
|
|
8
|
+
int GetKeyPressedW() { return GetKeyPressed(); }
|
|
9
|
+
int GetCharPressedW() { return GetCharPressed(); }
|
|
10
|
+
void SetExitKeyW(int key) { SetExitKey(key); }
|
|
11
|
+
|
|
12
|
+
bool IsGamepadAvailableW(int gamepad) { return IsGamepadAvailable(gamepad); }
|
|
13
|
+
const char* GetGamepadNameW(int gamepad) { return GetGamepadName(gamepad); }
|
|
14
|
+
bool IsGamepadButtonPressedW(int gamepad, int button) { return IsGamepadButtonPressed(gamepad, button); }
|
|
15
|
+
bool IsGamepadButtonDownW(int gamepad, int button) { return IsGamepadButtonDown(gamepad, button); }
|
|
16
|
+
bool IsGamepadButtonReleasedW(int gamepad, int button) { return IsGamepadButtonReleased(gamepad, button); }
|
|
17
|
+
bool IsGamepadButtonUpW(int gamepad, int button) { return IsGamepadButtonUp(gamepad, button); }
|
|
18
|
+
int GetGamepadButtonPressedW() { return GetGamepadButtonPressed(); }
|
|
19
|
+
int GetGamepadAxisCountW(int gamepad) { return GetGamepadAxisCount(gamepad); }
|
|
20
|
+
float GetGamepadAxisMovementW(int gamepad, int axis) { return GetGamepadAxisMovement(gamepad, axis); }
|
|
21
|
+
int SetGamepadMappingsW(const char* mappings) { return SetGamepadMappings(mappings); }
|
|
22
|
+
|
|
23
|
+
void SetGamepadVibrationW(int gamepad, float leftMotor, float rightMotor, float duration) {
|
|
24
|
+
SetGamepadVibration(gamepad, leftMotor, rightMotor, duration);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
bool IsMouseButtonPressedW(int button) { return IsMouseButtonPressed(button); }
|
|
28
|
+
bool IsMouseButtonDownW(int button) { return IsMouseButtonDown(button); }
|
|
29
|
+
bool IsMouseButtonReleasedW(int button) { return IsMouseButtonReleased(button); }
|
|
30
|
+
bool IsMouseButtonUpW(int button) { return IsMouseButtonUp(button); }
|
|
31
|
+
int GetMouseXW() { return GetMouseX(); }
|
|
32
|
+
int GetMouseYW() { return GetMouseY(); }
|
|
33
|
+
|
|
34
|
+
void GetMousePositionW(float* out) {
|
|
35
|
+
Vector2 v = GetMousePosition();
|
|
36
|
+
out[0] = v.x; out[1] = v.y;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
void GetMouseDeltaW(float* out) {
|
|
40
|
+
Vector2 v = GetMouseDelta();
|
|
41
|
+
out[0] = v.x; out[1] = v.y;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
void SetMousePositionW(int x, int y) { SetMousePosition(x, y); }
|
|
45
|
+
void SetMouseOffsetW(int x, int y) { SetMouseOffset(x, y); }
|
|
46
|
+
|
|
47
|
+
void SetMouseScaleW(float scaleX, float scaleY) { SetMouseScale(scaleX, scaleY); }
|
|
48
|
+
float GetMouseWheelMoveW() { return GetMouseWheelMove(); }
|
|
49
|
+
|
|
50
|
+
void GetMouseWheelMoveVW(float* out) {
|
|
51
|
+
Vector2 v = GetMouseWheelMoveV();
|
|
52
|
+
out[0] = v.x; out[1] = v.y;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
void SetMouseCursorW(int cursor) { SetMouseCursor(cursor); }
|
|
56
|
+
|
|
57
|
+
int GetTouchXW() { return GetTouchX(); }
|
|
58
|
+
int GetTouchYW() { return GetTouchY(); }
|
|
59
|
+
|
|
60
|
+
void GetTouchPositionW(float* out, int index) {
|
|
61
|
+
Vector2 v = GetTouchPosition(index);
|
|
62
|
+
out[0] = v.x; out[1] = v.y;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
int GetTouchPointIdW(int index) { return GetTouchPointId(index); }
|
|
66
|
+
int GetTouchPointCountW() { return GetTouchPointCount(); }
|
|
67
|
+
|
|
68
|
+
void SetGesturesEnabledW(unsigned int flags) { SetGesturesEnabled(flags); }
|
|
69
|
+
bool IsGestureDetectedW(unsigned int gesture) { return IsGestureDetected(gesture); }
|
|
70
|
+
int GetGestureDetectedW() { return GetGestureDetected(); }
|
|
71
|
+
float GetGestureHoldDurationW() { return GetGestureHoldDuration(); }
|
|
72
|
+
|
|
73
|
+
void GetGestureDragVectorW(float* out) {
|
|
74
|
+
Vector2 v = GetGestureDragVector();
|
|
75
|
+
out[0] = v.x; out[1] = v.y;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
float GetGestureDragAngleW() { return GetGestureDragAngle(); }
|
|
79
|
+
|
|
80
|
+
void GetGesturePinchVectorW(float* out) {
|
|
81
|
+
Vector2 v = GetGesturePinchVector();
|
|
82
|
+
out[0] = v.x; out[1] = v.y;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
float GetGesturePinchAngleW() { return GetGesturePinchAngle(); }
|