Implemented getMonitorScale
This commit is contained in:
parent
68e1402260
commit
e53d1dd0aa
@ -98,6 +98,19 @@ pub fn Window(comptime TUserData: type) type {
|
||||
pub fn setViewport(self: Window(TUserData), offset_x: u32, offset_y: u32, width: u32, height: u32) bool {
|
||||
return c.mfb_set_viewport(self.cwin, offset_x, offset_y, width, height);
|
||||
}
|
||||
|
||||
pub const MonitorScale = struct {
|
||||
x: f32,
|
||||
y: f32,
|
||||
};
|
||||
pub fn getMonitorScale(self: Window(TUserData)) MonitorScale {
|
||||
var scale = MonitorScale{
|
||||
.x = undefined,
|
||||
.y = undefined,
|
||||
};
|
||||
c.mfb_get_monitor_scale(self.cwin, &scale.x, &scale.y);
|
||||
return scale;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -140,6 +140,8 @@ pub fn main() !void {
|
||||
defer state.deinit();
|
||||
|
||||
var win = mfb.Window(State).open("Hello minifb-zig", Width, Height, .{ .resizable = true, .alwaysOnTop = true }) catch unreachable;
|
||||
const scale = win.getMonitorScale();
|
||||
std.log.info("Monitor scale: {d} * {d}", .{scale.x, scale.y});
|
||||
mfb.setTargetFPS(30);
|
||||
win.setUserData(&state);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user