fix render image

This commit is contained in:
John Alanbrook 2024-07-01 17:00:01 -05:00
parent b25cd85071
commit e1ac2a8fe3
5 changed files with 4 additions and 25 deletions

View file

@ -1,10 +0,0 @@
console.stdout_lvl = 4;
say(`config after std`);
window.size = [600,600];
window.rendersize = [200,200];
say(`config after window size`);
globalThis.gamestate = {};
gamestate.grid = 10;
//window.title = "Accio!";
say(`end of config`);

View file

@ -5,8 +5,6 @@
game.loadurs();
console.info(`window size: ${window.size}, render size: ${window.rendersize}`);
player[0].control(debug);
var show_frame = true;
@ -390,8 +388,8 @@ var editor = {
gui() {
/* Clean out killed objects */
if (show_frame)
render.line(shape.box(window.rendersize.x, window.rendersize.y).wrapped(1).map(p => game.camera.world2view(p)), Color.yellow);
// if (show_frame)
/// render.line(shape.box(window.rendersize.x, window.rendersize.y).wrapped(1).map(p => game.camera.world2view(p)), Color.yellow);
render.text([0,0], game.camera.world2view([0,0]));

View file

@ -362,7 +362,7 @@ function process() {
}
}
var st = profile.now();
prosperon.window_render(window.rendersize);
prosperon.window_render(window.size);
prosperon.draw();
prosperon.debug();
prosperon.gui();
@ -606,7 +606,6 @@ var Event = {
},
};
// window.rendersize is the resolution the game renders at
// window.size is the physical size of the window on the desktop
// set to one of the following
// stretch render to fill window
@ -617,7 +616,6 @@ var Event = {
// full expand out beyond window
window.size = [640, 480];
window.rendersize = window.size;
window.mode = "keep";
window.set_icon.doc = "Set the icon of the window using the PNG image at path.";
@ -661,8 +659,3 @@ globalThis.mum = app.spawn("scripts/mum");
window.title = `Prosperon v${prosperon.version}`;
window.size = [500, 500];
window.boundingbox = function () {
var pos = game.camera.pos;
var wh = window.rendersize.scale(game.camera.zoom);
return bbox.fromcwh(pos, wh);
};

View file

@ -246,9 +246,6 @@ Cmdline.register_order("play", function(argv) {
global.mixin("config.js");
if (project.title) window.title = project.title;
if (window.rendersize.equal([0,0])) window.rendersize = window.size;
console.info(`Starting game with window size ${window.size} and render ${window.rendersize}.`);
game.engine_start(function() {
render.set_font("fonts/c64.ttf", 8);
global.app = actor.spawn("game.js");

View file

@ -703,6 +703,7 @@ JSC_CCALL(render_glue_pass,
});
)
// Set the portion of the window to be rendered to
JSC_CCALL(render_viewport, sg_apply_viewportf(js2number(argv[0]), js2number(argv[1]), js2number(argv[2]), js2number(argv[3]), 0))
JSC_CCALL(render_commit, sg_commit())