Skip to content

Commit

Permalink
use only dpi scale based on x
Browse files Browse the repository at this point in the history
  • Loading branch information
redthing1 committed Oct 12, 2024
1 parent 0b36bfc commit b7f58ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
6 changes: 3 additions & 3 deletions source/re/core.d
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,8 @@ abstract class Core {
private void calculate_render_resolution() {
// since window was resized, update our render resolution
// first get the new window size
auto render_res_x = window.render_width * window.dpi_scale_x;
auto render_res_y = window.render_height * window.dpi_scale_y;
auto render_res_x = window.render_width * window.dpi_scale;
auto render_res_y = window.render_height * window.dpi_scale;

// set mouse scale
auto mouse_scale_factor = 1.0 * scale_factor;
Expand All @@ -373,7 +373,7 @@ abstract class Core {

/// overall scale factor from screen space coordinates to render space
static @property float scale_factor() {
return window.dpi_max_scale * render_oversample_factor;
return window.dpi_scale * render_oversample_factor;
}
}

Expand Down
17 changes: 3 additions & 14 deletions source/re/gfx/window.d
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,8 @@ class Window {
raylib.CloseWindow();
}

public @property float dpi_max_scale() {
auto scale_dpi_vec = raylib.GetWindowScaleDPI();
return max(scale_dpi_vec.x, scale_dpi_vec.y);
}

public @property float dpi_scale_x() {
auto scale_dpi_vec = raylib.GetWindowScaleDPI();
return scale_dpi_vec.x;
}

public @property float dpi_scale_y() {
auto scale_dpi_vec = raylib.GetWindowScaleDPI();
return scale_dpi_vec.y;
public @property float dpi_scale() {
return raylib.GetWindowScaleDPI().x;
}

public @property int screen_width() {
Expand All @@ -73,7 +62,7 @@ class Window {
}

public @property Rectangle screen_bounds() {
return Rectangle(0, 0, screen_width * Core.window.dpi_scale_x, screen_height * Core.window.dpi_scale_y);
return Rectangle(0, 0, screen_width * Core.window.dpi_scale, screen_height * Core.window.dpi_scale);
}

public @property int render_width() {
Expand Down

0 comments on commit b7f58ee

Please sign in to comment.