add colors; add repl check
This commit is contained in:
parent
515eb65b22
commit
ceccd032c2
|
@ -1425,6 +1425,11 @@ Vector.random = function() {
|
|||
|
||||
Vector.angle_between = vector.angle_between;
|
||||
Vector.rotate = vector.rotate;
|
||||
|
||||
vector.direction = function(from,to)
|
||||
{
|
||||
return vector.norm(to.sub(from));
|
||||
}
|
||||
|
||||
Vector.equal = function(v1, v2, tol) {
|
||||
if (!tol)
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
var Color = {
|
||||
white: [255,255,255],
|
||||
black: [0,0,0],
|
||||
blue: [84,110,255],
|
||||
green: [120,255,10],
|
||||
yellow: [251,255,43],
|
||||
red: [255,36,20],
|
||||
teal: [96, 252, 237],
|
||||
blue: [0,0,255],
|
||||
green: [0,255,0],
|
||||
yellow: [255,255,0],
|
||||
red: [255,0,0],
|
||||
gray: [181,181,181],
|
||||
cyan: [0,255,255],
|
||||
purple: [162,93,227],
|
||||
orange: [255,144,64],
|
||||
magenta: [255,0,255],
|
||||
};
|
||||
|
||||
Color.editor = {};
|
||||
|
|
|
@ -296,6 +296,10 @@ var entity = {
|
|||
|
||||
return bb ? bb : bbox.fromcwh([0, 0], [0, 0]);
|
||||
},
|
||||
|
||||
toJSON() {
|
||||
return {guid:this.guid};
|
||||
},
|
||||
|
||||
/* The unique components of this object. Its diff. */
|
||||
json_obj(depth=0) {
|
||||
|
|
|
@ -19,6 +19,7 @@ global.check_registers = function (obj) {
|
|||
global.obscure("global");
|
||||
global.mixin("scripts/render");
|
||||
global.mixin("scripts/debug");
|
||||
global.mixin("scripts/repl");
|
||||
|
||||
var frame_t = profile.secs(profile.now());
|
||||
|
||||
|
|
|
@ -1006,6 +1006,7 @@ prosperon.process = function process() {
|
|||
profile.frame("hotreload");
|
||||
actor.hotreload();
|
||||
render.hotreload();
|
||||
repl.hotreload();
|
||||
profile.endframe();
|
||||
|
||||
/* debugging: check for gc */
|
||||
|
|
|
@ -1505,11 +1505,11 @@ JSC_CCALL(array_lerp,
|
|||
)
|
||||
|
||||
static const JSCFunctionListEntry js_array_funcs[] = {
|
||||
MIST_FUNC_DEF(array, add, 1),
|
||||
MIST_FUNC_DEF(array, sub, 1),
|
||||
MIST_FUNC_DEF(array, div,1),
|
||||
MIST_FUNC_DEF(array, scale, 1),
|
||||
MIST_FUNC_DEF(array, lerp, 2)
|
||||
PROTO_FUNC_DEF(array, add, 1),
|
||||
PROTO_FUNC_DEF(array, sub, 1),
|
||||
PROTO_FUNC_DEF(array, div,1),
|
||||
PROTO_FUNC_DEF(array, scale, 1),
|
||||
PROTO_FUNC_DEF(array, lerp, 2)
|
||||
};
|
||||
|
||||
JSC_CCALL(game_engine_start, engine_start(argv[0],argv[1], js2number(argv[2]), js2number(argv[3])))
|
||||
|
@ -3220,7 +3220,7 @@ void ffi_load() {
|
|||
|
||||
JSValue array_proto = js_getpropstr(globalThis, "Array");
|
||||
array_proto = js_getpropstr(array_proto, "prototype");
|
||||
JS_SetPropertyFunctionList(js, array_proto, js_array_funcs, 4);
|
||||
JS_SetPropertyFunctionList(js, array_proto, js_array_funcs, countof(js_array_funcs));
|
||||
|
||||
JS_FreeValue(js,globalThis);
|
||||
}
|
||||
|
|
|
@ -14,9 +14,10 @@ void script_report_gc_time(double t, double startmem, double mem);
|
|||
|
||||
extern JSValue cpShape2js(cpShape *s);
|
||||
|
||||
#define MIST_CFUNC_DEF(name, length, func1) { name, JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE | JS_PROP_ENUMERABLE, JS_DEF_CFUNC, 0, .u = { .func = { length, JS_CFUNC_generic, { .generic = func1 } } } }
|
||||
#define MIST_CFUNC_DEF(name, length, func1, props) { name, props, JS_DEF_CFUNC, 0, .u = { .func = { length, JS_CFUNC_generic, { .generic = func1 } } } }
|
||||
|
||||
#define MIST_FUNC_DEF(TYPE, FN, LEN) MIST_CFUNC_DEF(#FN, LEN, js_##TYPE##_##FN)
|
||||
#define MIST_FUNC_DEF(TYPE, FN, LEN) MIST_CFUNC_DEF(#FN, LEN, js_##TYPE##_##FN, JS_PROP_C_W_E)
|
||||
#define PROTO_FUNC_DEF(TYPE, FN, LEN) MIST_CFUNC_DEF(#FN, LEN, js_##TYPE##_##FN, 0)
|
||||
|
||||
#define JS_SETSIG JSContext *js, JSValue self, JSValue val
|
||||
|
||||
|
|
|
@ -169,8 +169,6 @@ time_t file_mod_secs(const char *file) {
|
|||
mz_zip_reader_file_stat(&corecdb, index, &pstat);
|
||||
return pstat.m_time;
|
||||
}
|
||||
else
|
||||
stat(file, &attr);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue