Improve default ui scale
This commit is contained in:
@@ -83,11 +83,13 @@ id get_metal_queue(void) {
|
|||||||
void iron_display_init(void) {}
|
void iron_display_init(void) {}
|
||||||
|
|
||||||
iron_display_mode_t iron_display_current_mode(int display) {
|
iron_display_mode_t iron_display_current_mode(int display) {
|
||||||
|
UIScreen *screen = [UIScreen mainScreen];
|
||||||
iron_display_mode_t dm;
|
iron_display_mode_t dm;
|
||||||
dm.width = iron_window_width();
|
dm.width = iron_window_width();
|
||||||
dm.height = iron_window_height();
|
dm.height = iron_window_height();
|
||||||
dm.frequency = (int)[[UIScreen mainScreen] maximumFramesPerSecond];
|
dm.frequency = (int)screen.maximumFramesPerSecond;
|
||||||
dm.bits_per_pixel = 32;
|
dm.bits_per_pixel = 32;
|
||||||
|
dm.pixels_per_inch = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 326.0f : 460.0f; // Approx
|
||||||
return dm;
|
return dm;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -600,5 +602,4 @@ bool _save_and_quit_callback_internal() {
|
|||||||
|
|
||||||
volatile int iron_exec_async_done = 1;
|
volatile int iron_exec_async_done = 1;
|
||||||
|
|
||||||
void iron_exec_async(const char *path, char *argv[]) {
|
void iron_exec_async(const char *path, char *argv[]) {}
|
||||||
}
|
|
||||||
|
|||||||
+2
-2
@@ -1223,8 +1223,8 @@ buffer_t *iron_load_blob(string_t *file) {
|
|||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
i32 iron_screen_dpi() {
|
i32 iron_display_ppi(i32 index) {
|
||||||
return iron_display_current_mode(iron_primary_display()).pixels_per_inch;
|
return iron_display_current_mode(index).pixels_per_inch;
|
||||||
}
|
}
|
||||||
|
|
||||||
i32 iron_display_width(i32 index) {
|
i32 iron_display_width(i32 index) {
|
||||||
|
|||||||
@@ -259,10 +259,10 @@ declare function iron_window_get_mode(): i32;
|
|||||||
declare function iron_window_change_mode(mode: i32): void;
|
declare function iron_window_change_mode(mode: i32): void;
|
||||||
declare function iron_window_resize(width: i32, height: i32): void;
|
declare function iron_window_resize(width: i32, height: i32): void;
|
||||||
declare function iron_window_move(x: i32, y: i32): void;
|
declare function iron_window_move(x: i32, y: i32): void;
|
||||||
declare function iron_screen_dpi(): i32;
|
|
||||||
declare function iron_system_id(): string;
|
declare function iron_system_id(): string;
|
||||||
declare function iron_stop(): void;
|
declare function iron_stop(): void;
|
||||||
declare function iron_count_displays(): i32;
|
declare function iron_count_displays(): i32;
|
||||||
|
declare function iron_display_ppi(index: i32): i32;
|
||||||
declare function iron_display_width(index: i32): i32;
|
declare function iron_display_width(index: i32): i32;
|
||||||
declare function iron_display_height(index: i32): i32;
|
declare function iron_display_height(index: i32): i32;
|
||||||
declare function iron_display_x(index: i32): i32;
|
declare function iron_display_x(index: i32): i32;
|
||||||
|
|||||||
@@ -260,6 +260,10 @@ function sys_display_frequency(): i32 {
|
|||||||
return iron_display_frequency(sys_display_primary_id());
|
return iron_display_frequency(sys_display_primary_id());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sys_display_ppi(): i32 {
|
||||||
|
return iron_display_ppi(sys_display_primary_id());
|
||||||
|
}
|
||||||
|
|
||||||
function sys_buffer_to_string(b: buffer_t): string {
|
function sys_buffer_to_string(b: buffer_t): string {
|
||||||
let str: string = string_alloc(b.length + 1);
|
let str: string = string_alloc(b.length + 1);
|
||||||
memcpy(str, b.buffer, b.length);
|
memcpy(str, b.buffer, b.length);
|
||||||
|
|||||||
@@ -150,6 +150,11 @@ function config_init() {
|
|||||||
/// if (arm_android || arm_ios || arm_macos)
|
/// if (arm_android || arm_ios || arm_macos)
|
||||||
config_raw.window_scale = 2.0;
|
config_raw.window_scale = 2.0;
|
||||||
/// end
|
/// end
|
||||||
|
/// if (arm_android || arm_ios)
|
||||||
|
if (sys_display_ppi() > 330) {
|
||||||
|
config_raw.window_scale = 2.5;
|
||||||
|
}
|
||||||
|
/// end
|
||||||
config_raw.window_vsync = true;
|
config_raw.window_vsync = true;
|
||||||
config_raw.window_frequency = sys_display_frequency();
|
config_raw.window_frequency = sys_display_frequency();
|
||||||
config_raw.rp_bloom = false;
|
config_raw.rp_bloom = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user