I think I may have the solution. First, setting the ISOMETRIC flag is mandatory I think, since you're working with flat surfaces such that the x position causes no problems. Then we need a fixed camera arc which I calculated* to roughly 53. With this arc, the screen dimensions are as big as the entity/picture dimensions. Lastly we just calculate the new scale directly. I commented the needed lines.



*The actual calculation can be found in the manual (under "arc") with the formula: width = view.size_x * 2 * tan(view.arc/2).
If we calculate the arc with that, we get an exact solution of 53.130102354156.

Code
///////////////////////////////
#include <acknex.h>
#include <default.c>

///////////////////////////////

ENTITY* slayt_ent;

#define image_type skill1
#define landscape 1
#define portrait 0

action slayt_ent_act()
{
	my.ambient=100;
	wait(1); //wait for the morphing
	var scale;
	var width = my.max_y * 2; //the actual width and height
	var height = my.max_z * 2;
	while(1)
	{
		if(width > screen_size.x)  //depending on what needs to fit into the screen
			scale = screen_size.x/width;
		if(height > screen_size.y)
			scale = screen_size.y/height;
		vec_fill(my.scale_x,scale);		
		wait(1);
	}
}


int level=0;
function level_load_sample()
{
	if(level==0)//landscape sample
	{
		if(slayt_ent!=NULL)
		{
			ent_remove(slayt_ent);
		}
		slayt_ent=ent_create("slaytent.png",vector(100,0,0),slayt_ent_act);//create slayt_entity (slaytent.png)
		ent_morph(slayt_ent,"wall_landscape.jpg");// change wallpaper
		slayt_ent.image_type=landscape;
		level=1;
		return;
	}
	if(level==1)// portrait sample
	{
		if(slayt_ent!=NULL)
		{
			ent_remove(slayt_ent);
		}
		slayt_ent=ent_create("slaytent.png",vector(100,0,0),slayt_ent_act);//create slayt_entity (slaytent.png)
		ent_morph(slayt_ent,"wall_portrait.jpg");// change wallpaper
		slayt_ent.image_type=portrait; 
		level=0;
		return;
	}
}

function main()
{
	fps_max=75;
	video_mode=9;
	video_screen=2;
	wait(3);
	level_load("");
	set(camera,ISOMETRIC); //needed to have a flat projection
	camera.arc = 53; //the estimated arc for the same height/screensize dimension
	
	level_load_sample();
	on_enter= level_load_sample;
	
	while(1)
	{
		draw_text("Press Enter to change wallpaper",screen_size.x-500,20,COLOR_RED);
		wait(1);
	}
}


Last edited by alibaba; 03/24/20 10:08.

Professional Edition
A8.47.1
--------------------
http://www.yueklet.de