rayjs/bindings/src/index.ts

1012 lines
44 KiB
TypeScript
Raw Normal View History

2023-05-06 21:43:40 +00:00
import { readFileSync, writeFileSync } from "fs";
2023-05-14 20:19:47 +00:00
import { RayLibApi, RayLibFunction, RayLibType } from "./interfaces";
import { ApiDescription, ApiFunction } from "./api";
2023-05-08 14:43:50 +00:00
import { RayLibHeader } from "./raylib-header";
2023-05-06 21:43:40 +00:00
2023-05-14 20:19:47 +00:00
function parseMathHeader(): RayLibFunction[] {
return readFileSync("thirdparty/raylib/src/raymath.h", 'utf8')
.split("\n")
.filter(x => x.startsWith("RMAPI"))
.map(inputString => {
const matches = inputString.match(/^RMAPI\s+([\w<>]+)\s+([\w<>]+)\((.*)\)$/);
if(!matches) throw new Error("Unable to match " + inputString)
const args = matches[3].split(',').filter(x => x !== 'void').map(arg => {
arg = arg.trim().replace(" *", "* ")
const frags = arg.split(' ')
const name = frags.pop()
const type = frags.join(' ').replace("*", " *")
2023-05-15 15:44:28 +00:00
2023-05-14 20:19:47 +00:00
return { name: name || "", type: type }
})
return {
name: matches[2],
returnType: matches[1],
params: args,
description: ""
}
});
}
2023-05-06 21:43:40 +00:00
function main(){
2023-05-14 20:19:47 +00:00
const mathApi = parseMathHeader();
writeFileSync("bindings/raylib_math_api.json", JSON.stringify(mathApi))
2023-05-06 21:43:40 +00:00
const api = <RayLibApi>JSON.parse(readFileSync("thirdparty/raylib/parser/output/raylib_api.json", 'utf8'))
api.functions.push({
name: "SetModelMaterial",
description: "Replace material in slot materialIndex",
returnType: "void",
params: [{type: "Model *",name:"model"},{type:"int",name:"materialIndex"},{type:"Material",name:"material"}]
})
2023-05-15 15:44:28 +00:00
mathApi.forEach(x => api.functions.push(x))
2023-05-06 21:43:40 +00:00
const apiDesc = new ApiDescription(api)
2023-05-14 20:19:47 +00:00
const core = new RayLibHeader("raylib_core", apiDesc)
core.addApiStructByName("Color", {
2023-05-08 21:37:58 +00:00
properties: {
r: { get: true, set: true },
g: { get: true, set: true },
b: { get: true, set: true },
a: { get: true, set: true },
2023-05-09 21:25:28 +00:00
},
createConstructor: true
2023-05-08 21:37:58 +00:00
})
2023-05-14 20:19:47 +00:00
core.addApiStructByName("Rectangle", {
2023-05-11 20:10:40 +00:00
properties: {
x: { get: true, set: true },
y: { get: true, set: true },
width: { get: true, set: true },
height: { get: true, set: true },
},
createConstructor: true
})
2023-05-14 20:19:47 +00:00
core.addApiStructByName("Vector2", {
2023-05-10 21:26:53 +00:00
properties: {
x: { get: true, set: true },
y: { get: true, set: true },
},
createConstructor: true
})
2023-05-14 20:19:47 +00:00
core.addApiStructByName("Vector3", {
2023-05-13 12:49:05 +00:00
properties: {
x: { get: true, set: true },
y: { get: true, set: true },
z: { get: true, set: true },
},
createConstructor: true
})
2023-05-14 20:19:47 +00:00
core.addApiStructByName("Vector4", {
properties: {
x: { get: true, set: true },
y: { get: true, set: true },
z: { get: true, set: true },
w: { get: true, set: true },
},
createConstructor: true
})
core.addApiStructByName("Ray", {
2023-05-13 12:49:05 +00:00
properties: {
position: { get: false, set: true },
direction: { get: false, set: true },
},
createConstructor: true
})
2023-05-14 20:19:47 +00:00
core.addApiStructByName("RayCollision", {
properties: {
hit: { get: true, set: false },
distance: { get: true, set: false },
//point: { get: true, set: false },
//normal: { get: true, set: false },
},
createConstructor: false
})
core.addApiStructByName("Camera2D",{
2023-05-13 12:49:05 +00:00
properties: {
offset: { get: false, set: true },
target: { get: false, set: true },
rotation: { get: true, set: true },
zoom: { get: true, set: true },
},
createConstructor: true
})
2023-05-14 20:19:47 +00:00
core.addApiStructByName("Camera3D",{
properties: {
2023-05-16 06:28:30 +00:00
position: { get: true, set: true },
target: { get: true, set: true },
2023-05-14 20:19:47 +00:00
up: { get: false, set: true },
fovy: { get: true, set: true },
projection: { get: true, set: true },
},
createConstructor: true
})
core.addApiStructByName("BoundingBox",{
properties: {},
createConstructor: true
})
core.addApiStructByName("Matrix",{
2023-05-13 12:49:05 +00:00
properties: {},
createConstructor: false
})
core.addApiStructByName("NPatchInfo",{
properties: {
source: { get: true, set: true },
left: { get: true, set: true },
top: { get: true, set: true },
right: { get: true, set: true },
bottom: { get: true, set: true },
layout: { get: true, set: true },
},
createConstructor: true
})
2023-05-14 20:19:47 +00:00
core.addApiStructByName("Image", {
properties: {
width: { get: true },
height: { get: true },
mipmaps: { get: true },
format: { get: true }
},
//destructor: "UnloadImage"
2023-05-14 20:19:47 +00:00
})
core.addApiStructByName("Wave", {
properties: {
frameCount: { get: true },
sampleRate: { get: true },
sampleSize: { get: true },
channels: { get: true }
},
//destructor: "UnloadWave"
2023-05-14 20:19:47 +00:00
})
core.addApiStructByName("Sound", {
properties: {
frameCount: { get: true }
},
//destructor: "UnloadSound"
2023-05-14 20:19:47 +00:00
})
core.addApiStructByName("Music", {
properties: {
frameCount: { get: true },
looping: { get: true, set: true }
},
//destructor: "UnloadMusicStream"
2023-05-14 20:19:47 +00:00
})
core.addApiStructByName("Model", {
properties: {},
//destructor: "UnloadModel"
2023-05-14 20:19:47 +00:00
})
core.addApiStructByName("Mesh", {
properties: {
vertexCount: { get: true, set: true },
triangleCount: { get: true, set: true },
// TODO: Free previous pointers before overwriting
vertices: { set: true },
texcoords: { set: true },
texcoords2: { set: true },
normals: { set: true },
tangents: { set: true },
colors: { set: true },
indices: { set: true },
animVertices: { set: true },
animNormals: { set: true },
boneIds: { set: true },
boneWeights: { set: true },
},
createEmptyConstructor: true
//destructor: "UnloadMesh"
2023-05-14 20:19:47 +00:00
})
core.addApiStructByName("Shader", {
properties: {},
//destructor: "UnloadShader"
2023-05-14 20:19:47 +00:00
})
core.addApiStructByName("Texture", {
properties: {
width: { get: true },
height: { get: true }
},
//destructor: "UnloadTexture"
2023-05-14 20:19:47 +00:00
})
core.addApiStructByName("Font", {
properties: {
baseSize: { get: true }
},
//destructor: "UnloadFont"
})
core.addApiStructByName("RenderTexture", {
properties: { },
//destructor: "UnloadRenderTexture"
})
core.addApiStructByName("MaterialMap", {
properties: {
texture: { set: true },
color: { set: true, get: true },
value: { get: true, set: true }
},
//destructor: "UnloadMaterialMap"
})
core.addApiStructByName("Material", {
properties: {
shader: { set: true }
},
//destructor: "UnloadMaterial"
2023-05-14 20:19:47 +00:00
})
2023-05-13 12:49:05 +00:00
// Window-related functions
2023-05-14 20:19:47 +00:00
core.addApiFunctionByName("InitWindow")
core.addApiFunctionByName("WindowShouldClose")
core.addApiFunctionByName("CloseWindow")
core.addApiFunctionByName("IsWindowReady")
core.addApiFunctionByName("IsWindowFullscreen")
core.addApiFunctionByName("IsWindowHidden")
core.addApiFunctionByName("IsWindowMinimized")
core.addApiFunctionByName("IsWindowMaximized")
core.addApiFunctionByName("IsWindowFocused")
core.addApiFunctionByName("IsWindowResized")
core.addApiFunctionByName("IsWindowState")
core.addApiFunctionByName("SetWindowState")
core.addApiFunctionByName("ClearWindowState")
core.addApiFunctionByName("ToggleFullscreen")
core.addApiFunctionByName("MaximizeWindow")
core.addApiFunctionByName("MinimizeWindow")
core.addApiFunctionByName("RestoreWindow")
2023-05-15 21:02:41 +00:00
core.addApiFunctionByName("SetWindowIcon")
2023-05-13 12:49:05 +00:00
// SetWindowIcons
2023-05-14 20:19:47 +00:00
core.addApiFunctionByName("SetWindowTitle")
core.addApiFunctionByName("SetWindowPosition")
core.addApiFunctionByName("SetWindowMonitor")
core.addApiFunctionByName("SetWindowMinSize")
core.addApiFunctionByName("SetWindowSize")
core.addApiFunctionByName("SetWindowOpacity")
2023-05-13 12:49:05 +00:00
// GetWindowHandle
2023-05-14 20:19:47 +00:00
core.addApiFunctionByName("GetScreenWidth")
core.addApiFunctionByName("GetScreenHeight")
core.addApiFunctionByName("GetRenderWidth")
core.addApiFunctionByName("GetRenderHeight")
core.addApiFunctionByName("GetMonitorCount")
core.addApiFunctionByName("GetCurrentMonitor")
core.addApiFunctionByName("GetMonitorPosition")
core.addApiFunctionByName("GetMonitorWidth")
core.addApiFunctionByName("GetMonitorHeight")
core.addApiFunctionByName("GetMonitorPhysicalWidth")
core.addApiFunctionByName("GetMonitorPhysicalHeight")
core.addApiFunctionByName("GetMonitorRefreshRate")
core.addApiFunctionByName("GetWindowPosition")
core.addApiFunctionByName("GetWindowScaleDPI")
core.addApiFunctionByName("GetMonitorName")
core.addApiFunctionByName("SetClipboardText")
core.addApiFunctionByName("GetClipboardText")
core.addApiFunctionByName("EnableEventWaiting")
core.addApiFunctionByName("DisableEventWaiting")
2023-05-13 12:49:05 +00:00
// Custom frame control functions
// NOT SUPPORTED BECAUSE NEEDS COMPILER FLAG
// Cursor-related functions
2023-05-14 20:19:47 +00:00
core.addApiFunctionByName("ShowCursor")
core.addApiFunctionByName("HideCursor")
core.addApiFunctionByName("IsCursorHidden")
core.addApiFunctionByName("EnableCursor")
core.addApiFunctionByName("DisableCursor")
core.addApiFunctionByName("IsCursorOnScreen")
2023-05-13 12:49:05 +00:00
// Drawing related functions
2023-05-14 20:19:47 +00:00
core.addApiFunctionByName("ClearBackground")
core.addApiFunctionByName("BeginDrawing")
core.addApiFunctionByName("EndDrawing", null, { before: fun => fun.call("app_update_quickjs", []) })
core.addApiFunctionByName("BeginMode2D")
core.addApiFunctionByName("EndMode2D")
core.addApiFunctionByName("BeginMode3D")
core.addApiFunctionByName("EndMode3D")
core.addApiFunctionByName("BeginTextureMode")
core.addApiFunctionByName("EndTextureMode")
2023-05-15 21:02:41 +00:00
core.addApiFunctionByName("BeginShaderMode")
core.addApiFunctionByName("EndShaderMode")
2023-05-14 20:19:47 +00:00
core.addApiFunctionByName("BeginBlendMode")
core.addApiFunctionByName("EndBlendMode")
core.addApiFunctionByName("BeginScissorMode")
core.addApiFunctionByName("EndScissorMode")
//core.addApiFunctionByName("BeginVrStereoMode")
//core.addApiFunctionByName("EndVrStereoMode")
2023-05-13 12:49:05 +00:00
// VR Stereo config options
2023-05-14 20:19:47 +00:00
//core.addApiFunctionByName("LoadVrStereoConfig")
//core.addApiFunctionByName("UnloadVrStereoConfig")
2023-05-13 12:49:05 +00:00
// Shader Management
2023-05-15 21:02:41 +00:00
core.addApiFunctionByName("LoadShader")
2023-05-14 20:19:47 +00:00
// core.addApiFunctionByName("LoadShaderFromMemory")
2023-05-15 21:02:41 +00:00
core.addApiFunctionByName("IsShaderReady")
core.addApiFunctionByName("GetShaderLocation")
core.addApiFunctionByName("GetShaderLocationAttrib")
2023-05-16 06:28:30 +00:00
core.addApiFunctionByName("SetShaderValue", null, { body: (gen) => {
gen.jsToC("Shader","shader","argv[0]", core.structLookup)
gen.jsToC("int","locIndex","argv[1]", core.structLookup)
gen.declare("value","void *", false, "NULL")
2023-05-16 09:59:29 +00:00
gen.declare("valueFloat", "float")
gen.declare("valueInt", "int")
2023-05-16 06:28:30 +00:00
gen.jsToC("int","uniformType","argv[3]", core.structLookup)
const sw = gen.switch("uniformType")
let b = sw.caseBreak("SHADER_UNIFORM_FLOAT")
2023-05-16 09:59:29 +00:00
b.jsToC("float", "valueFloat", "argv[2]", core.structLookup, true)
2023-05-16 06:28:30 +00:00
b.statement("value = (void *)&valueFloat")
b = sw.caseBreak("SHADER_UNIFORM_VEC2")
b.jsToC("Vector2 *", "valueV2", "argv[2]", core.structLookup)
b.statement("value = (void*)valueV2")
b = sw.caseBreak("SHADER_UNIFORM_VEC3")
b.jsToC("Vector3 *", "valueV3", "argv[2]", core.structLookup)
b.statement("value = (void*)valueV3")
b = sw.caseBreak("SHADER_UNIFORM_VEC4")
b.jsToC("Vector4 *", "valueV4", "argv[2]", core.structLookup)
b.statement("value = (void*)valueV4")
b = sw.caseBreak("SHADER_UNIFORM_INT")
2023-05-16 09:59:29 +00:00
b.jsToC("int", "valueInt", "argv[2]", core.structLookup, true)
2023-05-16 06:28:30 +00:00
b.statement("value = (void*)&valueInt")
b = sw.defaultBreak()
b.returnExp("JS_EXCEPTION")
gen.call("SetShaderValue", ["shader","locIndex","value","uniformType"])
gen.returnExp("JS_UNDEFINED")
}})
2023-05-14 20:19:47 +00:00
// core.addApiFunctionByName("SetShaderValueV")
2023-05-15 21:02:41 +00:00
core.addApiFunctionByName("SetShaderValueMatrix")
core.addApiFunctionByName("SetShaderValueTexture")
core.addApiFunctionByName("UnloadShader")
2023-05-13 12:49:05 +00:00
// ScreenSpaceRelatedFunctions
2023-05-15 21:02:41 +00:00
core.addApiFunctionByName("GetMouseRay")
core.addApiFunctionByName("GetCameraMatrix")
2023-05-14 20:19:47 +00:00
core.addApiFunctionByName("GetCameraMatrix2D")
2023-05-15 21:02:41 +00:00
core.addApiFunctionByName("GetWorldToScreen")
2023-05-14 20:19:47 +00:00
core.addApiFunctionByName("GetScreenToWorld2D")
2023-05-15 21:02:41 +00:00
core.addApiFunctionByName("GetWorldToScreenEx")
2023-05-14 20:19:47 +00:00
core.addApiFunctionByName("GetWorldToScreen2D")
2023-05-13 12:49:05 +00:00
// Timing related functions
2023-05-14 20:19:47 +00:00
core.addApiFunctionByName("SetTargetFPS")
core.addApiFunctionByName("GetFPS")
core.addApiFunctionByName("GetFrameTime")
core.addApiFunctionByName("GetTime")
2023-05-13 12:49:05 +00:00
// Misc functions
2023-05-14 20:19:47 +00:00
core.addApiFunctionByName("GetRandomValue")
core.addApiFunctionByName("SetRandomSeed")
core.addApiFunctionByName("TakeScreenshot")
core.addApiFunctionByName("SetConfigFlags")
2023-05-13 12:49:05 +00:00
const traceLog = apiDesc.getFunction("TraceLog")
if(!traceLog) throw new Error("TraceLog not found")
traceLog.params.pop()
2023-05-14 20:19:47 +00:00
core.addApiFunction(traceLog)
core.addApiFunctionByName("SetTraceLogLevel")
2023-05-13 12:49:05 +00:00
// Memory functions not supported on JS
2023-05-14 20:19:47 +00:00
core.addApiFunctionByName("OpenURL")
2023-05-13 12:49:05 +00:00
// Callbacks not supported on JS
// Files management functions
2023-05-14 20:19:47 +00:00
//core.addApiFunctionByName("LoadFileData")
//core.addApiFunctionByName("UnloadLoadFileData")
//core.addApiFunctionByName("SaveFileData")
2023-05-13 12:49:05 +00:00
// Export data as code not needed
2023-05-14 20:19:47 +00:00
core.addApiFunctionByName("LoadFileText", null, { after: gen => gen.call("UnloadFileText", ["returnVal"]) })
core.addApiFunctionByName("SaveFileText")
core.addApiFunctionByName("FileExists")
core.addApiFunctionByName("DirectoryExists")
core.addApiFunctionByName("IsFileExtension")
2023-05-13 12:49:05 +00:00
// TODO: Who needs to clean memory here?
2023-05-14 20:19:47 +00:00
core.addApiFunctionByName("GetFileLength")
core.addApiFunctionByName("GetFileExtension")
core.addApiFunctionByName("GetFileName")
core.addApiFunctionByName("GetFileNameWithoutExt")
core.addApiFunctionByName("GetDirectoryPath")
core.addApiFunctionByName("GetPrevDirectoryPath")
core.addApiFunctionByName("GetWorkingDirectory")
core.addApiFunctionByName("GetApplicationDirectory")
core.addApiFunctionByName("ChangeDirectory")
core.addApiFunctionByName("IsPathFile")
//core.addApiFunctionByName("LoadPathFiles")
//core.addApiFunctionByName("LoadPathFilesEx")
2023-05-13 12:49:05 +00:00
// UnloadDirectoryFiles
2023-05-14 20:19:47 +00:00
core.addApiFunctionByName("IsFileDropped")
//core.addApiFunctionByName("LoadDroppedFiles")
2023-05-13 12:49:05 +00:00
// UnloadDroppedFiles
2023-05-14 20:19:47 +00:00
core.addApiFunctionByName("GetFileModTime")
2023-05-13 12:49:05 +00:00
2023-05-13 14:31:12 +00:00
// Compression/encodeing functionality
2023-05-14 20:19:47 +00:00
//core.addApiFunctionByName("CompressData")
//core.addApiFunctionByName("DecompressData")
//core.addApiFunctionByName("EncodeDataBase64")
//core.addApiFunctionByName("DecodeDataBase64")
2023-05-13 14:31:12 +00:00
// input handling functions
2023-05-14 20:19:47 +00:00
core.addApiFunctionByName("IsKeyPressed")
core.addApiFunctionByName("IsKeyDown")
core.addApiFunctionByName("IsKeyReleased")
core.addApiFunctionByName("IsKeyUp")
core.addApiFunctionByName("SetExitKey")
core.addApiFunctionByName("GetKeyPressed")
core.addApiFunctionByName("GetCharPressed")
// input-related functions: gamepads
core.addApiFunctionByName("IsGamepadAvailable")
core.addApiFunctionByName("GetGamepadName")
core.addApiFunctionByName("IsGamepadButtonPressed")
core.addApiFunctionByName("IsGamepadButtonDown")
core.addApiFunctionByName("IsGamepadButtonReleased")
core.addApiFunctionByName("IsGamepadButtonUp")
core.addApiFunctionByName("GetGamepadButtonPressed")
core.addApiFunctionByName("GetGamepadAxisCount")
core.addApiFunctionByName("GetGamepadAxisMovement")
core.addApiFunctionByName("SetGamepadMappings")
// input-related functions: mouse
core.addApiFunctionByName("IsMouseButtonPressed")
core.addApiFunctionByName("IsMouseButtonDown")
core.addApiFunctionByName("IsMouseButtonReleased")
core.addApiFunctionByName("IsMouseButtonUp")
core.addApiFunctionByName("GetMouseX")
core.addApiFunctionByName("GetMouseY")
core.addApiFunctionByName("GetMousePosition")
core.addApiFunctionByName("GetMouseDelta")
core.addApiFunctionByName("SetMousePosition")
core.addApiFunctionByName("SetMouseOffset")
core.addApiFunctionByName("SetMouseScale")
core.addApiFunctionByName("GetMouseWheelMove")
core.addApiFunctionByName("GetMouseWheelMoveV")
core.addApiFunctionByName("SetMouseCursor")
// input-related functions: touch
core.addApiFunctionByName("GetTouchX")
core.addApiFunctionByName("GetTouchY")
core.addApiFunctionByName("GetTouchPosition")
core.addApiFunctionByName("GetTouchPointId")
core.addApiFunctionByName("GetTouchPointCount")
// Gesture and touch handling functions
core.addApiFunctionByName("SetGesturesEnabled")
core.addApiFunctionByName("IsGestureDetected")
core.addApiFunctionByName("GetGestureDetected")
core.addApiFunctionByName("GetGestureHoldDuration")
core.addApiFunctionByName("GetGestureDragVector")
core.addApiFunctionByName("GetGestureDragAngle")
core.addApiFunctionByName("GetGesturePinchVector")
core.addApiFunctionByName("GetGesturePinchAngle")
// Camera system functions
2023-05-15 21:02:41 +00:00
core.addApiFunctionByName("UpdateCamera")
core.addApiFunctionByName("UpdateCameraPro")
2023-05-14 20:19:47 +00:00
//api.functions.forEach(x => console.log(`core.addApiFunctionByName("${x.name}")`))
// module: rshapes
// TODO: Do we need ref-counting here?
//core.addApiFunctionByName("SetShapesTexture")
// Basic shapes drawing functions
core.addApiFunctionByName("DrawPixel")
core.addApiFunctionByName("DrawPixelV")
core.addApiFunctionByName("DrawLine")
core.addApiFunctionByName("DrawLineV")
core.addApiFunctionByName("DrawLineEx")
core.addApiFunctionByName("DrawLineBezier")
core.addApiFunctionByName("DrawLineBezierQuad")
core.addApiFunctionByName("DrawLineBezierCubic")
// core.addApiFunctionByName("DrawLineStrip")
core.addApiFunctionByName("DrawCircle")
core.addApiFunctionByName("DrawCircleSector")
core.addApiFunctionByName("DrawCircleSectorLines")
core.addApiFunctionByName("DrawCircleGradient")
core.addApiFunctionByName("DrawCircleV")
core.addApiFunctionByName("DrawCircleLines")
core.addApiFunctionByName("DrawEllipse")
core.addApiFunctionByName("DrawEllipseLines")
core.addApiFunctionByName("DrawRing")
core.addApiFunctionByName("DrawRingLines")
core.addApiFunctionByName("DrawRectangle")
core.addApiFunctionByName("DrawRectangleV")
core.addApiFunctionByName("DrawRectangleRec")
core.addApiFunctionByName("DrawRectanglePro")
core.addApiFunctionByName("DrawRectangleGradientV")
core.addApiFunctionByName("DrawRectangleGradientH")
core.addApiFunctionByName("DrawRectangleGradientEx")
core.addApiFunctionByName("DrawRectangleLines")
core.addApiFunctionByName("DrawRectangleLinesEx")
core.addApiFunctionByName("DrawRectangleRounded")
core.addApiFunctionByName("DrawRectangleRoundedLines")
core.addApiFunctionByName("DrawTriangle")
core.addApiFunctionByName("DrawTriangleLines")
//core.addApiFunctionByName("DrawTriangleFan")
//core.addApiFunctionByName("DrawTriangleStrip")
core.addApiFunctionByName("DrawPoly")
core.addApiFunctionByName("DrawPolyLines")
core.addApiFunctionByName("DrawPolyLinesEx")
// Basic shapes collision detection functions
core.addApiFunctionByName("CheckCollisionRecs")
core.addApiFunctionByName("CheckCollisionCircles")
core.addApiFunctionByName("CheckCollisionCircleRec")
core.addApiFunctionByName("CheckCollisionPointRec")
core.addApiFunctionByName("CheckCollisionPointCircle")
core.addApiFunctionByName("CheckCollisionPointTriangle")
// core.addApiFunctionByName("CheckCollisionPointPoly")
// core.addApiFunctionByName("CheckCollisionLines")
core.addApiFunctionByName("CheckCollisionPointLine")
core.addApiFunctionByName("GetCollisionRec")
// Image loading functions
core.addApiFunctionByName("LoadImage")
core.addApiFunctionByName("LoadImageRaw")
// core.addApiFunctionByName("LoadImageAnim")
// core.addApiFunctionByName("LoadImageFromMemory")
core.addApiFunctionByName("LoadImageFromTexture")
core.addApiFunctionByName("LoadImageFromScreen")
core.addApiFunctionByName("IsImageReady")
core.addApiFunctionByName("UnloadImage")
2023-05-14 20:19:47 +00:00
core.addApiFunctionByName("ExportImage")
// needed?
// core.addApiFunctionByName("ExportImageAsCode")
// Image generation functions
core.addApiFunctionByName("GenImageColor")
core.addApiFunctionByName("GenImageGradientV")
core.addApiFunctionByName("GenImageGradientH")
core.addApiFunctionByName("GenImageGradientRadial")
core.addApiFunctionByName("GenImageChecked")
core.addApiFunctionByName("GenImageWhiteNoise")
core.addApiFunctionByName("GenImagePerlinNoise")
core.addApiFunctionByName("GenImageCellular")
core.addApiFunctionByName("GenImageText")
// Image manipulations functions
core.addApiFunctionByName("ImageCopy")
core.addApiFunctionByName("ImageFromImage")
core.addApiFunctionByName("ImageText")
2023-05-15 21:02:41 +00:00
core.addApiFunctionByName("ImageTextEx")
core.addApiFunctionByName("ImageFormat")
core.addApiFunctionByName("ImageToPOT")
core.addApiFunctionByName("ImageCrop")
core.addApiFunctionByName("ImageAlphaCrop")
core.addApiFunctionByName("ImageAlphaClear")
core.addApiFunctionByName("ImageAlphaMask")
core.addApiFunctionByName("ImageAlphaPremultiply")
core.addApiFunctionByName("ImageBlurGaussian")
core.addApiFunctionByName("ImageResize")
core.addApiFunctionByName("ImageResizeNN")
core.addApiFunctionByName("ImageResizeCanvas")
core.addApiFunctionByName("ImageMipmaps")
core.addApiFunctionByName("ImageDither")
core.addApiFunctionByName("ImageFlipVertical")
core.addApiFunctionByName("ImageFlipHorizontal")
core.addApiFunctionByName("ImageRotateCW")
core.addApiFunctionByName("ImageRotateCCW")
core.addApiFunctionByName("ImageColorTint")
core.addApiFunctionByName("ImageColorInvert")
core.addApiFunctionByName("ImageColorGrayscale")
core.addApiFunctionByName("ImageColorContrast")
core.addApiFunctionByName("ImageColorBrightness")
core.addApiFunctionByName("ImageColorReplace")
const lic = <ApiFunction>apiDesc.getFunction("LoadImageColors")
lic.returnType = "unsigned char *"
core.addApiFunction(lic, null, { body: (gen) => {
gen.jsToC("Image","image","argv[0]", core.structLookup)
gen.call("LoadImageColors", ["image"], {name:"colors",type:"Color *"})
gen.statement("JSValue retVal = JS_NewArrayBufferCopy(ctx, (const uint8_t*)colors, image.width*image.height*sizeof(Color))")
gen.call("UnloadImageColors", ["colors"])
gen.returnExp("retVal")
}})
2023-05-15 21:02:41 +00:00
//core.addApiFunctionByName("LoadImagePalette")
//core.addApiFunctionByName("UnloadImageColors")
//core.addApiFunctionByName("UnloadImagePalette")
2023-05-14 20:19:47 +00:00
core.addApiFunctionByName("GetImageAlphaBorder")
core.addApiFunctionByName("GetImageColor")
// Image drawing functions
2023-05-15 21:02:41 +00:00
core.addApiFunctionByName("ImageClearBackground")
core.addApiFunctionByName("ImageDrawPixel")
core.addApiFunctionByName("ImageDrawPixelV")
core.addApiFunctionByName("ImageDrawLine")
core.addApiFunctionByName("ImageDrawLineV")
core.addApiFunctionByName("ImageDrawCircle")
core.addApiFunctionByName("ImageDrawCircleV")
core.addApiFunctionByName("ImageDrawCircleLines")
core.addApiFunctionByName("ImageDrawCircleLinesV")
core.addApiFunctionByName("ImageDrawRectangle")
core.addApiFunctionByName("ImageDrawRectangleV")
core.addApiFunctionByName("ImageDrawRectangleRec")
core.addApiFunctionByName("ImageDrawRectangleLines")
core.addApiFunctionByName("ImageDraw")
core.addApiFunctionByName("ImageDrawText")
core.addApiFunctionByName("ImageDrawTextEx")
2023-05-14 20:19:47 +00:00
// Texture loading functions
core.addApiFunctionByName("LoadTexture")
core.addApiFunctionByName("LoadTextureFromImage")
core.addApiFunctionByName("LoadTextureCubemap")
core.addApiFunctionByName("LoadRenderTexture")
2023-05-14 20:19:47 +00:00
core.addApiFunctionByName("IsTextureReady")
core.addApiFunctionByName("UnloadTexture")
core.addApiFunctionByName("IsRenderTextureReady")
core.addApiFunctionByName("UnloadRenderTexture")
2023-05-14 20:19:47 +00:00
// core.addApiFunctionByName("UpdateTexture")
// core.addApiFunctionByName("UpdateTextureRec")
// Texture configuration functions
2023-05-15 21:02:41 +00:00
core.addApiFunctionByName("GenTextureMipmaps")
2023-05-14 20:19:47 +00:00
core.addApiFunctionByName("SetTextureFilter")
core.addApiFunctionByName("SetTextureWrap")
// Texture drawing functions
core.addApiFunctionByName("DrawTexture")
core.addApiFunctionByName("DrawTextureV")
core.addApiFunctionByName("DrawTextureEx")
core.addApiFunctionByName("DrawTextureRec")
core.addApiFunctionByName("DrawTexturePro")
core.addApiFunctionByName("DrawTextureNPatch")
2023-05-14 20:19:47 +00:00
// Color/pixel related functions
core.addApiFunctionByName("Fade")
core.addApiFunctionByName("ColorToInt")
core.addApiFunctionByName("ColorNormalize")
core.addApiFunctionByName("ColorFromNormalized")
core.addApiFunctionByName("ColorToHSV")
core.addApiFunctionByName("ColorFromHSV")
core.addApiFunctionByName("ColorTint")
core.addApiFunctionByName("ColorBrightness")
core.addApiFunctionByName("ColorContrast")
core.addApiFunctionByName("ColorAlpha")
core.addApiFunctionByName("ColorAlphaBlend")
core.addApiFunctionByName("GetColor")
// core.addApiFunctionByName("GetPixelColor")
// core.addApiFunctionByName("SetPixelColor")
core.addApiFunctionByName("GetPixelDataSize")
// module: rtext
// Font loading/unloading
core.addApiFunctionByName("GetFontDefault")
core.addApiFunctionByName("LoadFont")
// core.addApiFunctionByName("LoadFontEx")
core.addApiFunctionByName("LoadFontFromImage")
// core.addApiFunctionByName("LoadFontFromMemory")
core.addApiFunctionByName("IsFontReady")
// core.addApiFunctionByName("LoadFontData")
// core.addApiFunctionByName("GenImageFontAtlas")
// core.addApiFunctionByName("UnloadFontData")
core.addApiFunctionByName("UnloadFont")
2023-05-14 20:19:47 +00:00
// core.addApiFunctionByName("ExportFontAsCode")
// Text drawing functions
core.addApiFunctionByName("DrawFPS")
core.addApiFunctionByName("DrawText")
core.addApiFunctionByName("DrawTextEx")
core.addApiFunctionByName("DrawTextPro")
core.addApiFunctionByName("DrawTextCodepoint")
//core.addApiFunctionByName("DrawTextCodepoints")
// Text font info functions
core.addApiFunctionByName("MeasureText")
core.addApiFunctionByName("MeasureTextEx")
core.addApiFunctionByName("GetGlyphIndex")
// core.addApiFunctionByName("GetGlyphInfo")
core.addApiFunctionByName("GetGlyphAtlasRec")
// Text codepoints management functions (unicode characters)
// Is this needed?
// core.addApiFunctionByName("LoadUTF8")
// core.addApiFunctionByName("UnloadUTF8")
// core.addApiFunctionByName("LoadCodepoints")
// core.addApiFunctionByName("UnloadCodepoints")
// core.addApiFunctionByName("GetCodepointCount")
// core.addApiFunctionByName("GetCodepoint")
// core.addApiFunctionByName("GetCodepointNext")
// core.addApiFunctionByName("GetCodepointPrevious")
// core.addApiFunctionByName("CodepointToUTF8")
// Text strings management functions (no UTF-8 strings, only byte chars)
2023-05-15 21:02:41 +00:00
// Not supported, use JS Stdlib instead
2023-05-14 20:19:47 +00:00
// module: rmodels
// Basic geometric 3D shapes drawing functions
core.addApiFunctionByName("DrawLine3D")
core.addApiFunctionByName("DrawPoint3D")
core.addApiFunctionByName("DrawCircle3D")
core.addApiFunctionByName("DrawTriangle3D")
//core.addApiFunctionByName("DrawTriangleStrip3D")
core.addApiFunctionByName("DrawCube")
core.addApiFunctionByName("DrawCubeV")
core.addApiFunctionByName("DrawCubeWires")
core.addApiFunctionByName("DrawCubeWiresV")
core.addApiFunctionByName("DrawSphere")
core.addApiFunctionByName("DrawSphereEx")
core.addApiFunctionByName("DrawSphereWires")
core.addApiFunctionByName("DrawCylinder")
core.addApiFunctionByName("DrawCylinderEx")
core.addApiFunctionByName("DrawCylinderWires")
core.addApiFunctionByName("DrawCylinderWiresEx")
core.addApiFunctionByName("DrawCapsule")
core.addApiFunctionByName("DrawCapsuleWires")
core.addApiFunctionByName("DrawPlane")
core.addApiFunctionByName("DrawRay")
core.addApiFunctionByName("DrawGrid")
2023-05-14 20:19:47 +00:00
// model management functions
core.addApiFunctionByName("LoadModel")
core.addApiFunctionByName("LoadModelFromMesh")
core.addApiFunctionByName("IsModelReady")
core.addApiFunctionByName("UnloadModel")
2023-05-14 20:19:47 +00:00
core.addApiFunctionByName("GetModelBoundingBox")
// model drawing functions
core.addApiFunctionByName("DrawModel")
core.addApiFunctionByName("DrawModelEx")
core.addApiFunctionByName("DrawModelWires")
core.addApiFunctionByName("DrawModelWiresEx")
core.addApiFunctionByName("DrawBoundingBox")
core.addApiFunctionByName("DrawBillboard")
core.addApiFunctionByName("DrawBillboardRec")
core.addApiFunctionByName("DrawBillboardPro")
// Mesh management functions
2023-05-15 21:02:41 +00:00
// TODO: Refcounting needed?
core.addApiFunctionByName("UploadMesh")
core.addApiFunctionByName("UpdateMeshBuffer")
core.addApiFunctionByName("UnloadMesh")
core.addApiFunctionByName("DrawMesh")
core.addApiFunctionByName("DrawMeshInstanced")
2023-05-14 20:19:47 +00:00
core.addApiFunctionByName("ExportMesh")
core.addApiFunctionByName("GetMeshBoundingBox")
2023-05-15 21:02:41 +00:00
core.addApiFunctionByName("GenMeshTangents")
2023-05-14 20:19:47 +00:00
// Mesh generation functions
core.addApiFunctionByName("GenMeshPoly")
core.addApiFunctionByName("GenMeshPlane")
core.addApiFunctionByName("GenMeshCube")
core.addApiFunctionByName("GenMeshSphere")
core.addApiFunctionByName("GenMeshHemiSphere")
core.addApiFunctionByName("GenMeshCylinder")
core.addApiFunctionByName("GenMeshCone")
core.addApiFunctionByName("GenMeshTorus")
core.addApiFunctionByName("GenMeshKnot")
core.addApiFunctionByName("GenMeshHeightmap")
core.addApiFunctionByName("GenMeshCubicmap")
// Material loading/unloading functions
// core.addApiFunctionByName("LoadMaterials")
core.addApiFunctionByName("LoadMaterialDefault")
core.addApiFunctionByName("IsMaterialReady")
core.addApiFunctionByName("UnloadMaterial")
core.addApiFunctionByName("SetMaterialTexture")
core.addApiFunctionByName("SetModelMaterial")
core.addApiFunctionByName("SetModelMeshMaterial")
2023-05-14 20:19:47 +00:00
// Model animations loading/unloading functions
// core.addApiFunctionByName("LoadModelAnimations")
// core.addApiFunctionByName("UpdateModelAnimation")
// core.addApiFunctionByName("UnloadModelAnimation")
// core.addApiFunctionByName("UnloadModelAnimations")
// core.addApiFunctionByName("IsModelAnimationValid")
// Collision detection functions
core.addApiFunctionByName("CheckCollisionSpheres")
core.addApiFunctionByName("CheckCollisionBoxes")
core.addApiFunctionByName("CheckCollisionBoxSphere")
core.addApiFunctionByName("GetRayCollisionSphere")
core.addApiFunctionByName("GetRayCollisionBox")
core.addApiFunctionByName("GetRayCollisionMesh")
core.addApiFunctionByName("GetRayCollisionTriangle")
core.addApiFunctionByName("GetRayCollisionQuad")
// module: raudio
// Audio device management functions
core.addApiFunctionByName("InitAudioDevice")
core.addApiFunctionByName("CloseAudioDevice")
core.addApiFunctionByName("IsAudioDeviceReady")
core.addApiFunctionByName("SetMasterVolume")
// Wave/Sound loading/unloading functions
core.addApiFunctionByName("LoadWave")
// core.addApiFunctionByName("LoadWaveFromMemory")
core.addApiFunctionByName("IsWaveReady")
core.addApiFunctionByName("LoadSound")
core.addApiFunctionByName("LoadSoundFromWave")
core.addApiFunctionByName("IsSoundReady")
// core.addApiFunctionByName("UpdateSound")
core.addApiFunctionByName("UnloadWave")
core.addApiFunctionByName("UnloadSound")
2023-05-14 20:19:47 +00:00
core.addApiFunctionByName("ExportWave")
// core.addApiFunctionByName("ExportWaveAsCode")
// Wave/Sound management functions
core.addApiFunctionByName("PlaySound")
core.addApiFunctionByName("StopSound")
core.addApiFunctionByName("PauseSound")
core.addApiFunctionByName("ResumeSound")
core.addApiFunctionByName("IsSoundPlaying")
core.addApiFunctionByName("SetSoundVolume")
core.addApiFunctionByName("SetSoundPitch")
core.addApiFunctionByName("SetSoundPan")
core.addApiFunctionByName("WaveCopy")
2023-05-15 21:02:41 +00:00
core.addApiFunctionByName("WaveCrop")
core.addApiFunctionByName("WaveFormat")
2023-05-14 20:19:47 +00:00
// core.addApiFunctionByName("LoadWaveSamples")
// core.addApiFunctionByName("UnloadWaveSamples")
// Music management functions
core.addApiFunctionByName("LoadMusicStream")
// core.addApiFunctionByName("LoadMusicStreamFromMemory")
core.addApiFunctionByName("IsMusicReady")
core.addApiFunctionByName("UnloadMusicStream")
2023-05-14 20:19:47 +00:00
core.addApiFunctionByName("PlayMusicStream")
core.addApiFunctionByName("IsMusicStreamPlaying")
core.addApiFunctionByName("UpdateMusicStream")
core.addApiFunctionByName("StopMusicStream")
core.addApiFunctionByName("PauseMusicStream")
core.addApiFunctionByName("ResumeMusicStream")
core.addApiFunctionByName("SeekMusicStream")
core.addApiFunctionByName("SetMusicVolume")
core.addApiFunctionByName("SetMusicPitch")
core.addApiFunctionByName("SetMusicPan")
core.addApiFunctionByName("GetMusicTimeLength")
core.addApiFunctionByName("GetMusicTimePlayed")
// AudioStream management functions
// core.addApiFunctionByName("LoadAudioStream")
// core.addApiFunctionByName("IsAudioStreamReady")
// core.addApiFunctionByName("UnloadAudioStream")
// core.addApiFunctionByName("UpdateAudioStream")
// core.addApiFunctionByName("IsAudioStreamProcessed")
// core.addApiFunctionByName("PlayAudioStream")
// core.addApiFunctionByName("PauseAudioStream")
// core.addApiFunctionByName("ResumeAudioStream")
// core.addApiFunctionByName("IsAudioStreamPlaying")
// core.addApiFunctionByName("StopAudioStream")
// core.addApiFunctionByName("SetAudioStreamVolume")
// core.addApiFunctionByName("SetAudioStreamPitch")
// core.addApiFunctionByName("SetAudioStreamPan")
// core.addApiFunctionByName("SetAudioStreamBufferSizeDefault")
// core.addApiFunctionByName("SetAudioStreamCallback")
// core.addApiFunctionByName("AttachAudioStreamProcessor")
// core.addApiFunctionByName("DetachAudioStreamProcessor")
// core.addApiFunctionByName("AttachAudioMixedProcessor")
// core.addApiFunctionByName("DetachAudioMixedProcessor")
// module: raymath
2023-05-15 15:44:28 +00:00
core.addApiFunctionByName("Clamp")
core.addApiFunctionByName("Lerp")
core.addApiFunctionByName("Normalize")
core.addApiFunctionByName("Remap")
core.addApiFunctionByName("Wrap")
core.addApiFunctionByName("FloatEquals")
core.addApiFunctionByName("Vector2Zero")
core.addApiFunctionByName("Vector2One")
core.addApiFunctionByName("Vector2Add")
core.addApiFunctionByName("Vector2AddValue")
core.addApiFunctionByName("Vector2Subtract")
core.addApiFunctionByName("Vector2SubtractValue")
core.addApiFunctionByName("Vector2Length")
core.addApiFunctionByName("Vector2LengthSqr")
core.addApiFunctionByName("Vector2DotProduct")
core.addApiFunctionByName("Vector2Distance")
core.addApiFunctionByName("Vector2DistanceSqr")
core.addApiFunctionByName("Vector2Angle")
core.addApiFunctionByName("Vector2LineAngle")
core.addApiFunctionByName("Vector2Scale")
core.addApiFunctionByName("Vector2Multiply")
core.addApiFunctionByName("Vector2Negate")
core.addApiFunctionByName("Vector2Divide")
core.addApiFunctionByName("Vector2Normalize")
core.addApiFunctionByName("Vector2Transform")
core.addApiFunctionByName("Vector2Lerp")
core.addApiFunctionByName("Vector2Reflect")
core.addApiFunctionByName("Vector2Rotate")
core.addApiFunctionByName("Vector2MoveTowards")
core.addApiFunctionByName("Vector2Invert")
core.addApiFunctionByName("Vector2Clamp")
core.addApiFunctionByName("Vector2ClampValue")
core.addApiFunctionByName("Vector2Equals")
core.addApiFunctionByName("Vector3Zero")
core.addApiFunctionByName("Vector3One")
core.addApiFunctionByName("Vector3Add")
core.addApiFunctionByName("Vector3AddValue")
2023-05-15 21:02:41 +00:00
core.addApiFunctionByName("Vector3Subtract")
core.addApiFunctionByName("Vector3SubtractValue")
core.addApiFunctionByName("Vector3Scale")
core.addApiFunctionByName("Vector3Multiply")
core.addApiFunctionByName("Vector3CrossProduct")
core.addApiFunctionByName("Vector3Perpendicular")
core.addApiFunctionByName("Vector3Length")
core.addApiFunctionByName("Vector3LengthSqr")
core.addApiFunctionByName("Vector3DotProduct")
core.addApiFunctionByName("Vector3Distance")
core.addApiFunctionByName("Vector3DistanceSqr")
core.addApiFunctionByName("Vector3Angle")
core.addApiFunctionByName("Vector3Negate")
core.addApiFunctionByName("Vector3Divide")
core.addApiFunctionByName("Vector3Normalize")
//core.addApiFunctionByName("Vector3OrthoNormalize")
core.addApiFunctionByName("Vector3Transform")
core.addApiFunctionByName("Vector3RotateByQuaternion")
core.addApiFunctionByName("Vector3RotateByAxisAngle")
core.addApiFunctionByName("Vector3Lerp")
core.addApiFunctionByName("Vector3Reflect")
core.addApiFunctionByName("Vector3Min")
core.addApiFunctionByName("Vector3Max")
core.addApiFunctionByName("Vector3Barycenter")
core.addApiFunctionByName("Vector3Unproject")
//core.addApiFunctionByName("Vector3ToFloatV")
core.addApiFunctionByName("Vector3Invert")
core.addApiFunctionByName("Vector3Clamp")
core.addApiFunctionByName("Vector3ClampValue")
core.addApiFunctionByName("Vector3Equals")
core.addApiFunctionByName("Vector3Refract")
core.addApiFunctionByName("MatrixDeterminant")
core.addApiFunctionByName("MatrixTrace")
core.addApiFunctionByName("MatrixTranspose")
core.addApiFunctionByName("MatrixInvert")
core.addApiFunctionByName("MatrixIdentity")
core.addApiFunctionByName("MatrixAdd")
core.addApiFunctionByName("MatrixSubtract")
core.addApiFunctionByName("MatrixMultiply")
core.addApiFunctionByName("MatrixTranslate")
core.addApiFunctionByName("MatrixRotate")
core.addApiFunctionByName("MatrixRotateX")
core.addApiFunctionByName("MatrixRotateY")
core.addApiFunctionByName("MatrixRotateZ")
core.addApiFunctionByName("MatrixRotateXYZ")
core.addApiFunctionByName("MatrixRotateZYX")
core.addApiFunctionByName("MatrixScale")
core.addApiFunctionByName("MatrixFrustum")
core.addApiFunctionByName("MatrixPerspective")
core.addApiFunctionByName("MatrixOrtho")
core.addApiFunctionByName("MatrixLookAt")
//core.addApiFunctionByName("MatrixToFloatV")
core.addApiFunctionByName("QuaternionAdd")
core.addApiFunctionByName("QuaternionAddValue")
core.addApiFunctionByName("QuaternionSubtract")
core.addApiFunctionByName("QuaternionSubtractValue")
core.addApiFunctionByName("QuaternionIdentity")
core.addApiFunctionByName("QuaternionLength")
core.addApiFunctionByName("QuaternionNormalize")
core.addApiFunctionByName("QuaternionInvert")
core.addApiFunctionByName("QuaternionMultiply")
core.addApiFunctionByName("QuaternionScale")
core.addApiFunctionByName("QuaternionDivide")
core.addApiFunctionByName("QuaternionLerp")
core.addApiFunctionByName("QuaternionNlerp")
core.addApiFunctionByName("QuaternionSlerp")
core.addApiFunctionByName("QuaternionFromVector3ToVector3")
core.addApiFunctionByName("QuaternionFromMatrix")
core.addApiFunctionByName("QuaternionToMatrix")
core.addApiFunctionByName("QuaternionFromAxisAngle")
//core.addApiFunctionByName("QuaternionToAxisAngle")
core.addApiFunctionByName("QuaternionFromEuler")
core.addApiFunctionByName("QuaternionToEuler")
core.addApiFunctionByName("QuaternionTransform")
core.addApiFunctionByName("QuaternionEquals")
2023-05-14 20:19:47 +00:00
api.defines.filter(x => x.type === "COLOR").map(x => ({ name: x.name, description: x.description, values: (x.value.match(/\{([^}]+)\}/) || "")[1].split(',').map(x => x.trim()) })).forEach(x => {
core.exportGlobalStruct("Color", x.name, x.values, x.description)
2023-05-08 21:37:58 +00:00
})
2023-05-14 20:19:47 +00:00
api.enums.find(x => x.name === "KeyboardKey")?.values.forEach(x => core.exportGlobalConstant(x.name, x.description))
api.enums.find(x => x.name === "MouseButton")?.values.forEach(x => core.exportGlobalConstant(x.name, x.description))
api.enums.find(x => x.name === "ConfigFlags")?.values.forEach(x => core.exportGlobalConstant(x.name, x.description))
api.enums.find(x => x.name === "BlendMode")?.values.forEach(x => core.exportGlobalConstant(x.name, x.description))
api.enums.find(x => x.name === "TraceLogLevel")?.values.forEach(x => core.exportGlobalConstant(x.name, x.description))
api.enums.find(x => x.name === "MouseCursor")?.values.forEach(x => core.exportGlobalConstant(x.name, x.description))
api.enums.find(x => x.name === "PixelFormat")?.values.forEach(x => core.exportGlobalConstant(x.name, x.description))
api.enums.find(x => x.name === "CameraProjection")?.values.forEach(x => core.exportGlobalConstant(x.name, x.description))
2023-05-15 21:02:41 +00:00
api.enums.find(x => x.name === "CameraMode")?.values.forEach(x => core.exportGlobalConstant(x.name, x.description))
2023-05-16 06:28:30 +00:00
api.enums.find(x => x.name === "ShaderLocationIndex")?.values.forEach(x => core.exportGlobalConstant(x.name, x.description))
api.enums.find(x => x.name === "ShaderUniformDataType")?.values.forEach(x => core.exportGlobalConstant(x.name, x.description))
api.enums.find(x => x.name === "MaterialMapIndex")?.values.forEach(x => core.exportGlobalConstant(x.name, x.description))
core.exportGlobalConstant("MATERIAL_MAP_DIFFUSE", "Albedo material (same as: MATERIAL_MAP_DIFFUSE")
core.exportGlobalConstant("MATERIAL_MAP_SPECULAR", "Metalness material (same as: MATERIAL_MAP_SPECULAR)")
2023-05-14 20:19:47 +00:00
core.writeTo("src/bindings/js_raylib_core.h")
core.typings.writeTo("examples/lib.raylib.d.ts")
2023-05-06 21:43:40 +00:00
}
main()