prosperon/source/engine/script.h

39 lines
757 B
C
Raw Normal View History

2021-11-30 21:29:18 -06:00
#ifndef SCRIPT_H
#define SCRIPT_H
2023-01-10 07:13:00 -06:00
#include "duktape.h"
2022-12-28 16:50:54 -06:00
#include <chipmunk/chipmunk.h>
2022-08-07 01:43:45 -05:00
2023-01-10 07:13:00 -06:00
extern duk_context *duk;
2022-12-26 20:57:45 -06:00
2023-01-11 16:57:34 -06:00
struct callee {
void *fn;
void *obj;
};
2021-11-30 21:29:18 -06:00
void script_init();
void script_run(const char *script);
2022-11-20 15:50:14 -06:00
int script_dofile(const char *file);
2022-08-07 01:43:45 -05:00
void script_update(double dt);
2022-08-03 17:00:00 -05:00
void script_draw();
2022-08-03 20:49:56 -05:00
void script_editor();
2022-08-05 14:23:39 -05:00
void script_call(const char *f);
2023-01-10 14:02:24 -06:00
void script_call_sym(void *sym);
void script_call_sym_args(void *sym, void *args);
int script_has_sym(void *sym);
void script_eval_w_env(const char *s, void *env);
2021-11-30 21:29:18 -06:00
2023-01-11 16:57:34 -06:00
void register_update(struct callee c);
2022-12-22 16:58:06 -06:00
void call_updates(double dt);
2022-12-19 09:12:34 -06:00
2023-01-11 16:57:34 -06:00
void register_gui(struct callee c);
2022-12-20 19:34:22 -06:00
void call_gui();
2023-01-11 16:57:34 -06:00
void register_physics(struct callee c);
2022-12-22 16:58:06 -06:00
void call_physics(double dt);
2022-12-20 19:34:22 -06:00
2023-01-10 14:02:24 -06:00
duk_idx_t vec2duk(cpVect v);
2022-12-28 16:50:54 -06:00
2022-02-06 10:14:57 -06:00
#endif