|
|
@ -2036,7 +2036,7 @@ static JSValue js_initWindow(JSContext * ctx, JSValueConst this_val, int argc, J
|
|
|
|
JS_ToInt32(ctx, &width, argv[0]);
|
|
|
|
JS_ToInt32(ctx, &width, argv[0]);
|
|
|
|
int height;
|
|
|
|
int height;
|
|
|
|
JS_ToInt32(ctx, &height, argv[1]);
|
|
|
|
JS_ToInt32(ctx, &height, argv[1]);
|
|
|
|
const char * title = (const char *)JS_ToCString(ctx, argv[2]);
|
|
|
|
const char * title = JS_IsNull(argv[2]) ? NULL : (const char *)JS_ToCString(ctx, argv[2]);
|
|
|
|
InitWindow(width, height, title);
|
|
|
|
InitWindow(width, height, title);
|
|
|
|
JS_FreeCString(ctx, title);
|
|
|
|
JS_FreeCString(ctx, title);
|
|
|
|
return JS_UNDEFINED;
|
|
|
|
return JS_UNDEFINED;
|
|
|
@ -2146,7 +2146,7 @@ static JSValue js_setWindowIcon(JSContext * ctx, JSValueConst this_val, int argc
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_setWindowTitle(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_setWindowTitle(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * title = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * title = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
SetWindowTitle(title);
|
|
|
|
SetWindowTitle(title);
|
|
|
|
JS_FreeCString(ctx, title);
|
|
|
|
JS_FreeCString(ctx, title);
|
|
|
|
return JS_UNDEFINED;
|
|
|
|
return JS_UNDEFINED;
|
|
|
@ -2308,7 +2308,7 @@ static JSValue js_getMonitorName(JSContext * ctx, JSValueConst this_val, int arg
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_setClipboardText(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_setClipboardText(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * text = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
SetClipboardText(text);
|
|
|
|
SetClipboardText(text);
|
|
|
|
JS_FreeCString(ctx, text);
|
|
|
|
JS_FreeCString(ctx, text);
|
|
|
|
return JS_UNDEFINED;
|
|
|
|
return JS_UNDEFINED;
|
|
|
@ -2463,8 +2463,8 @@ static JSValue js_endScissorMode(JSContext * ctx, JSValueConst this_val, int arg
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_loadShader(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_loadShader(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * vsFileName = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * vsFileName = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * fsFileName = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * fsFileName = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
Shader returnVal = LoadShader(vsFileName, fsFileName);
|
|
|
|
Shader returnVal = LoadShader(vsFileName, fsFileName);
|
|
|
|
JS_FreeCString(ctx, vsFileName);
|
|
|
|
JS_FreeCString(ctx, vsFileName);
|
|
|
|
JS_FreeCString(ctx, fsFileName);
|
|
|
|
JS_FreeCString(ctx, fsFileName);
|
|
|
@ -2476,8 +2476,8 @@ static JSValue js_loadShader(JSContext * ctx, JSValueConst this_val, int argc, J
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_loadShaderFromMemory(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_loadShaderFromMemory(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * vsCode = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * vsCode = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * fsCode = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * fsCode = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
Shader returnVal = LoadShaderFromMemory(vsCode, fsCode);
|
|
|
|
Shader returnVal = LoadShaderFromMemory(vsCode, fsCode);
|
|
|
|
JS_FreeCString(ctx, vsCode);
|
|
|
|
JS_FreeCString(ctx, vsCode);
|
|
|
|
JS_FreeCString(ctx, fsCode);
|
|
|
|
JS_FreeCString(ctx, fsCode);
|
|
|
@ -2501,7 +2501,7 @@ static JSValue js_getShaderLocation(JSContext * ctx, JSValueConst this_val, int
|
|
|
|
Shader* shader_ptr = (Shader*)JS_GetOpaque2(ctx, argv[0], js_Shader_class_id);
|
|
|
|
Shader* shader_ptr = (Shader*)JS_GetOpaque2(ctx, argv[0], js_Shader_class_id);
|
|
|
|
if(shader_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(shader_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Shader shader = *shader_ptr;
|
|
|
|
Shader shader = *shader_ptr;
|
|
|
|
const char * uniformName = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * uniformName = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
int returnVal = GetShaderLocation(shader, uniformName);
|
|
|
|
int returnVal = GetShaderLocation(shader, uniformName);
|
|
|
|
JS_FreeCString(ctx, uniformName);
|
|
|
|
JS_FreeCString(ctx, uniformName);
|
|
|
|
JSValue ret = JS_NewInt32(ctx, returnVal);
|
|
|
|
JSValue ret = JS_NewInt32(ctx, returnVal);
|
|
|
@ -2512,7 +2512,7 @@ static JSValue js_getShaderLocationAttrib(JSContext * ctx, JSValueConst this_val
|
|
|
|
Shader* shader_ptr = (Shader*)JS_GetOpaque2(ctx, argv[0], js_Shader_class_id);
|
|
|
|
Shader* shader_ptr = (Shader*)JS_GetOpaque2(ctx, argv[0], js_Shader_class_id);
|
|
|
|
if(shader_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(shader_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Shader shader = *shader_ptr;
|
|
|
|
Shader shader = *shader_ptr;
|
|
|
|
const char * attribName = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * attribName = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
int returnVal = GetShaderLocationAttrib(shader, attribName);
|
|
|
|
int returnVal = GetShaderLocationAttrib(shader, attribName);
|
|
|
|
JS_FreeCString(ctx, attribName);
|
|
|
|
JS_FreeCString(ctx, attribName);
|
|
|
|
JSValue ret = JS_NewInt32(ctx, returnVal);
|
|
|
|
JSValue ret = JS_NewInt32(ctx, returnVal);
|
|
|
@ -2756,7 +2756,7 @@ static JSValue js_setRandomSeed(JSContext * ctx, JSValueConst this_val, int argc
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_takeScreenshot(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_takeScreenshot(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * fileName = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * fileName = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
TakeScreenshot(fileName);
|
|
|
|
TakeScreenshot(fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
return JS_UNDEFINED;
|
|
|
|
return JS_UNDEFINED;
|
|
|
@ -2772,7 +2772,7 @@ static JSValue js_setConfigFlags(JSContext * ctx, JSValueConst this_val, int arg
|
|
|
|
static JSValue js_traceLog(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_traceLog(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
int logLevel;
|
|
|
|
int logLevel;
|
|
|
|
JS_ToInt32(ctx, &logLevel, argv[0]);
|
|
|
|
JS_ToInt32(ctx, &logLevel, argv[0]);
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * text = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
TraceLog(logLevel, text);
|
|
|
|
TraceLog(logLevel, text);
|
|
|
|
JS_FreeCString(ctx, text);
|
|
|
|
JS_FreeCString(ctx, text);
|
|
|
|
return JS_UNDEFINED;
|
|
|
|
return JS_UNDEFINED;
|
|
|
@ -2786,14 +2786,14 @@ static JSValue js_setTraceLogLevel(JSContext * ctx, JSValueConst this_val, int a
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_openURL(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_openURL(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * url = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * url = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
OpenURL(url);
|
|
|
|
OpenURL(url);
|
|
|
|
JS_FreeCString(ctx, url);
|
|
|
|
JS_FreeCString(ctx, url);
|
|
|
|
return JS_UNDEFINED;
|
|
|
|
return JS_UNDEFINED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_loadFileData(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_loadFileData(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * fileName = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * fileName = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
unsigned int bytesRead;
|
|
|
|
unsigned int bytesRead;
|
|
|
|
unsigned char * retVal = LoadFileData(fileName, &bytesRead);
|
|
|
|
unsigned char * retVal = LoadFileData(fileName, &bytesRead);
|
|
|
|
JSValue buffer = JS_NewArrayBufferCopy(ctx, (const uint8_t*)retVal, bytesRead);
|
|
|
|
JSValue buffer = JS_NewArrayBufferCopy(ctx, (const uint8_t*)retVal, bytesRead);
|
|
|
@ -2802,7 +2802,7 @@ static JSValue js_loadFileData(JSContext * ctx, JSValueConst this_val, int argc,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_saveFileData(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_saveFileData(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * fileName = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * fileName = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
size_t data_size;
|
|
|
|
size_t data_size;
|
|
|
|
void * data_js = (void *)JS_GetArrayBuffer(ctx, &data_size, argv[1]);
|
|
|
|
void * data_js = (void *)JS_GetArrayBuffer(ctx, &data_size, argv[1]);
|
|
|
|
if(data_js == NULL) {
|
|
|
|
if(data_js == NULL) {
|
|
|
@ -2820,7 +2820,7 @@ static JSValue js_saveFileData(JSContext * ctx, JSValueConst this_val, int argc,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_loadFileText(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_loadFileText(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * fileName = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * fileName = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
char * returnVal = LoadFileText(fileName);
|
|
|
|
char * returnVal = LoadFileText(fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
JSValue ret = JS_NewString(ctx, returnVal);
|
|
|
|
JSValue ret = JS_NewString(ctx, returnVal);
|
|
|
@ -2829,8 +2829,8 @@ static JSValue js_loadFileText(JSContext * ctx, JSValueConst this_val, int argc,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_saveFileText(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_saveFileText(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * fileName = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * fileName = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
char * text = (char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
char * text = JS_IsNull(argv[1]) ? NULL : (char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
bool returnVal = SaveFileText(fileName, text);
|
|
|
|
bool returnVal = SaveFileText(fileName, text);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
JS_FreeCString(ctx, text);
|
|
|
|
JS_FreeCString(ctx, text);
|
|
|
@ -2839,7 +2839,7 @@ static JSValue js_saveFileText(JSContext * ctx, JSValueConst this_val, int argc,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_fileExists(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_fileExists(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * fileName = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * fileName = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
bool returnVal = FileExists(fileName);
|
|
|
|
bool returnVal = FileExists(fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
JSValue ret = JS_NewBool(ctx, returnVal);
|
|
|
|
JSValue ret = JS_NewBool(ctx, returnVal);
|
|
|
@ -2847,7 +2847,7 @@ static JSValue js_fileExists(JSContext * ctx, JSValueConst this_val, int argc, J
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_directoryExists(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_directoryExists(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * dirPath = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * dirPath = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
bool returnVal = DirectoryExists(dirPath);
|
|
|
|
bool returnVal = DirectoryExists(dirPath);
|
|
|
|
JS_FreeCString(ctx, dirPath);
|
|
|
|
JS_FreeCString(ctx, dirPath);
|
|
|
|
JSValue ret = JS_NewBool(ctx, returnVal);
|
|
|
|
JSValue ret = JS_NewBool(ctx, returnVal);
|
|
|
@ -2855,8 +2855,8 @@ static JSValue js_directoryExists(JSContext * ctx, JSValueConst this_val, int ar
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_isFileExtension(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_isFileExtension(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * fileName = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * fileName = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * ext = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * ext = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
bool returnVal = IsFileExtension(fileName, ext);
|
|
|
|
bool returnVal = IsFileExtension(fileName, ext);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
JS_FreeCString(ctx, ext);
|
|
|
|
JS_FreeCString(ctx, ext);
|
|
|
@ -2865,7 +2865,7 @@ static JSValue js_isFileExtension(JSContext * ctx, JSValueConst this_val, int ar
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_getFileLength(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_getFileLength(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * fileName = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * fileName = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
int returnVal = GetFileLength(fileName);
|
|
|
|
int returnVal = GetFileLength(fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
JSValue ret = JS_NewInt32(ctx, returnVal);
|
|
|
|
JSValue ret = JS_NewInt32(ctx, returnVal);
|
|
|
@ -2873,7 +2873,7 @@ static JSValue js_getFileLength(JSContext * ctx, JSValueConst this_val, int argc
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_getFileExtension(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_getFileExtension(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * fileName = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * fileName = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * returnVal = GetFileExtension(fileName);
|
|
|
|
const char * returnVal = GetFileExtension(fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
JSValue ret = JS_NewString(ctx, returnVal);
|
|
|
|
JSValue ret = JS_NewString(ctx, returnVal);
|
|
|
@ -2881,7 +2881,7 @@ static JSValue js_getFileExtension(JSContext * ctx, JSValueConst this_val, int a
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_getFileName(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_getFileName(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * filePath = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * filePath = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * returnVal = GetFileName(filePath);
|
|
|
|
const char * returnVal = GetFileName(filePath);
|
|
|
|
JS_FreeCString(ctx, filePath);
|
|
|
|
JS_FreeCString(ctx, filePath);
|
|
|
|
JSValue ret = JS_NewString(ctx, returnVal);
|
|
|
|
JSValue ret = JS_NewString(ctx, returnVal);
|
|
|
@ -2889,7 +2889,7 @@ static JSValue js_getFileName(JSContext * ctx, JSValueConst this_val, int argc,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_getFileNameWithoutExt(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_getFileNameWithoutExt(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * filePath = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * filePath = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * returnVal = GetFileNameWithoutExt(filePath);
|
|
|
|
const char * returnVal = GetFileNameWithoutExt(filePath);
|
|
|
|
JS_FreeCString(ctx, filePath);
|
|
|
|
JS_FreeCString(ctx, filePath);
|
|
|
|
JSValue ret = JS_NewString(ctx, returnVal);
|
|
|
|
JSValue ret = JS_NewString(ctx, returnVal);
|
|
|
@ -2897,7 +2897,7 @@ static JSValue js_getFileNameWithoutExt(JSContext * ctx, JSValueConst this_val,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_getDirectoryPath(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_getDirectoryPath(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * filePath = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * filePath = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * returnVal = GetDirectoryPath(filePath);
|
|
|
|
const char * returnVal = GetDirectoryPath(filePath);
|
|
|
|
JS_FreeCString(ctx, filePath);
|
|
|
|
JS_FreeCString(ctx, filePath);
|
|
|
|
JSValue ret = JS_NewString(ctx, returnVal);
|
|
|
|
JSValue ret = JS_NewString(ctx, returnVal);
|
|
|
@ -2905,7 +2905,7 @@ static JSValue js_getDirectoryPath(JSContext * ctx, JSValueConst this_val, int a
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_getPrevDirectoryPath(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_getPrevDirectoryPath(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * dirPath = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * dirPath = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * returnVal = GetPrevDirectoryPath(dirPath);
|
|
|
|
const char * returnVal = GetPrevDirectoryPath(dirPath);
|
|
|
|
JS_FreeCString(ctx, dirPath);
|
|
|
|
JS_FreeCString(ctx, dirPath);
|
|
|
|
JSValue ret = JS_NewString(ctx, returnVal);
|
|
|
|
JSValue ret = JS_NewString(ctx, returnVal);
|
|
|
@ -2925,7 +2925,7 @@ static JSValue js_getApplicationDirectory(JSContext * ctx, JSValueConst this_val
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_changeDirectory(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_changeDirectory(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * dir = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * dir = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
bool returnVal = ChangeDirectory(dir);
|
|
|
|
bool returnVal = ChangeDirectory(dir);
|
|
|
|
JS_FreeCString(ctx, dir);
|
|
|
|
JS_FreeCString(ctx, dir);
|
|
|
|
JSValue ret = JS_NewBool(ctx, returnVal);
|
|
|
|
JSValue ret = JS_NewBool(ctx, returnVal);
|
|
|
@ -2933,7 +2933,7 @@ static JSValue js_changeDirectory(JSContext * ctx, JSValueConst this_val, int ar
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_isPathFile(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_isPathFile(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * path = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * path = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
bool returnVal = IsPathFile(path);
|
|
|
|
bool returnVal = IsPathFile(path);
|
|
|
|
JS_FreeCString(ctx, path);
|
|
|
|
JS_FreeCString(ctx, path);
|
|
|
|
JSValue ret = JS_NewBool(ctx, returnVal);
|
|
|
|
JSValue ret = JS_NewBool(ctx, returnVal);
|
|
|
@ -2941,7 +2941,7 @@ static JSValue js_isPathFile(JSContext * ctx, JSValueConst this_val, int argc, J
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_loadDirectoryFiles(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_loadDirectoryFiles(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * dirPath = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * dirPath = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
FilePathList files = LoadDirectoryFiles(dirPath);
|
|
|
|
FilePathList files = LoadDirectoryFiles(dirPath);
|
|
|
|
JSValue ret = JS_NewArray(ctx);
|
|
|
|
JSValue ret = JS_NewArray(ctx);
|
|
|
|
for(int i; i < files.count; i++){
|
|
|
|
for(int i; i < files.count; i++){
|
|
|
@ -2953,8 +2953,8 @@ static JSValue js_loadDirectoryFiles(JSContext * ctx, JSValueConst this_val, int
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_loadDirectoryFilesEx(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_loadDirectoryFilesEx(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * basePath = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * basePath = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * filter = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * filter = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
bool scanSubdirs = JS_ToBool(ctx, argv[2]);
|
|
|
|
bool scanSubdirs = JS_ToBool(ctx, argv[2]);
|
|
|
|
FilePathList files = LoadDirectoryFilesEx(basePath, filter, scanSubdirs);
|
|
|
|
FilePathList files = LoadDirectoryFilesEx(basePath, filter, scanSubdirs);
|
|
|
|
JSValue ret = JS_NewArray(ctx);
|
|
|
|
JSValue ret = JS_NewArray(ctx);
|
|
|
@ -2984,7 +2984,7 @@ static JSValue js_loadDroppedFiles(JSContext * ctx, JSValueConst this_val, int a
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_getFileModTime(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_getFileModTime(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * fileName = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * fileName = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
long returnVal = GetFileModTime(fileName);
|
|
|
|
long returnVal = GetFileModTime(fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
JSValue ret = JS_NewInt32(ctx, returnVal);
|
|
|
|
JSValue ret = JS_NewInt32(ctx, returnVal);
|
|
|
@ -3123,7 +3123,7 @@ static JSValue js_getGamepadAxisMovement(JSContext * ctx, JSValueConst this_val,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_setGamepadMappings(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_setGamepadMappings(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * mappings = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * mappings = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
int returnVal = SetGamepadMappings(mappings);
|
|
|
|
int returnVal = SetGamepadMappings(mappings);
|
|
|
|
JS_FreeCString(ctx, mappings);
|
|
|
|
JS_FreeCString(ctx, mappings);
|
|
|
|
JSValue ret = JS_NewInt32(ctx, returnVal);
|
|
|
|
JSValue ret = JS_NewInt32(ctx, returnVal);
|
|
|
@ -4093,7 +4093,7 @@ static JSValue js_getCollisionRec(JSContext * ctx, JSValueConst this_val, int ar
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_loadImage(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_loadImage(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * fileName = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * fileName = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
Image returnVal = LoadImage(fileName);
|
|
|
|
Image returnVal = LoadImage(fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
Image* ret_ptr = (Image*)js_malloc(ctx, sizeof(Image));
|
|
|
|
Image* ret_ptr = (Image*)js_malloc(ctx, sizeof(Image));
|
|
|
@ -4104,7 +4104,7 @@ static JSValue js_loadImage(JSContext * ctx, JSValueConst this_val, int argc, JS
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_loadImageRaw(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_loadImageRaw(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * fileName = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * fileName = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
int width;
|
|
|
|
int width;
|
|
|
|
JS_ToInt32(ctx, &width, argv[1]);
|
|
|
|
JS_ToInt32(ctx, &width, argv[1]);
|
|
|
|
int height;
|
|
|
|
int height;
|
|
|
@ -4123,7 +4123,7 @@ static JSValue js_loadImageRaw(JSContext * ctx, JSValueConst this_val, int argc,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_loadImageFromMemory(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_loadImageFromMemory(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * fileType = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * fileType = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
size_t fileData_size;
|
|
|
|
size_t fileData_size;
|
|
|
|
void * fileData_js = (void *)JS_GetArrayBuffer(ctx, &fileData_size, argv[1]);
|
|
|
|
void * fileData_js = (void *)JS_GetArrayBuffer(ctx, &fileData_size, argv[1]);
|
|
|
|
if(fileData_js == NULL) {
|
|
|
|
if(fileData_js == NULL) {
|
|
|
@ -4185,7 +4185,7 @@ static JSValue js_exportImage(JSContext * ctx, JSValueConst this_val, int argc,
|
|
|
|
Image* image_ptr = (Image*)JS_GetOpaque2(ctx, argv[0], js_Image_class_id);
|
|
|
|
Image* image_ptr = (Image*)JS_GetOpaque2(ctx, argv[0], js_Image_class_id);
|
|
|
|
if(image_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(image_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Image image = *image_ptr;
|
|
|
|
Image image = *image_ptr;
|
|
|
|
const char * fileName = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * fileName = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
bool returnVal = ExportImage(image, fileName);
|
|
|
|
bool returnVal = ExportImage(image, fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
JSValue ret = JS_NewBool(ctx, returnVal);
|
|
|
|
JSValue ret = JS_NewBool(ctx, returnVal);
|
|
|
@ -4347,7 +4347,7 @@ static JSValue js_genImageText(JSContext * ctx, JSValueConst this_val, int argc,
|
|
|
|
JS_ToInt32(ctx, &width, argv[0]);
|
|
|
|
JS_ToInt32(ctx, &width, argv[0]);
|
|
|
|
int height;
|
|
|
|
int height;
|
|
|
|
JS_ToInt32(ctx, &height, argv[1]);
|
|
|
|
JS_ToInt32(ctx, &height, argv[1]);
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[2]);
|
|
|
|
const char * text = JS_IsNull(argv[2]) ? NULL : (const char *)JS_ToCString(ctx, argv[2]);
|
|
|
|
Image returnVal = GenImageText(width, height, text);
|
|
|
|
Image returnVal = GenImageText(width, height, text);
|
|
|
|
JS_FreeCString(ctx, text);
|
|
|
|
JS_FreeCString(ctx, text);
|
|
|
|
Image* ret_ptr = (Image*)js_malloc(ctx, sizeof(Image));
|
|
|
|
Image* ret_ptr = (Image*)js_malloc(ctx, sizeof(Image));
|
|
|
@ -4385,7 +4385,7 @@ static JSValue js_imageFromImage(JSContext * ctx, JSValueConst this_val, int arg
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_imageText(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_imageText(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * text = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
int fontSize;
|
|
|
|
int fontSize;
|
|
|
|
JS_ToInt32(ctx, &fontSize, argv[1]);
|
|
|
|
JS_ToInt32(ctx, &fontSize, argv[1]);
|
|
|
|
Color* color_ptr = (Color*)JS_GetOpaque2(ctx, argv[2], js_Color_class_id);
|
|
|
|
Color* color_ptr = (Color*)JS_GetOpaque2(ctx, argv[2], js_Color_class_id);
|
|
|
@ -4404,7 +4404,7 @@ static JSValue js_imageTextEx(JSContext * ctx, JSValueConst this_val, int argc,
|
|
|
|
Font* font_ptr = (Font*)JS_GetOpaque2(ctx, argv[0], js_Font_class_id);
|
|
|
|
Font* font_ptr = (Font*)JS_GetOpaque2(ctx, argv[0], js_Font_class_id);
|
|
|
|
if(font_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(font_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Font font = *font_ptr;
|
|
|
|
Font font = *font_ptr;
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * text = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
double _double_fontSize;
|
|
|
|
double _double_fontSize;
|
|
|
|
JS_ToFloat64(ctx, &_double_fontSize, argv[2]);
|
|
|
|
JS_ToFloat64(ctx, &_double_fontSize, argv[2]);
|
|
|
|
float fontSize = (float)_double_fontSize;
|
|
|
|
float fontSize = (float)_double_fontSize;
|
|
|
@ -4905,7 +4905,7 @@ static JSValue js_imageDraw(JSContext * ctx, JSValueConst this_val, int argc, JS
|
|
|
|
static JSValue js_imageDrawText(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_imageDrawText(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
Image* dst = (Image*)JS_GetOpaque2(ctx, argv[0], js_Image_class_id);
|
|
|
|
Image* dst = (Image*)JS_GetOpaque2(ctx, argv[0], js_Image_class_id);
|
|
|
|
if(dst == NULL) return JS_EXCEPTION;
|
|
|
|
if(dst == NULL) return JS_EXCEPTION;
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * text = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
int posX;
|
|
|
|
int posX;
|
|
|
|
JS_ToInt32(ctx, &posX, argv[2]);
|
|
|
|
JS_ToInt32(ctx, &posX, argv[2]);
|
|
|
|
int posY;
|
|
|
|
int posY;
|
|
|
@ -4926,7 +4926,7 @@ static JSValue js_imageDrawTextEx(JSContext * ctx, JSValueConst this_val, int ar
|
|
|
|
Font* font_ptr = (Font*)JS_GetOpaque2(ctx, argv[1], js_Font_class_id);
|
|
|
|
Font* font_ptr = (Font*)JS_GetOpaque2(ctx, argv[1], js_Font_class_id);
|
|
|
|
if(font_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(font_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Font font = *font_ptr;
|
|
|
|
Font font = *font_ptr;
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[2]);
|
|
|
|
const char * text = JS_IsNull(argv[2]) ? NULL : (const char *)JS_ToCString(ctx, argv[2]);
|
|
|
|
Vector2* position_ptr = (Vector2*)JS_GetOpaque2(ctx, argv[3], js_Vector2_class_id);
|
|
|
|
Vector2* position_ptr = (Vector2*)JS_GetOpaque2(ctx, argv[3], js_Vector2_class_id);
|
|
|
|
if(position_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(position_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Vector2 position = *position_ptr;
|
|
|
|
Vector2 position = *position_ptr;
|
|
|
@ -4945,7 +4945,7 @@ static JSValue js_imageDrawTextEx(JSContext * ctx, JSValueConst this_val, int ar
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_loadTexture(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_loadTexture(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * fileName = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * fileName = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
Texture2D returnVal = LoadTexture(fileName);
|
|
|
|
Texture2D returnVal = LoadTexture(fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
Texture2D* ret_ptr = (Texture2D*)js_malloc(ctx, sizeof(Texture2D));
|
|
|
|
Texture2D* ret_ptr = (Texture2D*)js_malloc(ctx, sizeof(Texture2D));
|
|
|
@ -5391,7 +5391,7 @@ static JSValue js_getFontDefault(JSContext * ctx, JSValueConst this_val, int arg
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_loadFont(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_loadFont(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * fileName = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * fileName = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
Font returnVal = LoadFont(fileName);
|
|
|
|
Font returnVal = LoadFont(fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
Font* ret_ptr = (Font*)js_malloc(ctx, sizeof(Font));
|
|
|
|
Font* ret_ptr = (Font*)js_malloc(ctx, sizeof(Font));
|
|
|
@ -5402,7 +5402,7 @@ static JSValue js_loadFont(JSContext * ctx, JSValueConst this_val, int argc, JSV
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_loadFontEx(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_loadFontEx(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * fileName = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * fileName = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
int fontSize;
|
|
|
|
int fontSize;
|
|
|
|
JS_ToInt32(ctx, &fontSize, argv[1]);
|
|
|
|
JS_ToInt32(ctx, &fontSize, argv[1]);
|
|
|
|
Font returnVal = LoadFontEx(fileName, fontSize, NULL, 0);
|
|
|
|
Font returnVal = LoadFontEx(fileName, fontSize, NULL, 0);
|
|
|
@ -5458,7 +5458,7 @@ static JSValue js_drawFPS(JSContext * ctx, JSValueConst this_val, int argc, JSVa
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_drawText(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_drawText(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * text = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
int posX;
|
|
|
|
int posX;
|
|
|
|
JS_ToInt32(ctx, &posX, argv[1]);
|
|
|
|
JS_ToInt32(ctx, &posX, argv[1]);
|
|
|
|
int posY;
|
|
|
|
int posY;
|
|
|
@ -5477,7 +5477,7 @@ static JSValue js_drawTextEx(JSContext * ctx, JSValueConst this_val, int argc, J
|
|
|
|
Font* font_ptr = (Font*)JS_GetOpaque2(ctx, argv[0], js_Font_class_id);
|
|
|
|
Font* font_ptr = (Font*)JS_GetOpaque2(ctx, argv[0], js_Font_class_id);
|
|
|
|
if(font_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(font_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Font font = *font_ptr;
|
|
|
|
Font font = *font_ptr;
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * text = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
Vector2* position_ptr = (Vector2*)JS_GetOpaque2(ctx, argv[2], js_Vector2_class_id);
|
|
|
|
Vector2* position_ptr = (Vector2*)JS_GetOpaque2(ctx, argv[2], js_Vector2_class_id);
|
|
|
|
if(position_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(position_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Vector2 position = *position_ptr;
|
|
|
|
Vector2 position = *position_ptr;
|
|
|
@ -5499,7 +5499,7 @@ static JSValue js_drawTextPro(JSContext * ctx, JSValueConst this_val, int argc,
|
|
|
|
Font* font_ptr = (Font*)JS_GetOpaque2(ctx, argv[0], js_Font_class_id);
|
|
|
|
Font* font_ptr = (Font*)JS_GetOpaque2(ctx, argv[0], js_Font_class_id);
|
|
|
|
if(font_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(font_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Font font = *font_ptr;
|
|
|
|
Font font = *font_ptr;
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * text = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
Vector2* position_ptr = (Vector2*)JS_GetOpaque2(ctx, argv[2], js_Vector2_class_id);
|
|
|
|
Vector2* position_ptr = (Vector2*)JS_GetOpaque2(ctx, argv[2], js_Vector2_class_id);
|
|
|
|
if(position_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(position_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Vector2 position = *position_ptr;
|
|
|
|
Vector2 position = *position_ptr;
|
|
|
@ -5543,7 +5543,7 @@ static JSValue js_drawTextCodepoint(JSContext * ctx, JSValueConst this_val, int
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_measureText(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_measureText(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * text = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
int fontSize;
|
|
|
|
int fontSize;
|
|
|
|
JS_ToInt32(ctx, &fontSize, argv[1]);
|
|
|
|
JS_ToInt32(ctx, &fontSize, argv[1]);
|
|
|
|
int returnVal = MeasureText(text, fontSize);
|
|
|
|
int returnVal = MeasureText(text, fontSize);
|
|
|
@ -5556,7 +5556,7 @@ static JSValue js_measureTextEx(JSContext * ctx, JSValueConst this_val, int argc
|
|
|
|
Font* font_ptr = (Font*)JS_GetOpaque2(ctx, argv[0], js_Font_class_id);
|
|
|
|
Font* font_ptr = (Font*)JS_GetOpaque2(ctx, argv[0], js_Font_class_id);
|
|
|
|
if(font_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(font_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Font font = *font_ptr;
|
|
|
|
Font font = *font_ptr;
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * text = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
double _double_fontSize;
|
|
|
|
double _double_fontSize;
|
|
|
|
JS_ToFloat64(ctx, &_double_fontSize, argv[2]);
|
|
|
|
JS_ToFloat64(ctx, &_double_fontSize, argv[2]);
|
|
|
|
float fontSize = (float)_double_fontSize;
|
|
|
|
float fontSize = (float)_double_fontSize;
|
|
|
@ -5943,7 +5943,7 @@ static JSValue js_drawGrid(JSContext * ctx, JSValueConst this_val, int argc, JSV
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_loadModel(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_loadModel(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * fileName = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * fileName = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
Model returnVal = LoadModel(fileName);
|
|
|
|
Model returnVal = LoadModel(fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
Model* ret_ptr = (Model*)js_malloc(ctx, sizeof(Model));
|
|
|
|
Model* ret_ptr = (Model*)js_malloc(ctx, sizeof(Model));
|
|
|
@ -6231,7 +6231,7 @@ static JSValue js_exportMesh(JSContext * ctx, JSValueConst this_val, int argc, J
|
|
|
|
Mesh* mesh_ptr = (Mesh*)JS_GetOpaque2(ctx, argv[0], js_Mesh_class_id);
|
|
|
|
Mesh* mesh_ptr = (Mesh*)JS_GetOpaque2(ctx, argv[0], js_Mesh_class_id);
|
|
|
|
if(mesh_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(mesh_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Mesh mesh = *mesh_ptr;
|
|
|
|
Mesh mesh = *mesh_ptr;
|
|
|
|
const char * fileName = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * fileName = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
bool returnVal = ExportMesh(mesh, fileName);
|
|
|
|
bool returnVal = ExportMesh(mesh, fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
JSValue ret = JS_NewBool(ctx, returnVal);
|
|
|
|
JSValue ret = JS_NewBool(ctx, returnVal);
|
|
|
@ -6657,7 +6657,7 @@ static JSValue js_setMasterVolume(JSContext * ctx, JSValueConst this_val, int ar
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_loadWave(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_loadWave(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * fileName = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * fileName = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
Wave returnVal = LoadWave(fileName);
|
|
|
|
Wave returnVal = LoadWave(fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
Wave* ret_ptr = (Wave*)js_malloc(ctx, sizeof(Wave));
|
|
|
|
Wave* ret_ptr = (Wave*)js_malloc(ctx, sizeof(Wave));
|
|
|
@ -6668,7 +6668,7 @@ static JSValue js_loadWave(JSContext * ctx, JSValueConst this_val, int argc, JSV
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_loadWaveFromMemory(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_loadWaveFromMemory(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * fileType = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * fileType = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
size_t fileData_size;
|
|
|
|
size_t fileData_size;
|
|
|
|
void * fileData_js = (void *)JS_GetArrayBuffer(ctx, &fileData_size, argv[1]);
|
|
|
|
void * fileData_js = (void *)JS_GetArrayBuffer(ctx, &fileData_size, argv[1]);
|
|
|
|
if(fileData_js == NULL) {
|
|
|
|
if(fileData_js == NULL) {
|
|
|
@ -6698,7 +6698,7 @@ static JSValue js_isWaveReady(JSContext * ctx, JSValueConst this_val, int argc,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_loadSound(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_loadSound(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * fileName = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * fileName = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
Sound returnVal = LoadSound(fileName);
|
|
|
|
Sound returnVal = LoadSound(fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
Sound* ret_ptr = (Sound*)js_malloc(ctx, sizeof(Sound));
|
|
|
|
Sound* ret_ptr = (Sound*)js_malloc(ctx, sizeof(Sound));
|
|
|
@ -6767,7 +6767,7 @@ static JSValue js_exportWave(JSContext * ctx, JSValueConst this_val, int argc, J
|
|
|
|
Wave* wave_ptr = (Wave*)JS_GetOpaque2(ctx, argv[0], js_Wave_class_id);
|
|
|
|
Wave* wave_ptr = (Wave*)JS_GetOpaque2(ctx, argv[0], js_Wave_class_id);
|
|
|
|
if(wave_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(wave_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Wave wave = *wave_ptr;
|
|
|
|
Wave wave = *wave_ptr;
|
|
|
|
const char * fileName = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * fileName = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
bool returnVal = ExportWave(wave, fileName);
|
|
|
|
bool returnVal = ExportWave(wave, fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
JSValue ret = JS_NewBool(ctx, returnVal);
|
|
|
|
JSValue ret = JS_NewBool(ctx, returnVal);
|
|
|
@ -6885,7 +6885,7 @@ static JSValue js_waveFormat(JSContext * ctx, JSValueConst this_val, int argc, J
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_loadMusicStream(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_loadMusicStream(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * fileName = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * fileName = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
Music returnVal = LoadMusicStream(fileName);
|
|
|
|
Music returnVal = LoadMusicStream(fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
Music* ret_ptr = (Music*)js_malloc(ctx, sizeof(Music));
|
|
|
|
Music* ret_ptr = (Music*)js_malloc(ctx, sizeof(Music));
|
|
|
@ -8769,7 +8769,7 @@ static JSValue js_guiWindowBox(JSContext * ctx, JSValueConst this_val, int argc,
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
const char * title = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * title = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
bool returnVal = GuiWindowBox(bounds, title);
|
|
|
|
bool returnVal = GuiWindowBox(bounds, title);
|
|
|
|
JS_FreeCString(ctx, title);
|
|
|
|
JS_FreeCString(ctx, title);
|
|
|
|
JSValue ret = JS_NewBool(ctx, returnVal);
|
|
|
|
JSValue ret = JS_NewBool(ctx, returnVal);
|
|
|
@ -8780,7 +8780,7 @@ static JSValue js_guiGroupBox(JSContext * ctx, JSValueConst this_val, int argc,
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * text = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
GuiGroupBox(bounds, text);
|
|
|
|
GuiGroupBox(bounds, text);
|
|
|
|
JS_FreeCString(ctx, text);
|
|
|
|
JS_FreeCString(ctx, text);
|
|
|
|
return JS_UNDEFINED;
|
|
|
|
return JS_UNDEFINED;
|
|
|
@ -8790,7 +8790,7 @@ static JSValue js_guiLine(JSContext * ctx, JSValueConst this_val, int argc, JSVa
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * text = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
GuiLine(bounds, text);
|
|
|
|
GuiLine(bounds, text);
|
|
|
|
JS_FreeCString(ctx, text);
|
|
|
|
JS_FreeCString(ctx, text);
|
|
|
|
return JS_UNDEFINED;
|
|
|
|
return JS_UNDEFINED;
|
|
|
@ -8800,7 +8800,7 @@ static JSValue js_guiPanel(JSContext * ctx, JSValueConst this_val, int argc, JSV
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * text = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
GuiPanel(bounds, text);
|
|
|
|
GuiPanel(bounds, text);
|
|
|
|
JS_FreeCString(ctx, text);
|
|
|
|
JS_FreeCString(ctx, text);
|
|
|
|
return JS_UNDEFINED;
|
|
|
|
return JS_UNDEFINED;
|
|
|
@ -8810,7 +8810,7 @@ static JSValue js_guiScrollPanel(JSContext * ctx, JSValueConst this_val, int arg
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * text = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
Rectangle* content_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[2], js_Rectangle_class_id);
|
|
|
|
Rectangle* content_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[2], js_Rectangle_class_id);
|
|
|
|
if(content_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(content_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Rectangle content = *content_ptr;
|
|
|
|
Rectangle content = *content_ptr;
|
|
|
@ -8829,7 +8829,7 @@ static JSValue js_guiLabel(JSContext * ctx, JSValueConst this_val, int argc, JSV
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * text = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
GuiLabel(bounds, text);
|
|
|
|
GuiLabel(bounds, text);
|
|
|
|
JS_FreeCString(ctx, text);
|
|
|
|
JS_FreeCString(ctx, text);
|
|
|
|
return JS_UNDEFINED;
|
|
|
|
return JS_UNDEFINED;
|
|
|
@ -8839,7 +8839,7 @@ static JSValue js_guiButton(JSContext * ctx, JSValueConst this_val, int argc, JS
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * text = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
bool returnVal = GuiButton(bounds, text);
|
|
|
|
bool returnVal = GuiButton(bounds, text);
|
|
|
|
JS_FreeCString(ctx, text);
|
|
|
|
JS_FreeCString(ctx, text);
|
|
|
|
JSValue ret = JS_NewBool(ctx, returnVal);
|
|
|
|
JSValue ret = JS_NewBool(ctx, returnVal);
|
|
|
@ -8850,7 +8850,7 @@ static JSValue js_guiLabelButton(JSContext * ctx, JSValueConst this_val, int arg
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * text = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
bool returnVal = GuiLabelButton(bounds, text);
|
|
|
|
bool returnVal = GuiLabelButton(bounds, text);
|
|
|
|
JS_FreeCString(ctx, text);
|
|
|
|
JS_FreeCString(ctx, text);
|
|
|
|
JSValue ret = JS_NewBool(ctx, returnVal);
|
|
|
|
JSValue ret = JS_NewBool(ctx, returnVal);
|
|
|
@ -8861,7 +8861,7 @@ static JSValue js_guiToggle(JSContext * ctx, JSValueConst this_val, int argc, JS
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * text = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
bool active = JS_ToBool(ctx, argv[2]);
|
|
|
|
bool active = JS_ToBool(ctx, argv[2]);
|
|
|
|
bool returnVal = GuiToggle(bounds, text, active);
|
|
|
|
bool returnVal = GuiToggle(bounds, text, active);
|
|
|
|
JS_FreeCString(ctx, text);
|
|
|
|
JS_FreeCString(ctx, text);
|
|
|
@ -8873,7 +8873,7 @@ static JSValue js_guiToggleGroup(JSContext * ctx, JSValueConst this_val, int arg
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * text = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
int active;
|
|
|
|
int active;
|
|
|
|
JS_ToInt32(ctx, &active, argv[2]);
|
|
|
|
JS_ToInt32(ctx, &active, argv[2]);
|
|
|
|
int returnVal = GuiToggleGroup(bounds, text, active);
|
|
|
|
int returnVal = GuiToggleGroup(bounds, text, active);
|
|
|
@ -8886,7 +8886,7 @@ static JSValue js_guiCheckBox(JSContext * ctx, JSValueConst this_val, int argc,
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * text = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
bool checked = JS_ToBool(ctx, argv[2]);
|
|
|
|
bool checked = JS_ToBool(ctx, argv[2]);
|
|
|
|
bool returnVal = GuiCheckBox(bounds, text, checked);
|
|
|
|
bool returnVal = GuiCheckBox(bounds, text, checked);
|
|
|
|
JS_FreeCString(ctx, text);
|
|
|
|
JS_FreeCString(ctx, text);
|
|
|
@ -8898,7 +8898,7 @@ static JSValue js_guiComboBox(JSContext * ctx, JSValueConst this_val, int argc,
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * text = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
int active;
|
|
|
|
int active;
|
|
|
|
JS_ToInt32(ctx, &active, argv[2]);
|
|
|
|
JS_ToInt32(ctx, &active, argv[2]);
|
|
|
|
int returnVal = GuiComboBox(bounds, text, active);
|
|
|
|
int returnVal = GuiComboBox(bounds, text, active);
|
|
|
@ -8911,9 +8911,11 @@ static JSValue js_guiDropdownBox(JSContext * ctx, JSValueConst this_val, int arg
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * text = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
int active_out;
|
|
|
|
int active_out;
|
|
|
|
int * active = &active_out;
|
|
|
|
int * active = &active_out;
|
|
|
|
|
|
|
|
JSValue active_js = JS_GetPropertyStr(ctx, argv[2], "active");
|
|
|
|
|
|
|
|
JS_ToInt32(ctx, active, active_js);
|
|
|
|
bool editMode = JS_ToBool(ctx, argv[3]);
|
|
|
|
bool editMode = JS_ToBool(ctx, argv[3]);
|
|
|
|
bool returnVal = GuiDropdownBox(bounds, text, active, editMode);
|
|
|
|
bool returnVal = GuiDropdownBox(bounds, text, active, editMode);
|
|
|
|
JS_FreeCString(ctx, text);
|
|
|
|
JS_FreeCString(ctx, text);
|
|
|
@ -8926,9 +8928,11 @@ static JSValue js_guiSpinner(JSContext * ctx, JSValueConst this_val, int argc, J
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * text = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
int value_out;
|
|
|
|
int value_out;
|
|
|
|
int * value = &value_out;
|
|
|
|
int * value = &value_out;
|
|
|
|
|
|
|
|
JSValue value_js = JS_GetPropertyStr(ctx, argv[2], "value");
|
|
|
|
|
|
|
|
JS_ToInt32(ctx, value, value_js);
|
|
|
|
int minValue;
|
|
|
|
int minValue;
|
|
|
|
JS_ToInt32(ctx, &minValue, argv[3]);
|
|
|
|
JS_ToInt32(ctx, &minValue, argv[3]);
|
|
|
|
int maxValue;
|
|
|
|
int maxValue;
|
|
|
@ -8945,9 +8949,11 @@ static JSValue js_guiValueBox(JSContext * ctx, JSValueConst this_val, int argc,
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * text = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
int value_out;
|
|
|
|
int value_out;
|
|
|
|
int * value = &value_out;
|
|
|
|
int * value = &value_out;
|
|
|
|
|
|
|
|
JSValue value_js = JS_GetPropertyStr(ctx, argv[2], "value");
|
|
|
|
|
|
|
|
JS_ToInt32(ctx, value, value_js);
|
|
|
|
int minValue;
|
|
|
|
int minValue;
|
|
|
|
JS_ToInt32(ctx, &minValue, argv[3]);
|
|
|
|
JS_ToInt32(ctx, &minValue, argv[3]);
|
|
|
|
int maxValue;
|
|
|
|
int maxValue;
|
|
|
@ -8964,8 +8970,8 @@ static JSValue js_guiSlider(JSContext * ctx, JSValueConst this_val, int argc, JS
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
const char * textLeft = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * textLeft = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * textRight = (const char *)JS_ToCString(ctx, argv[2]);
|
|
|
|
const char * textRight = JS_IsNull(argv[2]) ? NULL : (const char *)JS_ToCString(ctx, argv[2]);
|
|
|
|
double _double_value;
|
|
|
|
double _double_value;
|
|
|
|
JS_ToFloat64(ctx, &_double_value, argv[3]);
|
|
|
|
JS_ToFloat64(ctx, &_double_value, argv[3]);
|
|
|
|
float value = (float)_double_value;
|
|
|
|
float value = (float)_double_value;
|
|
|
@ -8986,8 +8992,8 @@ static JSValue js_guiSliderBar(JSContext * ctx, JSValueConst this_val, int argc,
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
const char * textLeft = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * textLeft = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * textRight = (const char *)JS_ToCString(ctx, argv[2]);
|
|
|
|
const char * textRight = JS_IsNull(argv[2]) ? NULL : (const char *)JS_ToCString(ctx, argv[2]);
|
|
|
|
double _double_value;
|
|
|
|
double _double_value;
|
|
|
|
JS_ToFloat64(ctx, &_double_value, argv[3]);
|
|
|
|
JS_ToFloat64(ctx, &_double_value, argv[3]);
|
|
|
|
float value = (float)_double_value;
|
|
|
|
float value = (float)_double_value;
|
|
|
@ -9008,8 +9014,8 @@ static JSValue js_guiProgressBar(JSContext * ctx, JSValueConst this_val, int arg
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
const char * textLeft = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * textLeft = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * textRight = (const char *)JS_ToCString(ctx, argv[2]);
|
|
|
|
const char * textRight = JS_IsNull(argv[2]) ? NULL : (const char *)JS_ToCString(ctx, argv[2]);
|
|
|
|
double _double_value;
|
|
|
|
double _double_value;
|
|
|
|
JS_ToFloat64(ctx, &_double_value, argv[3]);
|
|
|
|
JS_ToFloat64(ctx, &_double_value, argv[3]);
|
|
|
|
float value = (float)_double_value;
|
|
|
|
float value = (float)_double_value;
|
|
|
@ -9030,7 +9036,7 @@ static JSValue js_guiStatusBar(JSContext * ctx, JSValueConst this_val, int argc,
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * text = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
GuiStatusBar(bounds, text);
|
|
|
|
GuiStatusBar(bounds, text);
|
|
|
|
JS_FreeCString(ctx, text);
|
|
|
|
JS_FreeCString(ctx, text);
|
|
|
|
return JS_UNDEFINED;
|
|
|
|
return JS_UNDEFINED;
|
|
|
@ -9040,7 +9046,7 @@ static JSValue js_guiDummyRec(JSContext * ctx, JSValueConst this_val, int argc,
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * text = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
GuiDummyRec(bounds, text);
|
|
|
|
GuiDummyRec(bounds, text);
|
|
|
|
JS_FreeCString(ctx, text);
|
|
|
|
JS_FreeCString(ctx, text);
|
|
|
|
return JS_UNDEFINED;
|
|
|
|
return JS_UNDEFINED;
|
|
|
@ -9050,7 +9056,7 @@ static JSValue js_guiGrid(JSContext * ctx, JSValueConst this_val, int argc, JSVa
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * text = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
double _double_spacing;
|
|
|
|
double _double_spacing;
|
|
|
|
JS_ToFloat64(ctx, &_double_spacing, argv[2]);
|
|
|
|
JS_ToFloat64(ctx, &_double_spacing, argv[2]);
|
|
|
|
float spacing = (float)_double_spacing;
|
|
|
|
float spacing = (float)_double_spacing;
|
|
|
@ -9069,9 +9075,11 @@ static JSValue js_guiListView(JSContext * ctx, JSValueConst this_val, int argc,
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * text = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
int scrollIndex_out;
|
|
|
|
int scrollIndex_out;
|
|
|
|
int * scrollIndex = &scrollIndex_out;
|
|
|
|
int * scrollIndex = &scrollIndex_out;
|
|
|
|
|
|
|
|
JSValue scrollIndex_js = JS_GetPropertyStr(ctx, argv[2], "scrollIndex");
|
|
|
|
|
|
|
|
JS_ToInt32(ctx, scrollIndex, scrollIndex_js);
|
|
|
|
int active;
|
|
|
|
int active;
|
|
|
|
JS_ToInt32(ctx, &active, argv[3]);
|
|
|
|
JS_ToInt32(ctx, &active, argv[3]);
|
|
|
|
int returnVal = GuiListView(bounds, text, scrollIndex, active);
|
|
|
|
int returnVal = GuiListView(bounds, text, scrollIndex, active);
|
|
|
@ -9085,9 +9093,9 @@ static JSValue js_guiMessageBox(JSContext * ctx, JSValueConst this_val, int argc
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
const char * title = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * title = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * message = (const char *)JS_ToCString(ctx, argv[2]);
|
|
|
|
const char * message = JS_IsNull(argv[2]) ? NULL : (const char *)JS_ToCString(ctx, argv[2]);
|
|
|
|
const char * buttons = (const char *)JS_ToCString(ctx, argv[3]);
|
|
|
|
const char * buttons = JS_IsNull(argv[3]) ? NULL : (const char *)JS_ToCString(ctx, argv[3]);
|
|
|
|
int returnVal = GuiMessageBox(bounds, title, message, buttons);
|
|
|
|
int returnVal = GuiMessageBox(bounds, title, message, buttons);
|
|
|
|
JS_FreeCString(ctx, title);
|
|
|
|
JS_FreeCString(ctx, title);
|
|
|
|
JS_FreeCString(ctx, message);
|
|
|
|
JS_FreeCString(ctx, message);
|
|
|
@ -9100,7 +9108,7 @@ static JSValue js_guiColorPicker(JSContext * ctx, JSValueConst this_val, int arg
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * text = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
Color* color_ptr = (Color*)JS_GetOpaque2(ctx, argv[2], js_Color_class_id);
|
|
|
|
Color* color_ptr = (Color*)JS_GetOpaque2(ctx, argv[2], js_Color_class_id);
|
|
|
|
if(color_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(color_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Color color = *color_ptr;
|
|
|
|
Color color = *color_ptr;
|
|
|
@ -9117,7 +9125,7 @@ static JSValue js_guiColorPanel(JSContext * ctx, JSValueConst this_val, int argc
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * text = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
Color* color_ptr = (Color*)JS_GetOpaque2(ctx, argv[2], js_Color_class_id);
|
|
|
|
Color* color_ptr = (Color*)JS_GetOpaque2(ctx, argv[2], js_Color_class_id);
|
|
|
|
if(color_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(color_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Color color = *color_ptr;
|
|
|
|
Color color = *color_ptr;
|
|
|
@ -9134,7 +9142,7 @@ static JSValue js_guiColorBarAlpha(JSContext * ctx, JSValueConst this_val, int a
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * text = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
double _double_alpha;
|
|
|
|
double _double_alpha;
|
|
|
|
JS_ToFloat64(ctx, &_double_alpha, argv[2]);
|
|
|
|
JS_ToFloat64(ctx, &_double_alpha, argv[2]);
|
|
|
|
float alpha = (float)_double_alpha;
|
|
|
|
float alpha = (float)_double_alpha;
|
|
|
@ -9148,7 +9156,7 @@ static JSValue js_guiColorBarHue(JSContext * ctx, JSValueConst this_val, int arg
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
Rectangle* bounds_ptr = (Rectangle*)JS_GetOpaque2(ctx, argv[0], js_Rectangle_class_id);
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
if(bounds_ptr == NULL) return JS_EXCEPTION;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
Rectangle bounds = *bounds_ptr;
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * text = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
double _double_value;
|
|
|
|
double _double_value;
|
|
|
|
JS_ToFloat64(ctx, &_double_value, argv[2]);
|
|
|
|
JS_ToFloat64(ctx, &_double_value, argv[2]);
|
|
|
|
float value = (float)_double_value;
|
|
|
|
float value = (float)_double_value;
|
|
|
@ -9159,7 +9167,7 @@ static JSValue js_guiColorBarHue(JSContext * ctx, JSValueConst this_val, int arg
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_guiLoadStyle(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_guiLoadStyle(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * fileName = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * fileName = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
GuiLoadStyle(fileName);
|
|
|
|
GuiLoadStyle(fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
JS_FreeCString(ctx, fileName);
|
|
|
|
return JS_UNDEFINED;
|
|
|
|
return JS_UNDEFINED;
|
|
|
@ -9181,7 +9189,7 @@ static JSValue js_guiDisableTooltip(JSContext * ctx, JSValueConst this_val, int
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static JSValue js_guiSetTooltip(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_guiSetTooltip(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
const char * tooltip = (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
const char * tooltip = JS_IsNull(argv[0]) ? NULL : (const char *)JS_ToCString(ctx, argv[0]);
|
|
|
|
GuiSetTooltip(tooltip);
|
|
|
|
GuiSetTooltip(tooltip);
|
|
|
|
JS_FreeCString(ctx, tooltip);
|
|
|
|
JS_FreeCString(ctx, tooltip);
|
|
|
|
return JS_UNDEFINED;
|
|
|
|
return JS_UNDEFINED;
|
|
|
@ -9190,7 +9198,7 @@ static JSValue js_guiSetTooltip(JSContext * ctx, JSValueConst this_val, int argc
|
|
|
|
static JSValue js_guiIconText(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
static JSValue js_guiIconText(JSContext * ctx, JSValueConst this_val, int argc, JSValueConst * argv) {
|
|
|
|
int iconId;
|
|
|
|
int iconId;
|
|
|
|
JS_ToInt32(ctx, &iconId, argv[0]);
|
|
|
|
JS_ToInt32(ctx, &iconId, argv[0]);
|
|
|
|
const char * text = (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * text = JS_IsNull(argv[1]) ? NULL : (const char *)JS_ToCString(ctx, argv[1]);
|
|
|
|
const char * returnVal = GuiIconText(iconId, text);
|
|
|
|
const char * returnVal = GuiIconText(iconId, text);
|
|
|
|
JS_FreeCString(ctx, text);
|
|
|
|
JS_FreeCString(ctx, text);
|
|
|
|
JSValue ret = JS_NewString(ctx, returnVal);
|
|
|
|
JSValue ret = JS_NewString(ctx, returnVal);
|
|
|
|