rework to context: now there's engine and user code copies, renaming of fields, most things that shouldn't be there are hidden
This commit is contained in:
@ -250,23 +250,23 @@ void render(void) {
|
||||
textures_update_atlas(&ctx.texture_cache);
|
||||
|
||||
/* fit rendering context onto the resizable screen */
|
||||
if (ctx.game.window_size_has_changed) {
|
||||
if ((float)ctx.game.window_w / (float)ctx.game.window_h > (float)ctx.base_render_width / (float)ctx.base_render_height) {
|
||||
float ratio = (float)ctx.game.window_h / (float)ctx.base_render_height;
|
||||
if (ctx.window_size_has_changed) {
|
||||
if ((float)ctx.window_dims.x / (float)ctx.window_dims.y > (float)ctx.base_render_width / (float)ctx.base_render_height) {
|
||||
float ratio = (float)ctx.window_dims.y / (float)ctx.base_render_height;
|
||||
int w = (int)((float)ctx.base_render_width * ratio);
|
||||
setup_viewport(
|
||||
ctx.game.window_w / 2 - w / 2,
|
||||
ctx.window_dims.x / 2 - w / 2,
|
||||
0,
|
||||
w,
|
||||
ctx.game.window_h
|
||||
ctx.window_dims.y
|
||||
);
|
||||
} else {
|
||||
float ratio = (float)ctx.game.window_w / (float)ctx.base_render_width;
|
||||
float ratio = (float)ctx.window_dims.x / (float)ctx.base_render_width;
|
||||
int h = (int)((float)ctx.base_render_height * ratio);
|
||||
setup_viewport(
|
||||
0,
|
||||
ctx.game.window_h / 2 - h / 2,
|
||||
ctx.game.window_w,
|
||||
ctx.window_dims.y / 2 - h / 2,
|
||||
ctx.window_dims.x,
|
||||
h
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user