Replies: 3 comments 23 replies
-
I would repeat the question for Gl(u)Window feature, but didn't start a separate thread. |
Beta Was this translation helpful? Give feedback.
-
Yes. Recent Zig versions don't support older Windows versions so OpenGL is assumed to always be present. In Rust it's not the situation since on Windows 7, OpenGL support is patchy, and Rust still supports Windows 7. On Linux, OpenGL support requires the installation of a library, so it's always possible, even without hardware acceleration support.
Zfltk doesn't link libgtk on wayland already. fltk-rs used to link it because it was previously required by libdecor.
I haven't tried it yet, but OpenGL drawing should be supported. The default is a black window, unless you setBox(.flat) and setColor() to something: // modified simple example
const zfltk = @import("zfltk");
const app = zfltk.app;
const GlutWindow = zfltk.GlutWindow;
const Button = zfltk.Button;
const Box = zfltk.Box;
const Color = zfltk.enums.Color;
fn butCb(but: *Button(.normal), data: ?*anyopaque) void {
var box = Box.fromRaw(data.?);
box.setLabel("Hello World!");
but.setColor(Color.fromName(.cyan));
}
pub fn main() !void {
try app.init();
app.setScheme(.gtk);
var win = try GlutWindow.init(.{
.w = 400,
.h = 300,
.label = "Hello",
});
win.setBox(.flat);
win.setColor(Color.fromName(.background));
win.begin();
var but = try Button(.normal).init(.{
.x = 160,
.y = 220,
.w = 80,
.h = 40,
.label = "Click me!",
});
but.setDownBox(.flat);
var box = try Box.init(.{
.x = 10,
.y = 10,
.w = 380,
.h = 180,
.boxtype = .up,
});
box.setLabelFont(.courier);
box.setLabelSize(18);
win.end();
win.show();
but.setCallbackEx(butCb, box);
try app.run();
} |
Beta Was this translation helpful? Give feedback.
-
It's optional.
It's supported in fltk-rs via setting an env variable CFLTK_WAYLAND_ONLY which will basically set FLTK's OPTION_WAYLAND_ONLY=OFF during the build. Zfltk doesn't have such an option yet. |
Beta Was this translation helpful? Give feedback.
-
What
Do you have an idea how to support Wayland in build.zig? Maybe it's difficult to mirror what we have with cargo features.
Why
I run a pure Wayland desktop and don't have Xwayland installed.
Beta Was this translation helpful? Give feedback.
All reactions