add prosperon use
This commit is contained in:
@@ -1670,22 +1670,28 @@ JSC_CCALL(spline_catmull,
|
||||
HMM_Vec2 *points = js2cpvec2arr(js,argv[0]);
|
||||
float param = js2number(js,argv[1]);
|
||||
HMM_Vec2 *samples = catmull_rom_ma_v2(points,param);
|
||||
|
||||
if (!samples)
|
||||
ret = JS_UNDEFINED;
|
||||
else
|
||||
ret = vecarr2js(js,samples, arrlen(samples));
|
||||
|
||||
arrfree(points);
|
||||
if (!samples) return JS_UNDEFINED;
|
||||
JSValue arr = vecarr2js(js,samples, arrlen(samples));
|
||||
arrfree(samples);
|
||||
return arr;
|
||||
)
|
||||
|
||||
JSC_CCALL(spline_bezier,
|
||||
HMM_Vec2 *points = js2cpvec2arr(js,argv[0]);
|
||||
float param = js2number(js,argv[1]);
|
||||
HMM_Vec2 *samples = catmull_rom_ma_v2(points,param);
|
||||
arrfree(points);
|
||||
if (!samples) return JS_UNDEFINED;
|
||||
JSValue arr = vecarr2js(js,samples, arrlen(samples));
|
||||
|
||||
if (!samples)
|
||||
ret = JS_UNDEFINED;
|
||||
else
|
||||
ret = vecarr2js(js,samples, arrlen(samples));
|
||||
|
||||
arrfree(samples);
|
||||
return arr;
|
||||
arrfree(points);
|
||||
)
|
||||
|
||||
static const JSCFunctionListEntry js_spline_funcs[] = {
|
||||
@@ -1760,7 +1766,7 @@ JSValue js_vector_dot(JSContext *js, JSValue self, int argc, JSValue *argv) {
|
||||
return JS_UNDEFINED;
|
||||
};
|
||||
|
||||
JSC_CCALL(vector_project, return vec22js(js,HMM_ProjV2(js2vec2(js,argv[0]), js2vec2(js,argv[1]))))
|
||||
JSC_CCALL(vector_project, ret = vec22js(js,HMM_ProjV2(js2vec2(js,argv[0]), js2vec2(js,argv[1]))))
|
||||
|
||||
JSC_CCALL(vector_midpoint,
|
||||
HMM_Vec2 a = js2vec2(js,argv[0]);
|
||||
@@ -1773,12 +1779,12 @@ JSC_CCALL(vector_midpoint,
|
||||
JSC_CCALL(vector_distance,
|
||||
HMM_Vec2 a = js2vec2(js,argv[0]);
|
||||
HMM_Vec2 b = js2vec2(js,argv[1]);
|
||||
return number2js(js,HMM_DistV2(a,b));
|
||||
ret = number2js(js,HMM_DistV2(a,b));
|
||||
)
|
||||
|
||||
JSC_CCALL(vector_angle,
|
||||
HMM_Vec2 a = js2vec2(js,argv[0]);
|
||||
return angle2js(js,atan2(a.y,a.x));
|
||||
ret= angle2js(js,atan2(a.y,a.x));
|
||||
)
|
||||
|
||||
/* Given a series of points p, computes a new series with them expanded on either side by d */
|
||||
@@ -1877,7 +1883,7 @@ JSC_CCALL(vector_add,
|
||||
HMM_Vec4 a = js2vec4(js,argv[0]);
|
||||
HMM_Vec4 b = js2vec4(js,argv[1]);
|
||||
HMM_Vec4 c = HMM_AddV4(a,b);
|
||||
return vec42js(js,c);
|
||||
ret = vec42js(js,c);
|
||||
)
|
||||
|
||||
JSC_CCALL(vector_norm,
|
||||
@@ -1895,7 +1901,7 @@ JSC_CCALL(vector_norm,
|
||||
for (int i = 0; i < len; i++)
|
||||
JS_SetPropertyUint32(js, newarr, i, number2js(js,js_getnum_uint32(js, argv[0],i)/length));
|
||||
|
||||
return newarr;
|
||||
ret = newarr;
|
||||
)
|
||||
|
||||
JSC_CCALL(vector_angle_between,
|
||||
@@ -1905,7 +1911,7 @@ JSC_CCALL(vector_angle_between,
|
||||
case 3: return angle2js(js,HMM_AngleV3(js2vec3(js,argv[0]), js2vec3(js,argv[1])));
|
||||
case 4: return angle2js(js,HMM_AngleV4(js2vec4(js,argv[0]), js2vec4(js,argv[1])));
|
||||
}
|
||||
return angle2js(js,0);
|
||||
ret = angle2js(js,0);
|
||||
)
|
||||
|
||||
JSC_CCALL(vector_lerp,
|
||||
@@ -1913,7 +1919,7 @@ JSC_CCALL(vector_lerp,
|
||||
double f = js2number(js,argv[1]);
|
||||
double t = js2number(js,argv[2]);
|
||||
|
||||
return number2js(js,(f-s)*t+s);
|
||||
ret = number2js(js,(f-s)*t+s);
|
||||
)
|
||||
|
||||
int gcd(int a, int b) {
|
||||
@@ -1923,13 +1929,13 @@ int gcd(int a, int b) {
|
||||
}
|
||||
|
||||
JSC_CCALL(vector_gcd,
|
||||
return number2js(js,gcd(js2number(js,argv[0]), js2number(js,argv[1])));
|
||||
ret = number2js(js,gcd(js2number(js,argv[0]), js2number(js,argv[1])));
|
||||
)
|
||||
|
||||
JSC_CCALL(vector_lcm,
|
||||
double a = js2number(js,argv[0]);
|
||||
double b = js2number(js,argv[1]);
|
||||
return number2js(js,(a*b)/gcd(a,b));
|
||||
ret = number2js(js,(a*b)/gcd(a,b));
|
||||
)
|
||||
|
||||
JSC_CCALL(vector_clamp,
|
||||
@@ -2241,7 +2247,7 @@ JS_FreeCString(JS,str); \
|
||||
JS_FreeValue(js,v); \
|
||||
} \
|
||||
|
||||
JSC_SCALL(os_engine_start,
|
||||
JSC_CCALL(os_engine_start,
|
||||
JSValue p = argv[0];
|
||||
JS_SDL_PROP(js, p, SDL_PROP_APP_METADATA_NAME_STRING, name)
|
||||
JS_SDL_PROP(js, p, SDL_PROP_APP_METADATA_VERSION_STRING, version)
|
||||
@@ -2718,7 +2724,7 @@ SDL_GPUShaderFormat js2SDL_GPUShaderFormat(JSContext *js, JSValue v)
|
||||
return format;
|
||||
}
|
||||
|
||||
JSC_SCALL(SDL_Window_make_gpu,
|
||||
JSC_CCALL(SDL_Window_make_gpu,
|
||||
const char *name = JS_ToCString(js,argv[1]);
|
||||
SDL_PropertiesID props = SDL_CreateProperties();
|
||||
SDL_SetStringProperty(props, SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING, name);
|
||||
@@ -5646,11 +5652,6 @@ JSC_SCALL(io_writepath,
|
||||
if (!PHYSFS_setWriteDir(str)) ret = JS_ThrowReferenceError(js,"%s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
|
||||
)
|
||||
|
||||
JSC_SSCALL(io_gamemode,
|
||||
const char *prefdir = PHYSFS_getPrefDir(str, str2);
|
||||
PHYSFS_setWriteDir(prefdir);
|
||||
)
|
||||
|
||||
struct globdata {
|
||||
JSContext *js;
|
||||
JSValue arr;
|
||||
@@ -5728,15 +5729,17 @@ JSC_CCALL(io_userdir, return JS_NewString(js,PHYSFS_getUserDir()))
|
||||
JSC_SCALL(io_open,
|
||||
PHYSFS_File *f = PHYSFS_openWrite(str);
|
||||
if (!f)
|
||||
return JS_ThrowReferenceError(js,"%s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
|
||||
|
||||
ret = PHYSFS_File2js(js,f);
|
||||
ret = JS_ThrowReferenceError(js,"%s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
|
||||
else
|
||||
ret = PHYSFS_File2js(js,f);
|
||||
)
|
||||
|
||||
JSC_SCALL(io_realdir,
|
||||
const char *real = PHYSFS_getRealDir(str);
|
||||
if (!real) return JS_UNDEFINED;
|
||||
ret = JS_NewString(js,real);
|
||||
if (!real)
|
||||
ret = JS_UNDEFINED;
|
||||
else
|
||||
ret = JS_NewString(js,real);
|
||||
)
|
||||
|
||||
JSC_CCALL(io_searchpath,
|
||||
@@ -5762,7 +5765,6 @@ static const JSCFunctionListEntry js_io_funcs[] = {
|
||||
MIST_FUNC_DEF(io,basedir, 0),
|
||||
MIST_FUNC_DEF(io, userdir, 0),
|
||||
MIST_FUNC_DEF(io, realdir, 1),
|
||||
MIST_FUNC_DEF(io, gamemode, 2),
|
||||
MIST_FUNC_DEF(io, open, 2),
|
||||
MIST_FUNC_DEF(io, searchpath, 0),
|
||||
};
|
||||
@@ -6519,7 +6521,7 @@ JSC_CCALL(os_make_transform,
|
||||
)
|
||||
JSC_CCALL(os_make_sprite, return sprite2js(js,make_sprite()))
|
||||
|
||||
JSC_SCALL(os_system, return number2js(js,system(str)); )
|
||||
JSC_SCALL(os_system, ret = number2js(js,system(str)); )
|
||||
|
||||
JSC_SCALL(os_model_buffer,
|
||||
/*
|
||||
@@ -7304,10 +7306,13 @@ JSC_SCALL(os_use_embed,
|
||||
if (strcmp(str,module_registry[i].name) == 0) {
|
||||
JSValue mod = JS_NewObject(js);
|
||||
JS_SetPropertyFunctionList(js,mod,module_registry[i].fn, module_registry[i].fn_count);
|
||||
return mod;
|
||||
ret = mod;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return JS_ThrowReferenceError(js,"Library %s could not be found embedded");
|
||||
|
||||
if (JS_IsUndefined(ret))
|
||||
ret = JS_ThrowReferenceError(js,"Library %s could not be found embedded", str);
|
||||
)
|
||||
|
||||
JSC_SCALL(os_use_dyn,
|
||||
@@ -7326,10 +7331,6 @@ JSC_SCALL(os_use_dyn,
|
||||
SDL_UnloadObject(ptr);
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
JSC_CCALL(qtree_insert,
|
||||
qtree tree = js2qtree(js,self);
|
||||
JSValue v = argv[0];
|
||||
|
||||
Reference in New Issue
Block a user