examples, shaderexp: update to new options and size limit API
This commit is contained in:
parent
176554fe4d
commit
7b395759b7
8 changed files with 26 additions and 10 deletions
|
|
@ -33,7 +33,9 @@ const Dir = struct {
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn init(app: *App, engine: *mach.Engine) !void {
|
pub fn init(app: *App, engine: *mach.Engine) !void {
|
||||||
try engine.setSizeLimits(.{ .width = 20, .height = 20 }, .{ .width = null, .height = null });
|
try engine.setOptions(.{
|
||||||
|
.size_min = .{ .width = 20, .height = 20 },
|
||||||
|
});
|
||||||
|
|
||||||
const eye = vec3(5.0, 7.0, 5.0);
|
const eye = vec3(5.0, 7.0, 5.0);
|
||||||
const target = vec3(0.0, 0.0, 0.0);
|
const target = vec3(0.0, 0.0, 0.0);
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,9 @@ bgl: gpu.BindGroupLayout,
|
||||||
pub fn init(app: *App, engine: *mach.Engine) !void {
|
pub fn init(app: *App, engine: *mach.Engine) !void {
|
||||||
timer = try mach.Timer.start();
|
timer = try mach.Timer.start();
|
||||||
|
|
||||||
try engine.setSizeLimits(.{ .width = 20, .height = 20 }, .{ .width = null, .height = null });
|
try engine.setOptions(.{
|
||||||
|
.size_min = .{ .width = 20, .height = 20 },
|
||||||
|
});
|
||||||
|
|
||||||
const vs_module = engine.device.createShaderModule(&.{
|
const vs_module = engine.device.createShaderModule(&.{
|
||||||
.label = "my vertex shader",
|
.label = "my vertex shader",
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,6 @@ const Atlas = @import("atlas.zig").Atlas;
|
||||||
const ft = @import("freetype");
|
const ft = @import("freetype");
|
||||||
const Label = @import("text.zig");
|
const Label = @import("text.zig");
|
||||||
|
|
||||||
pub const options = mach.Options{ .width = 640, .height = 480 };
|
|
||||||
|
|
||||||
pub const App = @This();
|
pub const App = @This();
|
||||||
|
|
||||||
const AtlasRGB8 = Atlas(zigimg.color.Rgba32);
|
const AtlasRGB8 = Atlas(zigimg.color.Rgba32);
|
||||||
|
|
@ -33,7 +31,11 @@ bind_group: gpu.BindGroup,
|
||||||
texture_atlas_data: AtlasRGB8,
|
texture_atlas_data: AtlasRGB8,
|
||||||
|
|
||||||
pub fn init(app: *App, engine: *mach.Engine) !void {
|
pub fn init(app: *App, engine: *mach.Engine) !void {
|
||||||
try engine.setSizeLimits(.{ .width = 20, .height = 20 }, .{ .width = null, .height = null });
|
try engine.setOptions(.{
|
||||||
|
.width = 640,
|
||||||
|
.height = 480,
|
||||||
|
.size_min = .{ .width = 20, .height = 20 },
|
||||||
|
});
|
||||||
|
|
||||||
const queue = engine.device.getQueue();
|
const queue = engine.device.getQueue();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,9 @@ const App = @This();
|
||||||
pub fn init(app: *App, engine: *mach.Engine) !void {
|
pub fn init(app: *App, engine: *mach.Engine) !void {
|
||||||
timer = try mach.Timer.start();
|
timer = try mach.Timer.start();
|
||||||
|
|
||||||
try engine.setSizeLimits(.{ .width = 20, .height = 20 }, .{ .width = null, .height = null });
|
try engine.setOptions(.{
|
||||||
|
.size_min = .{ .width = 20, .height = 20 },
|
||||||
|
});
|
||||||
|
|
||||||
const vs_module = engine.device.createShaderModule(&.{
|
const vs_module = engine.device.createShaderModule(&.{
|
||||||
.label = "my vertex shader",
|
.label = "my vertex shader",
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,9 @@ bind_group: gpu.BindGroup,
|
||||||
pub fn init(app: *App, engine: *mach.Engine) !void {
|
pub fn init(app: *App, engine: *mach.Engine) !void {
|
||||||
timer = try mach.Timer.start();
|
timer = try mach.Timer.start();
|
||||||
|
|
||||||
try engine.setSizeLimits(.{ .width = 20, .height = 20 }, .{ .width = null, .height = null });
|
try engine.setOptions(.{
|
||||||
|
.size_min = .{ .width = 20, .height = 20 },
|
||||||
|
});
|
||||||
|
|
||||||
const vs_module = engine.device.createShaderModule(&.{
|
const vs_module = engine.device.createShaderModule(&.{
|
||||||
.label = "my vertex shader",
|
.label = "my vertex shader",
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,9 @@ const App = @This();
|
||||||
pub fn init(app: *App, engine: *mach.Engine) !void {
|
pub fn init(app: *App, engine: *mach.Engine) !void {
|
||||||
timer = try mach.Timer.start();
|
timer = try mach.Timer.start();
|
||||||
|
|
||||||
try engine.setSizeLimits(.{ .width = 20, .height = 20 }, .{ .width = null, .height = null });
|
try engine.setOptions(.{
|
||||||
|
.size_min = .{ .width = 20, .height = 20 },
|
||||||
|
});
|
||||||
|
|
||||||
const vs_module = engine.device.createShaderModule(&.{
|
const vs_module = engine.device.createShaderModule(&.{
|
||||||
.label = "my vertex shader",
|
.label = "my vertex shader",
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,9 @@ const App = @This();
|
||||||
pub fn init(app: *App, engine: *mach.Engine) !void {
|
pub fn init(app: *App, engine: *mach.Engine) !void {
|
||||||
timer = try mach.Timer.start();
|
timer = try mach.Timer.start();
|
||||||
|
|
||||||
try engine.setSizeLimits(.{ .width = 20, .height = 20 }, .{ .width = null, .height = null });
|
try engine.setOptions(.{
|
||||||
|
.size_min = .{ .width = 20, .height = 20 },
|
||||||
|
});
|
||||||
|
|
||||||
const vs_module = engine.device.createShaderModule(&.{
|
const vs_module = engine.device.createShaderModule(&.{
|
||||||
.label = "my vertex shader",
|
.label = "my vertex shader",
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,9 @@ pub fn init(app: *App, engine: *mach.Engine) !void {
|
||||||
// On linux if we don't set a minimum size, you can squish the window to 0 pixels of width and height,
|
// On linux if we don't set a minimum size, you can squish the window to 0 pixels of width and height,
|
||||||
// this makes some strange effects when that happens, so it's better to leave a minimum size to avoid that,
|
// this makes some strange effects when that happens, so it's better to leave a minimum size to avoid that,
|
||||||
// this doesn't prevent you from minimizing the window.
|
// this doesn't prevent you from minimizing the window.
|
||||||
try engine.setSizeLimits(.{ .width = 20, .height = 20 }, .{ .width = null, .height = null });
|
try engine.setOptions(.{
|
||||||
|
.size_min = .{ .width = 20, .height = 20 },
|
||||||
|
});
|
||||||
|
|
||||||
var fragment_file: std.fs.File = undefined;
|
var fragment_file: std.fs.File = undefined;
|
||||||
var last_mtime: i128 = undefined;
|
var last_mtime: i128 = undefined;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue