make input coordinates respect the viewport
This commit is contained in:
@ -354,25 +354,7 @@ void render(void) {
|
||||
|
||||
/* fit rendering context onto the resizable screen */
|
||||
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(
|
||||
(int)ctx.window_dims.x / 2 - w / 2,
|
||||
0,
|
||||
w,
|
||||
(int)ctx.window_dims.y
|
||||
);
|
||||
} else {
|
||||
float ratio = (float)ctx.window_dims.x / (float)ctx.base_render_width;
|
||||
int h = (int)((float)ctx.base_render_height * ratio);
|
||||
setup_viewport(
|
||||
0,
|
||||
(int)ctx.window_dims.y / 2 - h / 2,
|
||||
(int)ctx.window_dims.x,
|
||||
h
|
||||
);
|
||||
}
|
||||
setup_viewport((int)ctx.viewport_rect.x, (int)ctx.viewport_rect.y, (int)ctx.viewport_rect.w, (int)ctx.viewport_rect.h);
|
||||
}
|
||||
|
||||
start_render_frame(); {
|
||||
|
Reference in New Issue
Block a user