no more scripts subdir

This commit is contained in:
2024-11-05 15:55:18 -06:00
parent 75c93b4cf9
commit b1fb260366
7 changed files with 47 additions and 38 deletions

View File

@@ -96,8 +96,9 @@ endforeach
core = custom_target('core.zip', core = custom_target('core.zip',
output:'core.zip', output:'core.zip',
command: ['zip', '-r', '@OUTPUT@'] + zip_paths, command: ['zip', '-r', '-j', '@OUTPUT@'] + zip_paths,
build_by_default: true, build_by_default: true,
build_always:true
) )
prosperon = executable('prosperon', sources, prosperon = executable('prosperon', sources,

View File

@@ -4,7 +4,7 @@ cpp = 'x86_64-w64-mingw32-g++'
ar = 'x86_64-w64-mingw32-ar' ar = 'x86_64-w64-mingw32-ar'
windres = 'x86_64-w64-mingw32-windres' windres = 'x86_64-w64-mingw32-windres'
strip = 'x86_64-w64-mingw32-strip' strip = 'x86_64-w64-mingw32-strip'
exe_wrapper = '' exe_wrapper = 'wine'
[host_machine] [host_machine]
system = 'windows' system = 'windows'
@@ -13,4 +13,5 @@ cpu = 'x86_64'
endian = 'little' endian = 'little'
[properties] [properties]
link_args = ['-static'] link_args = ['-static']
needs_exe_wrapper = false

View File

@@ -244,7 +244,7 @@ var editor = {
Object.dainty_assign(this.desktop, this.stash); Object.dainty_assign(this.desktop, this.stash);
} }
this.selectlist = []; this.selectlist = [];
editor.camera = world.spawn("scripts/camera2d"); editor.camera = world.spawn("camera2d");
editor.camera._ed.selectable = false; editor.camera._ed.selectable = false;
game.camera = editor.camera; game.camera = editor.camera;
}, },

View File

@@ -73,6 +73,7 @@ Resources.replpath = function replpath(str, path) {
Resources.replstrs = function replstrs(path) { Resources.replstrs = function replstrs(path) {
if (!path) return; if (!path) return;
var script = io.slurp(path); var script = io.slurp(path);
if (!script) return;
var regexp = /"[^"\s]*?\.[^"\s]+?"/g; var regexp = /"[^"\s]*?\.[^"\s]+?"/g;
var stem = path.dir(); var stem = path.dir();
@@ -351,8 +352,8 @@ profile.enabled = true;
console.enabled = true; console.enabled = true;
debug.enabled = true; debug.enabled = true;
bare_use("scripts/base.js"); bare_use("base.js");
bare_use("scripts/profile.js"); bare_use("profile.js");
prosperon.release = function () { prosperon.release = function () {
profile.enabled = false; profile.enabled = false;
@@ -364,7 +365,7 @@ bare_use("preconfig.js");
if (!profile.enabled) use = stripped_use; if (!profile.enabled) use = stripped_use;
Object.assign(globalThis, use("scripts/prosperon.js")); Object.assign(globalThis, use("prosperon.js"));
app.interval(_ => { app.interval(_ => {
profile.report("hotreload"); profile.report("hotreload");

View File

@@ -18,9 +18,9 @@ global.check_registers = function (obj) {
}; };
global.obscure("global"); global.obscure("global");
global.mixin("scripts/render"); global.mixin("render");
global.mixin("scripts/debug"); global.mixin("debug");
global.mixin("scripts/repl"); global.mixin("repl");
var frame_t = profile.secs(profile.now()); var frame_t = profile.secs(profile.now());
@@ -59,7 +59,7 @@ game.engine_start = function (s) {
game.startengine = 1; game.startengine = 1;
gggstart( gggstart(
function () { function () {
// global.mixin("scripts/sound.js"); // global.mixin("sound.js");
world_start(); world_start();
window.set_icon(game.texture("moon").texture); window.set_icon(game.texture("moon").texture);
Object.readonly(window.__proto__, "vsync"); Object.readonly(window.__proto__, "vsync");
@@ -327,11 +327,11 @@ game.texture = function (path) {
return ret[anim_str].frames[frame]; return ret[anim_str].frames[frame];
} }
if (!path) return game.texture("icons/no_tex.gif"); if (!path) return game.texture("no_tex.gif");
if (!io.exists(path)) { if (!io.exists(path)) {
console.error(`Missing texture: ${path}`); console.error(`Missing texture: ${path}`);
game.texture.cache[path] = game.texture("icons/no_tex.gif"); game.texture.cache[path] = game.texture("no_tex.gif");
game.texture.time_cache[path] = io.mod(path); game.texture.time_cache[path] = io.mod(path);
return game.texture.cache[path]; return game.texture.cache[path];
} }
@@ -504,15 +504,15 @@ window.__proto__.toJSON = function () {
}; };
}; };
global.mixin("scripts/input"); global.mixin("input");
global.mixin("scripts/std"); global.mixin("std");
global.mixin("scripts/diff"); global.mixin("diff");
global.mixin("scripts/color"); global.mixin("color");
global.mixin("scripts/tween"); global.mixin("tween");
global.mixin("scripts/ai"); global.mixin("ai");
global.mixin("scripts/particle"); global.mixin("particle");
//global.mixin("scripts/physics"); //global.mixin("physics");
global.mixin("scripts/geometry"); global.mixin("geometry");
/* /*
Factory for creating registries. Register one with 'X.register', Factory for creating registries. Register one with 'X.register',
@@ -653,10 +653,10 @@ prosperon.add_timer = function(obj, fn, seconds)
return stop; return stop;
} }
global.mixin("scripts/spline"); global.mixin("spline");
global.mixin("scripts/components"); global.mixin("components");
global.mixin("scripts/actor"); global.mixin("actor");
global.mixin("scripts/entity"); global.mixin("entity");
function world_start() { function world_start() {
globalThis.world = Object.create(entity); globalThis.world = Object.create(entity);

View File

@@ -1,6 +1,5 @@
os.cwd.doc = "Get the absolute path of the current working directory."; os.cwd.doc = "Get the absolute path of the current working directory.";
os.env.doc = "Return the value of the environment variable v."; os.env.doc = "Return the value of the environment variable v.";
os.platform = "steam";
if (os.sys() === "windows") os.user = os.env("USERNAME"); if (os.sys() === "windows") os.user = os.env("USERNAME");
else os.user = os.env("USER"); else os.user = os.env("USER");
@@ -29,9 +28,6 @@ appy.inputs["M-f4"] = os.quit;
player[0].control(appy); player[0].control(appy);
//steam.appid = 480;
//steam.userid = 8437843;
os.home = os.env("HOME"); os.home = os.env("HOME");
/*steam.path = { /*steam.path = {
@@ -40,6 +36,7 @@ os.home = os.env("HOME");
linux: `${os.home}/.local/share/Steam/userdata/${steam.userid}/${steam.appid}` linux: `${os.home}/.local/share/Steam/userdata/${steam.userid}/${steam.appid}`
}; };
*/ */
var otherpath = { var otherpath = {
windows: `C:/Users/${os.user}/Saved Games`, windows: `C:/Users/${os.user}/Saved Games`,
macos: `${os.home}/Library/Application Support`, macos: `${os.home}/Library/Application Support`,
@@ -80,6 +77,15 @@ io.chmod = function (file, mode) {
return tmpchm(file, parseInt(mode, 8)); return tmpchm(file, parseInt(mode, 8));
}; };
var tmpfex = io.exists;
var icount = 0;
io.exists = function(path)
{
icount++;
if (console.info) console.info(`exist count: ${icount}`);
return tmpfex(path)
}
var tmpslurp = io.slurp; var tmpslurp = io.slurp;
io.slurp = function (path) { io.slurp = function (path) {
path = Resources.replpath(path); path = Resources.replpath(path);
@@ -203,7 +209,7 @@ Cmdline.register_order(
sim.pause(); sim.pause();
game.engine_start(function () { game.engine_start(function () {
global.mixin("scripts/editor.js"); global.mixin("editor.js");
use("editorconfig.js"); use("editorconfig.js");
use("config.js"); use("config.js");
render.set_font("fonts/c64.ttf", 8); render.set_font("fonts/c64.ttf", 8);
@@ -270,10 +276,10 @@ Cmdline.register_order(
game.engine_start(function () { game.engine_start(function () {
if (io.exists("game.js")) global.app = actor.spawn("game.js"); if (io.exists("game.js")) global.app = actor.spawn("game.js");
else global.app = actor.spawn("scripts/nogame.js"); else global.app = actor.spawn("nogame.js");
if (project.icon) window.set_icon(game.texture(project.icon).texture); if (project.icon) window.set_icon(game.texture(project.icon).texture);
game.camera = world.spawn("scripts/camera2d"); game.camera = world.spawn("camera2d");
}); });
}, },
"Play the game present in this folder.", "Play the game present in this folder.",
@@ -444,7 +450,7 @@ Cmdline.register_order(
return; return;
} }
use("scripts/editor.js"); use("editor.js");
var api = debug.api.print_doc(obj[0]); var api = debug.api.print_doc(obj[0]);
if (!api) return; if (!api) return;
@@ -457,7 +463,7 @@ Cmdline.register_order(
Cmdline.register_order( Cmdline.register_order(
"input", "input",
function (pawn) { function (pawn) {
use("scripts/editor.js"); use("editor.js");
say(`## Input for ${pawn}`); say(`## Input for ${pawn}`);
eval(`say(input.print_md_kbm(${pawn}));`); eval(`say(input.print_md_kbm(${pawn}));`);
}, },
@@ -549,7 +555,7 @@ Cmdline.register_order(
Cmdline.register_order( Cmdline.register_order(
"test", "test",
function (argv) { function (argv) {
use("scripts/test.js"); use("test.js");
}, },
"Run tests.", "Run tests.",
); );

View File

@@ -74,8 +74,8 @@ void script_startup() {
ffi_load(); ffi_load();
size_t len; size_t len;
char *eng = slurp_text("scripts/engine.js", &len); char *eng = slurp_text("engine.js", &len);
JSValue v = script_eval("scripts/engine.js", eng); JSValue v = script_eval("engine.js", eng);
JS_FreeValue(js, v); JS_FreeValue(js, v);
free(eng); free(eng);
} }