@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/texture.c
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
#include "common.h"
|
|
2
|
+
|
|
3
|
+
void LoadTextureW(unsigned int* outId, int* outW, int* outH, const char* fileName) {
|
|
4
|
+
Texture2D tex = LoadTexture(fileName);
|
|
5
|
+
*outId = tex.id;
|
|
6
|
+
*outW = tex.width;
|
|
7
|
+
*outH = tex.height;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
void UnloadTextureW(unsigned int id) {
|
|
11
|
+
Texture2D tex = { id, 0, 0, 0, 0 };
|
|
12
|
+
UnloadTexture(tex);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
bool IsTextureValidW(unsigned int id, int w, int h) {
|
|
16
|
+
Texture2D tex = { id, w, h, 1, 7 };
|
|
17
|
+
return IsTextureValid(tex);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
void LoadRenderTextureW(unsigned int* outId, unsigned int* outTexId, int* outW, int* outH, int width, int height) {
|
|
21
|
+
RenderTexture2D rt = LoadRenderTexture(width, height);
|
|
22
|
+
*outId = rt.id;
|
|
23
|
+
*outTexId = rt.texture.id;
|
|
24
|
+
*outW = rt.texture.width;
|
|
25
|
+
*outH = rt.texture.height;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
void UnloadRenderTextureW(unsigned int id) {
|
|
29
|
+
RenderTexture2D rt = { id, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0} };
|
|
30
|
+
UnloadRenderTexture(rt);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
bool IsRenderTextureValidW(unsigned int id) {
|
|
34
|
+
RenderTexture2D rt = { id, {0}, {0} };
|
|
35
|
+
return IsRenderTextureValid(rt);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
void GenTextureMipmapsW(unsigned int id) {
|
|
39
|
+
Texture2D tex = { id, 0, 0, 0, 0 };
|
|
40
|
+
GenTextureMipmaps(&tex);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
void SetTextureFilterW(unsigned int id, int filter) {
|
|
44
|
+
Texture2D tex = { id, 0, 0, 0, 0 };
|
|
45
|
+
SetTextureFilter(tex, filter);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
void SetTextureWrapW(unsigned int id, int wrap) {
|
|
49
|
+
Texture2D tex = { id, 0, 0, 0, 0 };
|
|
50
|
+
SetTextureWrap(tex, wrap);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
void DrawTextureW(unsigned int id, int w, int h, int posX, int posY, Color tint) {
|
|
54
|
+
Texture2D tex = { id, w, h, 1, 7 };
|
|
55
|
+
DrawTexture(tex, posX, posY, tint);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
void DrawTextureVW(unsigned int id, int w, int h, int posX, int posY, Color tint) {
|
|
59
|
+
Texture2D tex = { id, w, h, 1, 7 };
|
|
60
|
+
DrawTextureV(tex, (Vector2){posX, posY}, tint);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
void DrawTextureExW(unsigned int id, int w, int h, int posX, int posY, int rotation, int scale, Color tint) {
|
|
64
|
+
float r, s;
|
|
65
|
+
memcpy(&r, &rotation, sizeof(float));
|
|
66
|
+
memcpy(&s, &scale, sizeof(float));
|
|
67
|
+
Texture2D tex = { id, w, h, 1, 7 };
|
|
68
|
+
DrawTextureEx(tex, (Vector2){posX, posY}, r, s, tint);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
void DrawTextureRecW(unsigned int id, int w, int h, int srcX, int srcY, int srcW, int srcH, int posX, int posY, Color tint) {
|
|
72
|
+
Texture2D tex = { id, w, h, 1, 7 };
|
|
73
|
+
Rectangle src = { srcX, srcY, srcW, srcH };
|
|
74
|
+
DrawTextureRec(tex, src, (Vector2){posX, posY}, tint);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
void DrawTextureProW(unsigned int id, int w, int h,
|
|
78
|
+
int srcX, int srcY, int srcW, int srcH,
|
|
79
|
+
int dstX, int dstY, int dstW, int dstH,
|
|
80
|
+
int originX, int originY, int rotation, Color tint) {
|
|
81
|
+
float r;
|
|
82
|
+
memcpy(&r, &rotation, sizeof(float));
|
|
83
|
+
Texture2D tex = { id, w, h, 1, 7 };
|
|
84
|
+
Rectangle src = { srcX, srcY, srcW, srcH };
|
|
85
|
+
Rectangle dst = { dstX, dstY, dstW, dstH };
|
|
86
|
+
DrawTexturePro(tex, src, dst, (Vector2){originX, originY}, r, tint);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
void LoadTextureFromImageW(unsigned int* outId, int* outW, int* outH, int imageId) {
|
|
90
|
+
*outId = 0; *outW = 0; *outH = 0;
|
|
91
|
+
if (imageId < 0 || imageId >= MAX_IMAGES || !imageUsed[imageId]) return;
|
|
92
|
+
Texture2D tex = LoadTextureFromImage(imageRegistry[imageId]);
|
|
93
|
+
*outId = tex.id;
|
|
94
|
+
*outW = tex.width;
|
|
95
|
+
*outH = tex.height;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
void LoadTextureCubemapW(unsigned int* outId, int* outW, int* outH, int imageId, int layout) {
|
|
99
|
+
*outId = 0; *outW = 0; *outH = 0;
|
|
100
|
+
if (imageId < 0 || imageId >= MAX_IMAGES || !imageUsed[imageId]) return;
|
|
101
|
+
Texture2D tex = LoadTextureCubemap(imageRegistry[imageId], layout);
|
|
102
|
+
*outId = tex.id;
|
|
103
|
+
*outW = tex.width;
|
|
104
|
+
*outH = tex.height;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
void UpdateTextureW(unsigned int id, int w, int h, const void* pixels) {
|
|
108
|
+
Texture2D tex = { id, w, h, 1, 7 };
|
|
109
|
+
UpdateTexture(tex, pixels);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
void UpdateTextureRecW(unsigned int id, int w, int h, int rx, int ry, int rw, int rh, const void* pixels) {
|
|
113
|
+
Texture2D tex = { id, w, h, 1, 7 };
|
|
114
|
+
Rectangle rec = { rx, ry, rw, rh };
|
|
115
|
+
UpdateTextureRec(tex, rec, pixels);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
void DrawTextureNPatchW(unsigned int id, int w, int h,
|
|
119
|
+
int srcX, int srcY, int srcW, int srcH,
|
|
120
|
+
int left, int top, int right, int bottom, int layout,
|
|
121
|
+
int dstX, int dstY, int dstW, int dstH,
|
|
122
|
+
int originX, int originY, int rotation, Color tint) {
|
|
123
|
+
float r;
|
|
124
|
+
memcpy(&r, &rotation, sizeof(float));
|
|
125
|
+
Texture2D tex = { id, w, h, 1, 7 };
|
|
126
|
+
Rectangle src = { srcX, srcY, srcW, srcH };
|
|
127
|
+
NPatchInfo npi = { src, left, top, right, bottom, layout };
|
|
128
|
+
Rectangle dst = { dstX, dstY, dstW, dstH };
|
|
129
|
+
DrawTextureNPatch(tex, npi, dst, (Vector2){originX, originY}, r, tint);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
int GetPixelColorW(const void* srcPtr, int format) {
|
|
133
|
+
Color c = GetPixelColor((void*)srcPtr, format);
|
|
134
|
+
return *((int*)&c);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
void SetPixelColorW(void* dstPtr, Color color, int format) {
|
|
138
|
+
SetPixelColor(dstPtr, color, format);
|
|
139
|
+
}
|
package/src/c/window.c
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
#include "common.h"
|
|
2
|
+
|
|
3
|
+
void InitWindowW(int width, int height, const char* title) {
|
|
4
|
+
InitWindow(width, height, title);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
void CloseWindowW() {
|
|
8
|
+
CloseWindow();
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
bool WindowShouldCloseW() {
|
|
12
|
+
return WindowShouldClose();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
void BeginDrawingW() {
|
|
16
|
+
BeginDrawing();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
void EndDrawingW() {
|
|
20
|
+
EndDrawing();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
void ClearBackgroundW(Color color) {
|
|
24
|
+
ClearBackground(color);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
void SetTargetFPSW(int fps) {
|
|
28
|
+
SetTargetFPS(fps);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
float GetFrameTimeW() {
|
|
32
|
+
return GetFrameTime();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
bool IsWindowReadyW() { return IsWindowReady(); }
|
|
36
|
+
bool IsWindowFullscreenW() { return IsWindowFullscreen(); }
|
|
37
|
+
bool IsWindowHiddenW() { return IsWindowHidden(); }
|
|
38
|
+
bool IsWindowMinimizedW() { return IsWindowMinimized(); }
|
|
39
|
+
bool IsWindowMaximizedW() { return IsWindowMaximized(); }
|
|
40
|
+
bool IsWindowFocusedW() { return IsWindowFocused(); }
|
|
41
|
+
bool IsWindowResizedW() { return IsWindowResized(); }
|
|
42
|
+
bool IsWindowStateW(unsigned int flag) { return IsWindowState(flag); }
|
|
43
|
+
|
|
44
|
+
void SetWindowStateW(unsigned int flags) { SetWindowState(flags); }
|
|
45
|
+
void ClearWindowStateW(unsigned int flags) { ClearWindowState(flags); }
|
|
46
|
+
void ToggleFullscreenW() { ToggleFullscreen(); }
|
|
47
|
+
void ToggleBorderlessWindowedW() { ToggleBorderlessWindowed(); }
|
|
48
|
+
void MaximizeWindowW() { MaximizeWindow(); }
|
|
49
|
+
void MinimizeWindowW() { MinimizeWindow(); }
|
|
50
|
+
void RestoreWindowW() { RestoreWindow(); }
|
|
51
|
+
|
|
52
|
+
void SetWindowTitleW(const char* title) { SetWindowTitle(title); }
|
|
53
|
+
void SetWindowPositionW(int x, int y) { SetWindowPosition(x, y); }
|
|
54
|
+
void SetWindowMonitorW(int monitor) { SetWindowMonitor(monitor); }
|
|
55
|
+
void SetWindowMinSizeW(int w, int h) { SetWindowMinSize(w, h); }
|
|
56
|
+
void SetWindowMaxSizeW(int w, int h) { SetWindowMaxSize(w, h); }
|
|
57
|
+
void SetWindowSizeW(int w, int h) { SetWindowSize(w, h); }
|
|
58
|
+
void SetWindowOpacityW(float opacity) { SetWindowOpacity(opacity); }
|
|
59
|
+
void SetWindowFocusedW() { SetWindowFocused(); }
|
|
60
|
+
|
|
61
|
+
int GetScreenWidthW() { return GetScreenWidth(); }
|
|
62
|
+
int GetScreenHeightW() { return GetScreenHeight(); }
|
|
63
|
+
int GetRenderWidthW() { return GetRenderWidth(); }
|
|
64
|
+
int GetRenderHeightW() { return GetRenderHeight(); }
|
|
65
|
+
|
|
66
|
+
int GetMonitorCountW() { return GetMonitorCount(); }
|
|
67
|
+
int GetCurrentMonitorW() { return GetCurrentMonitor(); }
|
|
68
|
+
|
|
69
|
+
void GetMonitorPositionW(float* out, int monitor) {
|
|
70
|
+
Vector2 v = GetMonitorPosition(monitor);
|
|
71
|
+
out[0] = v.x; out[1] = v.y;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
int GetMonitorWidthW(int monitor) { return GetMonitorWidth(monitor); }
|
|
75
|
+
int GetMonitorHeightW(int monitor) { return GetMonitorHeight(monitor); }
|
|
76
|
+
int GetMonitorPhysicalWidthW(int monitor) { return GetMonitorPhysicalWidth(monitor); }
|
|
77
|
+
int GetMonitorPhysicalHeightW(int monitor) { return GetMonitorPhysicalHeight(monitor); }
|
|
78
|
+
int GetMonitorRefreshRateW(int monitor) { return GetMonitorRefreshRate(monitor); }
|
|
79
|
+
|
|
80
|
+
void GetWindowPositionW(float* out) {
|
|
81
|
+
Vector2 v = GetWindowPosition();
|
|
82
|
+
out[0] = v.x; out[1] = v.y;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
void GetWindowScaleDPIW(float* out) {
|
|
86
|
+
Vector2 v = GetWindowScaleDPI();
|
|
87
|
+
out[0] = v.x; out[1] = v.y;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const char* GetMonitorNameW(int monitor) { return GetMonitorName(monitor); }
|
|
91
|
+
|
|
92
|
+
void SetClipboardTextW(const char* text) { SetClipboardText(text); }
|
|
93
|
+
const char* GetClipboardTextW() { return GetClipboardText(); }
|
|
94
|
+
|
|
95
|
+
void EnableEventWaitingW() { EnableEventWaiting(); }
|
|
96
|
+
void DisableEventWaitingW() { DisableEventWaiting(); }
|
|
97
|
+
|
|
98
|
+
void ShowCursorW() { ShowCursor(); }
|
|
99
|
+
void HideCursorW() { HideCursor(); }
|
|
100
|
+
bool IsCursorHiddenW() { return IsCursorHidden(); }
|
|
101
|
+
void EnableCursorW() { EnableCursor(); }
|
|
102
|
+
void DisableCursorW() { DisableCursor(); }
|
|
103
|
+
bool IsCursorOnScreenW() { return IsCursorOnScreen(); }
|
|
104
|
+
|
|
105
|
+
void BeginTextureModeW(unsigned int id, int w, int h) {
|
|
106
|
+
RenderTexture2D rt = { id, {id, w, h, 1, 7}, {0, 0, 0, 0, 0} };
|
|
107
|
+
BeginTextureMode(rt);
|
|
108
|
+
}
|
|
109
|
+
void EndTextureModeW() { EndTextureMode(); }
|
|
110
|
+
|
|
111
|
+
void BeginBlendModeW(int mode) { BeginBlendMode(mode); }
|
|
112
|
+
void EndBlendModeW() { EndBlendMode(); }
|
|
113
|
+
|
|
114
|
+
void BeginScissorModeW(int x, int y, int w, int h) { BeginScissorMode(x, y, w, h); }
|
|
115
|
+
void EndScissorModeW() { EndScissorMode(); }
|
|
116
|
+
|
|
117
|
+
double GetTimeW() { return GetTime(); }
|
|
118
|
+
int GetFPSW() { return GetFPS(); }
|
|
119
|
+
void SwapScreenBufferW() { SwapScreenBuffer(); }
|
|
120
|
+
void PollInputEventsW() { PollInputEvents(); }
|
|
121
|
+
void WaitTimeW(double seconds) { WaitTime(seconds); }
|
|
122
|
+
|
|
123
|
+
void SetRandomSeedW(unsigned int seed) { SetRandomSeed(seed); }
|
|
124
|
+
int GetRandomValueW(int min, int max) { return GetRandomValue(min, max); }
|
|
125
|
+
|
|
126
|
+
void TakeScreenshotW(const char* fileName) { TakeScreenshot(fileName); }
|
|
127
|
+
void SetConfigFlagsW(unsigned int flags) { SetConfigFlags(flags); }
|
|
128
|
+
void OpenURLW(const char* url) { OpenURL(url); }
|
|
129
|
+
|
|
130
|
+
void TraceLogW(int logLevel, const char* text) {
|
|
131
|
+
TraceLog(logLevel, "%s", text);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
void SetTraceLogLevelW(int logLevel) {
|
|
135
|
+
SetTraceLogLevel(logLevel);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
void SetWindowIconW(int imageId) {
|
|
139
|
+
if (imageId < 0 || imageId >= MAX_IMAGES || !imageUsed[imageId]) return;
|
|
140
|
+
SetWindowIcon(imageRegistry[imageId]);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
int GetClipboardImageW() {
|
|
144
|
+
int slot = imageAlloc();
|
|
145
|
+
if (slot < 0) return -1;
|
|
146
|
+
imageRegistry[slot] = GetClipboardImage();
|
|
147
|
+
return slot;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
void SetWindowIconsW(Image* images, int count) { SetWindowIcons(images, count); }
|
package/src/constants.ts
ADDED
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
import { color } from "./utils";
|
|
2
|
+
|
|
3
|
+
export const PI = 3.141592653589793;
|
|
4
|
+
export const DEG2RAD = PI / 180;
|
|
5
|
+
export const RAD2DEG = 180 / PI;
|
|
6
|
+
|
|
7
|
+
export const COLORS = {
|
|
8
|
+
LIGHTGRAY: color(200, 200, 200),
|
|
9
|
+
GRAY: color(130, 130, 130),
|
|
10
|
+
DARKGRAY: color(80, 80, 80),
|
|
11
|
+
YELLOW: color(253, 249, 0),
|
|
12
|
+
GOLD: color(255, 203, 0),
|
|
13
|
+
ORANGE: color(255, 161, 0),
|
|
14
|
+
PINK: color(255, 109, 194),
|
|
15
|
+
RED: color(230, 41, 55),
|
|
16
|
+
MAROON: color(190, 33, 55),
|
|
17
|
+
GREEN: color(0, 228, 48),
|
|
18
|
+
LIME: color(0, 158, 47),
|
|
19
|
+
DARKGREEN: color(0, 117, 44),
|
|
20
|
+
SKYBLUE: color(102, 191, 255),
|
|
21
|
+
BLUE: color(0, 121, 241),
|
|
22
|
+
DARKBLUE: color(0, 82, 172),
|
|
23
|
+
PURPLE: color(200, 122, 255),
|
|
24
|
+
VIOLET: color(135, 60, 190),
|
|
25
|
+
DARKPURPLE: color(112, 31, 126),
|
|
26
|
+
BEIGE: color(211, 176, 131),
|
|
27
|
+
BROWN: color(127, 106, 79),
|
|
28
|
+
DARKBROWN: color(76, 63, 47),
|
|
29
|
+
WHITE: color(255, 255, 255),
|
|
30
|
+
BLACK: color(0, 0, 0),
|
|
31
|
+
BLANK: color(0, 0, 0, 0),
|
|
32
|
+
MAGENTA: color(255, 0, 255),
|
|
33
|
+
RAYWHITE: color(245, 245, 245),
|
|
34
|
+
CYAN: color(0, 255, 255),
|
|
35
|
+
} as const;
|
|
36
|
+
|
|
37
|
+
export const KEYS = {
|
|
38
|
+
NULL: 0,
|
|
39
|
+
APOSTROPHE: 39,
|
|
40
|
+
COMMA: 44,
|
|
41
|
+
MINUS: 45,
|
|
42
|
+
PERIOD: 46,
|
|
43
|
+
SLASH: 47,
|
|
44
|
+
ZERO: 48,
|
|
45
|
+
ONE: 49,
|
|
46
|
+
TWO: 50,
|
|
47
|
+
THREE: 51,
|
|
48
|
+
FOUR: 52,
|
|
49
|
+
FIVE: 53,
|
|
50
|
+
SIX: 54,
|
|
51
|
+
SEVEN: 55,
|
|
52
|
+
EIGHT: 56,
|
|
53
|
+
NINE: 57,
|
|
54
|
+
SEMICOLON: 59,
|
|
55
|
+
EQUAL: 61,
|
|
56
|
+
A: 65,
|
|
57
|
+
B: 66,
|
|
58
|
+
C: 67,
|
|
59
|
+
D: 68,
|
|
60
|
+
E: 69,
|
|
61
|
+
F: 70,
|
|
62
|
+
G: 71,
|
|
63
|
+
H: 72,
|
|
64
|
+
I: 73,
|
|
65
|
+
J: 74,
|
|
66
|
+
K: 75,
|
|
67
|
+
L: 76,
|
|
68
|
+
M: 77,
|
|
69
|
+
N: 78,
|
|
70
|
+
O: 79,
|
|
71
|
+
P: 80,
|
|
72
|
+
Q: 81,
|
|
73
|
+
R: 82,
|
|
74
|
+
S: 83,
|
|
75
|
+
T: 84,
|
|
76
|
+
U: 85,
|
|
77
|
+
V: 86,
|
|
78
|
+
W: 87,
|
|
79
|
+
X: 88,
|
|
80
|
+
Y: 89,
|
|
81
|
+
Z: 90,
|
|
82
|
+
LEFT_BRACKET: 91,
|
|
83
|
+
BACKSLASH: 92,
|
|
84
|
+
RIGHT_BRACKET: 93,
|
|
85
|
+
GRAVE: 96,
|
|
86
|
+
SPACE: 32,
|
|
87
|
+
ESCAPE: 256,
|
|
88
|
+
ENTER: 257,
|
|
89
|
+
TAB: 258,
|
|
90
|
+
BACKSPACE: 259,
|
|
91
|
+
INSERT: 260,
|
|
92
|
+
DELETE: 261,
|
|
93
|
+
RIGHT: 262,
|
|
94
|
+
LEFT: 263,
|
|
95
|
+
DOWN: 264,
|
|
96
|
+
UP: 265,
|
|
97
|
+
PAGE_UP: 266,
|
|
98
|
+
PAGE_DOWN: 267,
|
|
99
|
+
HOME: 268,
|
|
100
|
+
END: 269,
|
|
101
|
+
CAPS_LOCK: 280,
|
|
102
|
+
SCROLL_LOCK: 281,
|
|
103
|
+
NUM_LOCK: 282,
|
|
104
|
+
PRINT_SCREEN: 283,
|
|
105
|
+
PAUSE: 284,
|
|
106
|
+
F1: 290,
|
|
107
|
+
F2: 291,
|
|
108
|
+
F3: 292,
|
|
109
|
+
F4: 293,
|
|
110
|
+
F5: 294,
|
|
111
|
+
F6: 295,
|
|
112
|
+
F7: 296,
|
|
113
|
+
F8: 297,
|
|
114
|
+
F9: 298,
|
|
115
|
+
F10: 299,
|
|
116
|
+
F11: 300,
|
|
117
|
+
F12: 301,
|
|
118
|
+
LEFT_SHIFT: 340,
|
|
119
|
+
LEFT_CONTROL: 341,
|
|
120
|
+
LEFT_ALT: 342,
|
|
121
|
+
LEFT_SUPER: 343,
|
|
122
|
+
RIGHT_SHIFT: 344,
|
|
123
|
+
RIGHT_CONTROL: 345,
|
|
124
|
+
RIGHT_ALT: 346,
|
|
125
|
+
RIGHT_SUPER: 347,
|
|
126
|
+
KB_MENU: 348,
|
|
127
|
+
KP_0: 320,
|
|
128
|
+
KP_1: 321,
|
|
129
|
+
KP_2: 322,
|
|
130
|
+
KP_3: 323,
|
|
131
|
+
KP_4: 324,
|
|
132
|
+
KP_5: 325,
|
|
133
|
+
KP_6: 326,
|
|
134
|
+
KP_7: 327,
|
|
135
|
+
KP_8: 328,
|
|
136
|
+
KP_9: 329,
|
|
137
|
+
KP_DECIMAL: 330,
|
|
138
|
+
KP_DIVIDE: 331,
|
|
139
|
+
KP_MULTIPLY: 332,
|
|
140
|
+
KP_SUBTRACT: 333,
|
|
141
|
+
KP_ADD: 334,
|
|
142
|
+
KP_ENTER: 335,
|
|
143
|
+
KP_EQUAL: 336,
|
|
144
|
+
BACK: 4,
|
|
145
|
+
MENU: 5,
|
|
146
|
+
VOLUME_UP: 24,
|
|
147
|
+
VOLUME_DOWN: 25,
|
|
148
|
+
} as const;
|
|
149
|
+
|
|
150
|
+
export const MOUSE = {
|
|
151
|
+
BUTTON_LEFT: 0,
|
|
152
|
+
BUTTON_RIGHT: 1,
|
|
153
|
+
BUTTON_MIDDLE: 2,
|
|
154
|
+
BUTTON_SIDE: 3,
|
|
155
|
+
BUTTON_EXTRA: 4,
|
|
156
|
+
BUTTON_FORWARD: 5,
|
|
157
|
+
BUTTON_BACK: 6,
|
|
158
|
+
LEFT_BUTTON: 0,
|
|
159
|
+
RIGHT_BUTTON: 1,
|
|
160
|
+
MIDDLE_BUTTON: 2,
|
|
161
|
+
} as const;
|
|
162
|
+
|
|
163
|
+
export const CURSOR = {
|
|
164
|
+
DEFAULT: 0,
|
|
165
|
+
ARROW: 1,
|
|
166
|
+
IBEAM: 2,
|
|
167
|
+
CROSSHAIR: 3,
|
|
168
|
+
POINTING_HAND: 4,
|
|
169
|
+
RESIZE_EW: 5,
|
|
170
|
+
RESIZE_NS: 6,
|
|
171
|
+
RESIZE_NWSE: 7,
|
|
172
|
+
RESIZE_NESW: 8,
|
|
173
|
+
RESIZE_ALL: 9,
|
|
174
|
+
NOT_ALLOWED: 10,
|
|
175
|
+
} as const;
|
|
176
|
+
|
|
177
|
+
export const GAMEPAD = {
|
|
178
|
+
BUTTON_UNKNOWN: 0,
|
|
179
|
+
BUTTON_LEFT_FACE_UP: 1,
|
|
180
|
+
BUTTON_LEFT_FACE_RIGHT: 2,
|
|
181
|
+
BUTTON_LEFT_FACE_DOWN: 3,
|
|
182
|
+
BUTTON_LEFT_FACE_LEFT: 4,
|
|
183
|
+
BUTTON_RIGHT_FACE_UP: 5,
|
|
184
|
+
BUTTON_RIGHT_FACE_RIGHT: 6,
|
|
185
|
+
BUTTON_RIGHT_FACE_DOWN: 7,
|
|
186
|
+
BUTTON_RIGHT_FACE_LEFT: 8,
|
|
187
|
+
BUTTON_LEFT_TRIGGER_1: 9,
|
|
188
|
+
BUTTON_LEFT_TRIGGER_2: 10,
|
|
189
|
+
BUTTON_RIGHT_TRIGGER_1: 11,
|
|
190
|
+
BUTTON_RIGHT_TRIGGER_2: 12,
|
|
191
|
+
BUTTON_MIDDLE_LEFT: 13,
|
|
192
|
+
BUTTON_MIDDLE: 14,
|
|
193
|
+
BUTTON_MIDDLE_RIGHT: 15,
|
|
194
|
+
BUTTON_LEFT_THUMB: 16,
|
|
195
|
+
BUTTON_RIGHT_THUMB: 17,
|
|
196
|
+
AXIS_LEFT_X: 0,
|
|
197
|
+
AXIS_LEFT_Y: 1,
|
|
198
|
+
AXIS_RIGHT_X: 2,
|
|
199
|
+
AXIS_RIGHT_Y: 3,
|
|
200
|
+
AXIS_LEFT_TRIGGER: 4,
|
|
201
|
+
AXIS_RIGHT_TRIGGER: 5,
|
|
202
|
+
} as const;
|
|
203
|
+
|
|
204
|
+
export const FLAGS = {
|
|
205
|
+
VSYNC_HINT: 0x00000040,
|
|
206
|
+
FULLSCREEN_MODE: 0x00000002,
|
|
207
|
+
WINDOW_RESIZABLE: 0x00000004,
|
|
208
|
+
WINDOW_UNDECORATED: 0x00000008,
|
|
209
|
+
WINDOW_HIDDEN: 0x00000080,
|
|
210
|
+
WINDOW_MINIMIZED: 0x00000200,
|
|
211
|
+
WINDOW_MAXIMIZED: 0x00000400,
|
|
212
|
+
WINDOW_UNFOCUSED: 0x00000800,
|
|
213
|
+
WINDOW_TOPMOST: 0x00001000,
|
|
214
|
+
WINDOW_ALWAYS_RUN: 0x00000100,
|
|
215
|
+
WINDOW_TRANSPARENT: 0x00000010,
|
|
216
|
+
WINDOW_HIGHDPI: 0x00002000,
|
|
217
|
+
WINDOW_MOUSE_PASSTHROUGH: 0x00004000,
|
|
218
|
+
BORDERLESS_WINDOWED_MODE: 0x00008000,
|
|
219
|
+
MSAA_4X_HINT: 0x00000020,
|
|
220
|
+
INTERLACED_HINT: 0x00010000,
|
|
221
|
+
} as const;
|
|
222
|
+
|
|
223
|
+
export const LOG = {
|
|
224
|
+
ALL: 0,
|
|
225
|
+
TRACE: 1,
|
|
226
|
+
DEBUG: 2,
|
|
227
|
+
INFO: 3,
|
|
228
|
+
WARNING: 4,
|
|
229
|
+
ERROR: 5,
|
|
230
|
+
FATAL: 6,
|
|
231
|
+
NONE: 7,
|
|
232
|
+
} as const;
|
|
233
|
+
|
|
234
|
+
export const BLEND = {
|
|
235
|
+
ALPHA: 0,
|
|
236
|
+
ADDITIVE: 1,
|
|
237
|
+
MULTIPLIED: 2,
|
|
238
|
+
ADD_COLORS: 3,
|
|
239
|
+
SUBTRACT_COLORS: 4,
|
|
240
|
+
ALPHA_PREMULTIPLY: 5,
|
|
241
|
+
CUSTOM: 6,
|
|
242
|
+
CUSTOM_SEPARATE: 7,
|
|
243
|
+
} as const;
|
|
244
|
+
|
|
245
|
+
export const GESTURE = {
|
|
246
|
+
NONE: 0,
|
|
247
|
+
TAP: 1,
|
|
248
|
+
DOUBLETAP: 2,
|
|
249
|
+
HOLD: 4,
|
|
250
|
+
DRAG: 8,
|
|
251
|
+
SWIPE_RIGHT: 16,
|
|
252
|
+
SWIPE_LEFT: 32,
|
|
253
|
+
SWIPE_UP: 64,
|
|
254
|
+
SWIPE_DOWN: 128,
|
|
255
|
+
PINCH_IN: 256,
|
|
256
|
+
PINCH_OUT: 512,
|
|
257
|
+
} as const;
|
|
258
|
+
|
|
259
|
+
export const CAMERA = {
|
|
260
|
+
CUSTOM: 0,
|
|
261
|
+
FREE: 1,
|
|
262
|
+
ORBITAL: 2,
|
|
263
|
+
FIRST_PERSON: 3,
|
|
264
|
+
THIRD_PERSON: 4,
|
|
265
|
+
PERSPECTIVE: 0,
|
|
266
|
+
ORTHOGRAPHIC: 1,
|
|
267
|
+
} as const;
|
|
268
|
+
|
|
269
|
+
export const PIXELFORMAT = {
|
|
270
|
+
UNCOMPRESSED_GRAYSCALE: 1,
|
|
271
|
+
UNCOMPRESSED_GRAY_ALPHA: 2,
|
|
272
|
+
UNCOMPRESSED_R5G6B5: 3,
|
|
273
|
+
UNCOMPRESSED_R8G8B8: 4,
|
|
274
|
+
UNCOMPRESSED_R5G5B5A1: 5,
|
|
275
|
+
UNCOMPRESSED_R4G4B4A4: 6,
|
|
276
|
+
UNCOMPRESSED_R8G8B8A8: 7,
|
|
277
|
+
UNCOMPRESSED_R32: 8,
|
|
278
|
+
UNCOMPRESSED_R32G32B32: 9,
|
|
279
|
+
UNCOMPRESSED_R32G32B32A32: 10,
|
|
280
|
+
UNCOMPRESSED_R16: 11,
|
|
281
|
+
UNCOMPRESSED_R16G16B16: 12,
|
|
282
|
+
UNCOMPRESSED_R16G16B16A16: 13,
|
|
283
|
+
COMPRESSED_DXT1_RGB: 14,
|
|
284
|
+
COMPRESSED_DXT1_RGBA: 15,
|
|
285
|
+
COMPRESSED_DXT3_RGBA: 16,
|
|
286
|
+
COMPRESSED_DXT5_RGBA: 17,
|
|
287
|
+
COMPRESSED_ETC1_RGB: 18,
|
|
288
|
+
COMPRESSED_ETC2_RGB: 19,
|
|
289
|
+
COMPRESSED_ETC2_EAC_RGBA: 20,
|
|
290
|
+
COMPRESSED_PVRT_RGB: 21,
|
|
291
|
+
COMPRESSED_PVRT_RGBA: 22,
|
|
292
|
+
COMPRESSED_ASTC_4x4_RGBA: 23,
|
|
293
|
+
COMPRESSED_ASTC_8x8_RGBA: 24,
|
|
294
|
+
} as const;
|
|
295
|
+
|
|
296
|
+
export const TEXTURE = {
|
|
297
|
+
FILTER_POINT: 0,
|
|
298
|
+
FILTER_BILINEAR: 1,
|
|
299
|
+
FILTER_TRILINEAR: 2,
|
|
300
|
+
FILTER_ANISOTROPIC_4X: 3,
|
|
301
|
+
FILTER_ANISOTROPIC_8X: 4,
|
|
302
|
+
FILTER_ANISOTROPIC_16X: 5,
|
|
303
|
+
WRAP_REPEAT: 0,
|
|
304
|
+
WRAP_CLAMP: 1,
|
|
305
|
+
WRAP_MIRROR_REPEAT: 2,
|
|
306
|
+
WRAP_MIRROR_CLAMP: 3,
|
|
307
|
+
} as const;
|
|
308
|
+
|
|
309
|
+
export const CUBEMAP = {
|
|
310
|
+
AUTO_DETECT: 0,
|
|
311
|
+
LINE_VERTICAL: 1,
|
|
312
|
+
LINE_HORIZONTAL: 2,
|
|
313
|
+
CROSS_THREE_BY_FOUR: 3,
|
|
314
|
+
CROSS_FOUR_BY_THREE: 4,
|
|
315
|
+
} as const;
|
|
316
|
+
|
|
317
|
+
export const FONT = {
|
|
318
|
+
DEFAULT: 0,
|
|
319
|
+
BITMAP: 1,
|
|
320
|
+
SDF: 2,
|
|
321
|
+
} as const;
|
|
322
|
+
|
|
323
|
+
export const MATERIAL_MAP = {
|
|
324
|
+
ALBEDO: 0,
|
|
325
|
+
METALNESS: 1,
|
|
326
|
+
NORMAL: 2,
|
|
327
|
+
ROUGHNESS: 3,
|
|
328
|
+
OCCLUSION: 4,
|
|
329
|
+
EMISSION: 5,
|
|
330
|
+
HEIGHT: 6,
|
|
331
|
+
CUBEMAP: 7,
|
|
332
|
+
IRRADIANCE: 8,
|
|
333
|
+
PREFILTER: 9,
|
|
334
|
+
BRDF: 10,
|
|
335
|
+
DIFFUSE: 0,
|
|
336
|
+
SPECULAR: 1,
|
|
337
|
+
} as const;
|
|
338
|
+
|
|
339
|
+
export const SHADER_LOC = {
|
|
340
|
+
VERTEX_POSITION: 0,
|
|
341
|
+
VERTEX_TEXCOORD01: 1,
|
|
342
|
+
VERTEX_TEXCOORD02: 2,
|
|
343
|
+
VERTEX_NORMAL: 3,
|
|
344
|
+
VERTEX_TANGENT: 4,
|
|
345
|
+
VERTEX_COLOR: 5,
|
|
346
|
+
MATRIX_MVP: 6,
|
|
347
|
+
MATRIX_VIEW: 7,
|
|
348
|
+
MATRIX_PROJECTION: 8,
|
|
349
|
+
MATRIX_MODEL: 9,
|
|
350
|
+
MATRIX_NORMAL: 10,
|
|
351
|
+
VECTOR_VIEW: 11,
|
|
352
|
+
COLOR_DIFFUSE: 12,
|
|
353
|
+
COLOR_SPECULAR: 13,
|
|
354
|
+
COLOR_AMBIENT: 14,
|
|
355
|
+
MAP_ALBEDO: 15,
|
|
356
|
+
MAP_METALNESS: 16,
|
|
357
|
+
MAP_NORMAL: 17,
|
|
358
|
+
MAP_ROUGHNESS: 18,
|
|
359
|
+
MAP_OCCLUSION: 19,
|
|
360
|
+
MAP_EMISSION: 20,
|
|
361
|
+
MAP_HEIGHT: 21,
|
|
362
|
+
MAP_CUBEMAP: 22,
|
|
363
|
+
MAP_IRRADIANCE: 23,
|
|
364
|
+
MAP_PREFILTER: 24,
|
|
365
|
+
MAP_BRDF: 25,
|
|
366
|
+
VERTEX_BONEIDS: 26,
|
|
367
|
+
VERTEX_BONEWEIGHTS: 27,
|
|
368
|
+
BONE_MATRICES: 28,
|
|
369
|
+
MAP_DIFFUSE: 15,
|
|
370
|
+
MAP_SPECULAR: 16,
|
|
371
|
+
} as const;
|
|
372
|
+
|
|
373
|
+
export const SHADER_UNIFORM = {
|
|
374
|
+
FLOAT: 0,
|
|
375
|
+
VEC2: 1,
|
|
376
|
+
VEC3: 2,
|
|
377
|
+
VEC4: 3,
|
|
378
|
+
INT: 4,
|
|
379
|
+
IVEC2: 5,
|
|
380
|
+
IVEC3: 6,
|
|
381
|
+
IVEC4: 7,
|
|
382
|
+
SAMPLER2D: 8,
|
|
383
|
+
} as const;
|
|
384
|
+
|
|
385
|
+
export const SHADER_ATTRIB = {
|
|
386
|
+
FLOAT: 0,
|
|
387
|
+
VEC2: 1,
|
|
388
|
+
VEC3: 2,
|
|
389
|
+
VEC4: 3,
|
|
390
|
+
} as const;
|
|
391
|
+
|
|
392
|
+
export const NPATCH = {
|
|
393
|
+
NINE_PATCH: 0,
|
|
394
|
+
THREE_PATCH_VERTICAL: 1,
|
|
395
|
+
THREE_PATCH_HORIZONTAL: 2,
|
|
396
|
+
} as const;
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export { Raylib } from "./Raylib";
|
|
2
|
+
export { configure, getSymbols } from "./symbols";
|
|
3
|
+
export type { RaylibConfig } from "./symbols";
|
|
4
|
+
export { cstr, color } from "./utils";
|
|
5
|
+
export type {
|
|
6
|
+
CameraProjection,
|
|
7
|
+
Vec2,
|
|
8
|
+
Vec3,
|
|
9
|
+
Vec4,
|
|
10
|
+
Rectangle,
|
|
11
|
+
Color,
|
|
12
|
+
Texture2D,
|
|
13
|
+
RenderTexture2D,
|
|
14
|
+
Model,
|
|
15
|
+
BoundingBox,
|
|
16
|
+
Font,
|
|
17
|
+
Image,
|
|
18
|
+
Shader,
|
|
19
|
+
Wave,
|
|
20
|
+
Sound,
|
|
21
|
+
Music,
|
|
22
|
+
AudioStream,
|
|
23
|
+
Material,
|
|
24
|
+
Mesh,
|
|
25
|
+
ModelAnimation,
|
|
26
|
+
RayCollision,
|
|
27
|
+
GlyphInfo,
|
|
28
|
+
} from "./types";
|
|
29
|
+
export * from "./constants";
|