Allow mfb_open_ex options
This commit is contained in:
@ -20,8 +20,18 @@ pub const Window = struct{
|
||||
|
||||
pub const State = enum {ok, exit};
|
||||
|
||||
pub fn open(title: [*:0]const u8, width: u32, height: u32) !Window {
|
||||
const cwin: ?*minifb_c.mfb_window = minifb_c.mfb_open(@as([*c]const u8, title), width, height);
|
||||
pub const OpenFlags = packed struct {
|
||||
resizable: bool = false,
|
||||
fullscreen: bool = false,
|
||||
fullscreenDesktop: bool = false,
|
||||
borderless: bool = false,
|
||||
alwaysOnTop: bool = false,
|
||||
};
|
||||
|
||||
pub fn open(title: [*:0]const u8, width: u32, height: u32, flags: OpenFlags) !Window {
|
||||
const intFlags: u32 = @bitCast(u5, flags);
|
||||
const cTitle = @as([*c]const u8, title);
|
||||
const cwin: ?*minifb_c.mfb_window = minifb_c.mfb_open_ex(cTitle, width, height, intFlags);
|
||||
if (cwin) |value| {
|
||||
return Window {.cwin=value};
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user