timers
This commit is contained in:
parent
f47be2d30c
commit
9bbe880466
|
@ -75,7 +75,7 @@ var sprite = {
|
||||||
// self?.anim_done?.();
|
// self?.anim_done?.();
|
||||||
// if (!self.loop) { self.stop(); return; }
|
// if (!self.loop) { self.stop(); return; }
|
||||||
}
|
}
|
||||||
// if (self) stop = self.gameobject.delay(advance, playing.frames[f].time / self.anim_speed);
|
if (self) stop = self.gameobject.delay(advance, playing.frames[f].time / self.anim_speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
advance();
|
advance();
|
||||||
|
|
|
@ -719,8 +719,9 @@ var img_idx = 0;
|
||||||
function flush_img() {
|
function flush_img() {
|
||||||
if (img_idx === 0) return;
|
if (img_idx === 0) return;
|
||||||
render.use_shader(spritessboshader);
|
render.use_shader(spritessboshader);
|
||||||
render.use_mat({ diffuse: lasttex });
|
//render.use_mat({ diffuse: lasttex });
|
||||||
render.make_sprite_ssbo(img_cache.slice(0, img_idx), poly_ssbo);
|
render.make_sprite_ssbo(img_cache.slice(0, img_idx), poly_ssbo);
|
||||||
|
cur.images = [lasttex];
|
||||||
render.draw(shape.quad, poly_ssbo, img_idx);
|
render.draw(shape.quad, poly_ssbo, img_idx);
|
||||||
lasttex = undefined;
|
lasttex = undefined;
|
||||||
img_idx = 0;
|
img_idx = 0;
|
||||||
|
@ -761,6 +762,7 @@ render.image = function image(tex, pos, scale, rotation = 0, color = Color.white
|
||||||
var e = img_e();
|
var e = img_e();
|
||||||
e.transform.trs(pos, undefined, scale);
|
e.transform.trs(pos, undefined, scale);
|
||||||
e.shade = color;
|
e.shade = color;
|
||||||
|
e.texture = tex;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
var bb = {};
|
var bb = {};
|
||||||
|
|
|
@ -1107,17 +1107,29 @@ JSC_CCALL(render_make_sprite_ssbo,
|
||||||
for (int i = 0; i < js_arrlen(array); i++) {
|
for (int i = 0; i < js_arrlen(array); i++) {
|
||||||
JSValue sub = js_getpropidx(array,i);
|
JSValue sub = js_getpropidx(array,i);
|
||||||
|
|
||||||
ms[i].model = transform2mat(js2transform(js_getpropstr(sub, "transform")));
|
transform *tr = js2transform(js_getpropstr(sub, "transform"));
|
||||||
texture *t = js2texture(js_getpropstr(sub, "texture"));
|
texture *t = js2texture(js_getpropstr(sub, "texture"));
|
||||||
if (t) {
|
|
||||||
HMM_Vec3 tscale;
|
HMM_Vec3 tscale;
|
||||||
|
|
||||||
|
if (t) {
|
||||||
tscale.x = t->width;
|
tscale.x = t->width;
|
||||||
tscale.y = t->height;
|
tscale.y = t->height;
|
||||||
tscale.z = 1;
|
tscale.z = 1;
|
||||||
ms[i].model = HMM_MulM4(ms[i].model, HMM_Scale(tscale));
|
tr->scale = HMM_MulV3(tr->scale, tscale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tr->scale.x = 100;
|
||||||
|
tr->scale.y = 100;
|
||||||
|
tr->scale.z = 1;
|
||||||
|
tr->pos.x = 100;
|
||||||
|
tr->pos.y = 100;
|
||||||
|
tr->pos.z = 0;
|
||||||
|
ms[i].model = transform2mat(t);
|
||||||
ms[i].rect = js2vec4(js_getpropstr(sub,"rect"));
|
ms[i].rect = js2vec4(js_getpropstr(sub,"rect"));
|
||||||
ms[i].shade = js2vec4(js_getpropstr(sub,"shade"));
|
ms[i].shade = js2vec4(js_getpropstr(sub,"shade"));
|
||||||
|
|
||||||
|
if (t)
|
||||||
|
tr->scale = HMM_DivV3(tr->scale, tscale);
|
||||||
}
|
}
|
||||||
|
|
||||||
sg_append_buffer(*b, (&(sg_range){
|
sg_append_buffer(*b, (&(sg_range){
|
||||||
|
|
|
@ -29,3 +29,8 @@ void timer_update(double dt)
|
||||||
timers[i]->remain -= dt;
|
timers[i]->remain -= dt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void timer_stop(timer *t)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
|
@ -8,5 +8,6 @@ typedef struct timer {
|
||||||
timer *timer_make();
|
timer *timer_make();
|
||||||
void timer_free(timer *t);
|
void timer_free(timer *t);
|
||||||
void timer_update(double dt);
|
void timer_update(double dt);
|
||||||
|
void timer_stop(timer *t);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue