Hit params in collider works

This commit is contained in:
John Alanbrook 2022-12-27 18:52:25 +00:00
parent 9a77bb75a8
commit 2df559aa4c
4 changed files with 13 additions and 13 deletions

View file

@ -463,6 +463,7 @@ static cpBool s7_phys_cb_begin(cpArbiter *arb, cpSpace *space, void *data) {
struct gameobject *g2 = cpBodyGetUserData(body2);
script_call_sym_args(go->cbs->begin, s7_make_integer(s7, g2->editor.id));
//script_call_sym(go->cbs->begin);
return 1;
}

View file

@ -24,8 +24,8 @@
cpVect s7tovec2(s7_scheme *sc, s7_pointer s7vec) {
cpVect ret;
ret.x = s7_vector_ref(sc, s7vec, 0);
ret.y = s7_vector_ref(sc, s7vec, 1);
ret.x = s7_real(s7_vector_ref(sc, s7vec, 0));
ret.y = s7_real(s7_vector_ref(sc, s7vec, 1));
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) {
const char *s = s7_string(s7_car(args));
s7_pointer s7pos = s7_cadr(args);
double pos[2] = { s7_vector_ref(sc, s7pos, 0), s7_vector_ref(sc, s7pos, 1) };
cpVect pos = s7tovec2(sc, s7_cadr(args));
float fpos[2] = {pos.x, pos.y};
float size = s7_real(s7_caddr(args));
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);
}
s7_pointer s7_gui_img(s7_scheme *sc, s7_pointer args) {
const char *img = s7_string(s7_car(args));
s7_pointer s7pos = s7_cadr(args);
double pos[2] = { s7_vector_ref(sc, s7pos, 0), s7_vector_ref(sc, s7pos, 1) };
cpVect pos = s7tovec2(sc, s7_cadr(args));
gui_draw_img(img, pos[0], pos[1]);
gui_draw_img(img, pos.x, pos.y);
return args;
}
@ -324,7 +323,7 @@ s7_pointer s7_set_body(s7_scheme *sc, s7_pointer args) {
break;
case 2:
cpBodySetPosition(go, s7tovec2(sc, s7_caddr(args)));
cpBodySetPosition(go->body, s7tovec2(sc, s7_caddr(args)));
break;
case 3:
@ -402,8 +401,8 @@ void ffi_load() {
S7_FUNC(ui_text, 2);
S7_FUNC(ui_rendertext, 3);
S7_FUNC(gui_text, 4);
S7_FUNC(gui_img, 3);
S7_FUNC(gui_text, 3);
S7_FUNC(gui_img, 2);
S7_FUNC(gen_cmd, 2);
S7_FUNC(sys_cmd, 1);

View file

@ -97,7 +97,7 @@ void script_call_sym(s7_pointer sym)
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) {

View file

@ -73,7 +73,7 @@
(define-macro (gui . expr)
`(registertype gui
(let ((x 0) (y 0)) ,@expr)))
(let ((pos #(0 0))) ,@expr)))
(define-macro (while condition . body)
(let ((loop (gensym)))