Aspect ration and ISOMETRIC view

Posted By: 3run

Aspect ration and ISOMETRIC view - 07/11/17 10:52

Hey

I'm trying to keep proper view boarders (left, right, top, bottom) for my ISOMETRIC view, when I change screen resolution (other ways view get's a bit stretched), but with no luck. Maybe you guys have ideas how do I get this done? Where do I dig?

Code:
var cam_x_boarder = 800;
var cam_y_boarder = 600;
var cam_dist_factor = 0.4;

camera->left = -cam_x_boarder * cam_dist_factor;
camera->right = cam_x_boarder * cam_dist_factor;
camera->bottom = -cam_y_boarder * cam_dist_factor;
camera->top = cam_y_boarder * cam_dist_factor;


Thank you in advance.
Greets.
Posted By: Superku

Re: Aspect ration and ISOMETRIC view - 07/11/17 13:44

Only pick one size/ use one variable instead of separating x and y, then multiply the other view border dimension by screen_size.x/screen_size.y or y/x.
Posted By: 3run

Re: Aspect ration and ISOMETRIC view - 07/11/17 14:34

What I did is this (if I got this part correct - "then multiply the other view border dimension"):
Code:
camera->left = -cam_boarder * (screen_size.x / screen_size.y);
camera->right = cam_boarder * (screen_size.x / screen_size.y);
camera->bottom = -cam_boarder * (screen_size.x / screen_size.y);
camera->top = cam_boarder * (screen_size.x / screen_size.y);



But it doesn't fix my problem, here are the results:
Quote:
1024x768

1280x800:


Greets!
Posted By: Superku

Re: Aspect ration and ISOMETRIC view - 07/11/17 14:41

Only multiply the values of either the (left,right) or (bottom,top) dimension.
When you take the factor (screen_size.x / screen_size.y) for example it should be like this if I'm not mistaken:

camera->left = -cam_boarder * (screen_size.x / screen_size.y);
camera->right = cam_boarder * (screen_size.x / screen_size.y);
camera->bottom = -cam_boarder;
camera->top = cam_boarder;
Posted By: 3run

Re: Aspect ration and ISOMETRIC view - 07/11/17 16:15

It works like a charm! Thank you very much, man! laugh
© 2024 lite-C Forums