java
This commit is contained in:
parent
bdde403a66
commit
3e4edf1ea3
|
@ -15,6 +15,7 @@
|
||||||
#include "anim.h"
|
#include "anim.h"
|
||||||
#include "yugine.h"
|
#include "yugine.h"
|
||||||
#include "nuke.h"
|
#include "nuke.h"
|
||||||
|
#include "font.h"
|
||||||
|
|
||||||
cpVect duk2vec2(duk_context *duk, int p) {
|
cpVect duk2vec2(duk_context *duk, int p) {
|
||||||
cpVect pos;
|
cpVect pos;
|
||||||
|
@ -31,13 +32,11 @@ cpVect duk2vec2(duk_context *duk, int p) {
|
||||||
duk_ret_t duk_gui_text(duk_context *duk) {
|
duk_ret_t duk_gui_text(duk_context *duk) {
|
||||||
const char *s = duk_to_string(duk, 0);
|
const char *s = duk_to_string(duk, 0);
|
||||||
cpVect pos = duk2vec2(duk, 1);
|
cpVect pos = duk2vec2(duk, 1);
|
||||||
duk_get_prop_index(duk, 1, 0);
|
|
||||||
float fpos[2] = {pos.x, pos.y};
|
float fpos[2] = {pos.x, pos.y};
|
||||||
|
|
||||||
float size = duk_to_number(duk, 2);
|
float size = duk_to_number(duk, 2);
|
||||||
const float white[3] = {1.f, 1.f, 1.f};
|
const float white[3] = {1.f, 1.f, 1.f};
|
||||||
renderText(s, fpos, size, white, 1800);
|
renderText(s, fpos, size, white, 1800);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,8 +141,8 @@ duk_ret_t duk_make_gameobject(duk_context *duk) {
|
||||||
go->mass = duk_to_number(duk, 2);
|
go->mass = duk_to_number(duk, 2);
|
||||||
go->f = duk_to_number(duk, 3);
|
go->f = duk_to_number(duk, 3);
|
||||||
go->e = duk_to_number(duk, 4);
|
go->e = duk_to_number(duk, 4);
|
||||||
go->flipx = duk_to_boolean(duk, 5);
|
go->flipx = duk_to_boolean(duk, 5) ? -1 : 1;
|
||||||
go->flipy = duk_to_boolean(duk, 6);
|
go->flipy = duk_to_boolean(duk, 6) ? -1 : 1;
|
||||||
|
|
||||||
gameobject_apply(go);
|
gameobject_apply(go);
|
||||||
|
|
||||||
|
@ -246,4 +245,4 @@ void ffi_load()
|
||||||
DUK_FUNC(gui_text, 3);
|
DUK_FUNC(gui_text, 3);
|
||||||
DUK_FUNC(make_sprite, 3);
|
DUK_FUNC(make_sprite, 3);
|
||||||
DUK_FUNC(cmd, 2);
|
DUK_FUNC(cmd, 2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,8 +89,6 @@ void script_eval_w_env(const char *s, void *env) {
|
||||||
duk_push_heapptr(duk, env);
|
duk_push_heapptr(duk, env);
|
||||||
duk_push_string(duk, s);
|
duk_push_string(duk, s);
|
||||||
|
|
||||||
YughInfo("pressed %s", s);
|
|
||||||
|
|
||||||
if (!duk_has_prop(duk, -2)) {
|
if (!duk_has_prop(duk, -2)) {
|
||||||
duk_pop(duk);
|
duk_pop(duk);
|
||||||
return;
|
return;
|
||||||
|
@ -168,4 +166,4 @@ void call_physics(double dt) {
|
||||||
duk_push_number(duk, dt);
|
duk_push_number(duk, dt);
|
||||||
duk_call(duk, 1);
|
duk_call(duk, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue