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',
output:'core.zip',
command: ['zip', '-r', '@OUTPUT@'] + zip_paths,
command: ['zip', '-r', '-j', '@OUTPUT@'] + zip_paths,
build_by_default: true,
build_always:true
)
prosperon = executable('prosperon', sources,

View File

@@ -4,7 +4,7 @@ cpp = 'x86_64-w64-mingw32-g++'
ar = 'x86_64-w64-mingw32-ar'
windres = 'x86_64-w64-mingw32-windres'
strip = 'x86_64-w64-mingw32-strip'
exe_wrapper = ''
exe_wrapper = 'wine'
[host_machine]
system = 'windows'
@@ -13,4 +13,5 @@ cpu = 'x86_64'
endian = 'little'
[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);
}
this.selectlist = [];
editor.camera = world.spawn("scripts/camera2d");
editor.camera = world.spawn("camera2d");
editor.camera._ed.selectable = false;
game.camera = editor.camera;
},

View File

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

View File

@@ -18,9 +18,9 @@ global.check_registers = function (obj) {
};
global.obscure("global");
global.mixin("scripts/render");
global.mixin("scripts/debug");
global.mixin("scripts/repl");
global.mixin("render");
global.mixin("debug");
global.mixin("repl");
var frame_t = profile.secs(profile.now());
@@ -59,7 +59,7 @@ game.engine_start = function (s) {
game.startengine = 1;
gggstart(
function () {
// global.mixin("scripts/sound.js");
// global.mixin("sound.js");
world_start();
window.set_icon(game.texture("moon").texture);
Object.readonly(window.__proto__, "vsync");
@@ -327,11 +327,11 @@ game.texture = function (path) {
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)) {
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);
return game.texture.cache[path];
}
@@ -504,15 +504,15 @@ window.__proto__.toJSON = function () {
};
};
global.mixin("scripts/input");
global.mixin("scripts/std");
global.mixin("scripts/diff");
global.mixin("scripts/color");
global.mixin("scripts/tween");
global.mixin("scripts/ai");
global.mixin("scripts/particle");
//global.mixin("scripts/physics");
global.mixin("scripts/geometry");
global.mixin("input");
global.mixin("std");
global.mixin("diff");
global.mixin("color");
global.mixin("tween");
global.mixin("ai");
global.mixin("particle");
//global.mixin("physics");
global.mixin("geometry");
/*
Factory for creating registries. Register one with 'X.register',
@@ -653,10 +653,10 @@ prosperon.add_timer = function(obj, fn, seconds)
return stop;
}
global.mixin("scripts/spline");
global.mixin("scripts/components");
global.mixin("scripts/actor");
global.mixin("scripts/entity");
global.mixin("spline");
global.mixin("components");
global.mixin("actor");
global.mixin("entity");
function world_start() {
globalThis.world = Object.create(entity);

View File

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

View File

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