Hit params in collider works
This commit is contained in:
parent
9a77bb75a8
commit
2df559aa4c
|
@ -463,6 +463,7 @@ static cpBool s7_phys_cb_begin(cpArbiter *arb, cpSpace *space, void *data) {
|
||||||
struct gameobject *g2 = cpBodyGetUserData(body2);
|
struct gameobject *g2 = cpBodyGetUserData(body2);
|
||||||
|
|
||||||
script_call_sym_args(go->cbs->begin, s7_make_integer(s7, g2->editor.id));
|
script_call_sym_args(go->cbs->begin, s7_make_integer(s7, g2->editor.id));
|
||||||
|
//script_call_sym(go->cbs->begin);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
|
|
||||||
cpVect s7tovec2(s7_scheme *sc, s7_pointer s7vec) {
|
cpVect s7tovec2(s7_scheme *sc, s7_pointer s7vec) {
|
||||||
cpVect ret;
|
cpVect ret;
|
||||||
ret.x = s7_vector_ref(sc, s7vec, 0);
|
ret.x = s7_real(s7_vector_ref(sc, s7vec, 0));
|
||||||
ret.y = s7_vector_ref(sc, s7vec, 1);
|
ret.y = s7_real(s7_vector_ref(sc, s7vec, 1));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -68,23 +68,22 @@ s7_pointer s7_ui_text(s7_scheme *sc, s7_pointer args) {
|
||||||
|
|
||||||
s7_pointer s7_gui_text(s7_scheme *sc, s7_pointer args) {
|
s7_pointer s7_gui_text(s7_scheme *sc, s7_pointer args) {
|
||||||
const char *s = s7_string(s7_car(args));
|
const char *s = s7_string(s7_car(args));
|
||||||
s7_pointer s7pos = s7_cadr(args);
|
cpVect pos = s7tovec2(sc, s7_cadr(args));
|
||||||
double pos[2] = { s7_vector_ref(sc, s7pos, 0), s7_vector_ref(sc, s7pos, 1) };
|
float fpos[2] = {pos.x, pos.y};
|
||||||
|
|
||||||
float size = s7_real(s7_caddr(args));
|
float size = s7_real(s7_caddr(args));
|
||||||
const float white[3] = {1.f, 1.f, 1.f};
|
const float white[3] = {1.f, 1.f, 1.f};
|
||||||
|
|
||||||
renderText(s, pos, size, white, 200);
|
renderText(s, fpos, size, white, 200);
|
||||||
|
|
||||||
return s7_car(args);
|
return s7_car(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
s7_pointer s7_gui_img(s7_scheme *sc, s7_pointer args) {
|
s7_pointer s7_gui_img(s7_scheme *sc, s7_pointer args) {
|
||||||
const char *img = s7_string(s7_car(args));
|
const char *img = s7_string(s7_car(args));
|
||||||
s7_pointer s7pos = s7_cadr(args);
|
cpVect pos = s7tovec2(sc, s7_cadr(args));
|
||||||
double pos[2] = { s7_vector_ref(sc, s7pos, 0), s7_vector_ref(sc, s7pos, 1) };
|
|
||||||
|
|
||||||
gui_draw_img(img, pos[0], pos[1]);
|
gui_draw_img(img, pos.x, pos.y);
|
||||||
|
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
@ -324,7 +323,7 @@ s7_pointer s7_set_body(s7_scheme *sc, s7_pointer args) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
cpBodySetPosition(go, s7tovec2(sc, s7_caddr(args)));
|
cpBodySetPosition(go->body, s7tovec2(sc, s7_caddr(args)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
|
@ -402,8 +401,8 @@ void ffi_load() {
|
||||||
S7_FUNC(ui_text, 2);
|
S7_FUNC(ui_text, 2);
|
||||||
S7_FUNC(ui_rendertext, 3);
|
S7_FUNC(ui_rendertext, 3);
|
||||||
|
|
||||||
S7_FUNC(gui_text, 4);
|
S7_FUNC(gui_text, 3);
|
||||||
S7_FUNC(gui_img, 3);
|
S7_FUNC(gui_img, 2);
|
||||||
|
|
||||||
S7_FUNC(gen_cmd, 2);
|
S7_FUNC(gen_cmd, 2);
|
||||||
S7_FUNC(sys_cmd, 1);
|
S7_FUNC(sys_cmd, 1);
|
||||||
|
|
|
@ -97,7 +97,7 @@ void script_call_sym(s7_pointer sym)
|
||||||
|
|
||||||
void script_call_sym_args(s7_pointer sym, s7_pointer args)
|
void script_call_sym_args(s7_pointer sym, s7_pointer args)
|
||||||
{
|
{
|
||||||
s7_call(s7, sym, args);
|
s7_call(s7, sym, s7_cons(s7, args, s7_nil(s7)));
|
||||||
}
|
}
|
||||||
|
|
||||||
int script_has_sym(s7_pointer sym) {
|
int script_has_sym(s7_pointer sym) {
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
|
|
||||||
(define-macro (gui . expr)
|
(define-macro (gui . expr)
|
||||||
`(registertype gui
|
`(registertype gui
|
||||||
(let ((x 0) (y 0)) ,@expr)))
|
(let ((pos #(0 0))) ,@expr)))
|
||||||
|
|
||||||
(define-macro (while condition . body)
|
(define-macro (while condition . body)
|
||||||
(let ((loop (gensym)))
|
(let ((loop (gensym)))
|
||||||
|
|
Loading…
Reference in a new issue