Add script subfolder in pinball
This commit is contained in:
@@ -22,16 +22,18 @@ void script_run(const char *script) {
|
||||
mrb_load_string(mrb, script);
|
||||
}
|
||||
|
||||
void script_dofile(const char *file) {
|
||||
int script_dofile(const char *file) {
|
||||
FILE *mrbf = fopen(file, "r");
|
||||
if (mrbf == NULL) {
|
||||
YughError("Could not find game.rb in root folder.",0);
|
||||
return;
|
||||
YughError("Could not find script %s.", file);
|
||||
return 1;
|
||||
}
|
||||
mrbc_filename(mrb, c, file);
|
||||
obj = mrb_load_file_cxt(mrb, mrbf, c);
|
||||
mrb_print_error(mrb);
|
||||
fclose(mrbf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void script_update(double dt) {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
void script_init();
|
||||
void script_run(const char *script);
|
||||
void script_dofile(const char *file);
|
||||
int script_dofile(const char *file);
|
||||
void script_update(double dt);
|
||||
void script_draw();
|
||||
void script_editor();
|
||||
|
||||
@@ -42,7 +42,7 @@ int main(int argc, char **args) {
|
||||
|
||||
double framet = fmin(fmin(renderMS,physMS),updateMS);
|
||||
|
||||
script_dofile("engine.rb");
|
||||
script_dofile("scripts/engine.rb");
|
||||
script_dofile("config.rb");
|
||||
|
||||
window_set_icon("icon.png");
|
||||
|
||||
Reference in New Issue
Block a user