add render

This commit is contained in:
John Alanbrook 2024-09-22 23:10:36 -05:00
parent f82c54d3b2
commit af6824e6db
4 changed files with 19 additions and 12 deletions

View file

@ -349,3 +349,14 @@ if (!profile.enabled)
use = stripped_use;
Object.assign(globalThis, use("scripts/prosperon.js"));
app.interval(_ => {
profile.frame("hotreload");
actor.hotreload();
render.hotreload();
game.tex_hotreload();
repl.hotreload();
profile.endframe();
}, 1);

View file

@ -1,3 +1,8 @@
/*
TYPES OF PROFILING
*/
var t_units = ["ns", "us", "ms", "s", "ks", "Ms"];
function calc_cpu(fn, times, diff=0)
@ -37,7 +42,6 @@ profile.ms = function(t) { return profile.secs(t)*1000; }
var callgraph = {};
profile.cpu_cg = callgraph;
var st = profile.now();
function add_callgraph(fn, line, time) {
var cc = callgraph[line];
@ -63,6 +67,7 @@ profile.start_cpu_gather = function(gathertime = 5) // gather cpu frames for 'ti
{
if (cpu_start) return;
cpu_start = profile.now();
var st = cpu_start;
profile.gather(hittar, function() {
var time = profile.now()-st;

View file

@ -183,15 +183,13 @@ game.tex_hotreload = function()
{
for (var path in game.texture.cache) {
if (io.mod(path) > game.texture.time_cache[path]) {
say(`HOT SWAPPING IMAGE ${path}`);
var tex = game.texture.cache[path];
game.texture.time_cache[path] = io.mod(path);
os.texture_swap(path, game.texture.cache[path]);
for (var sprite of Object.values(allsprites)) {
if (sprite.texture == tex) {
say('syncing a sprite ...');
sprite.tex_sync();
}
sprite.tex_sync();
}
}
}
}

View file

@ -1147,13 +1147,6 @@ prosperon.process = function process() {
var dt = profile.secs(profile.now()) - frame_t;
frame_t = profile.secs(profile.now());
profile.frame("hotreload");
actor.hotreload();
render.hotreload();
game.tex_hotreload();
repl.hotreload();
profile.endframe();
/* debugging: check for gc */
profile.print_gc();