{mach,examples,shaderexp}: fix default minimum window size

This commit is contained in:
praschke 2022-09-15 12:46:39 +00:00 committed by Stephen Gutekanst
parent 9676665ccf
commit a873227ab8
11 changed files with 4 additions and 47 deletions

View file

@ -33,10 +33,6 @@ const Dir = struct {
}; };
pub fn init(app: *App, core: *mach.Core) !void { pub fn init(app: *App, core: *mach.Core) !void {
try core.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);

View file

@ -26,10 +26,6 @@ pub const App = @This();
pub fn init(app: *App, core: *mach.Core) !void { pub fn init(app: *App, core: *mach.Core) !void {
timer = try mach.Timer.start(); timer = try mach.Timer.start();
try core.setOptions(.{
.size_min = .{ .width = 20, .height = 20 },
});
const vs_module = core.device.createShaderModuleWGSL("vert.wgsl", @embedFile("vert.wgsl")); const vs_module = core.device.createShaderModuleWGSL("vert.wgsl", @embedFile("vert.wgsl"));
const vertex_attributes = [_]gpu.VertexAttribute{ const vertex_attributes = [_]gpu.VertexAttribute{

View file

@ -41,10 +41,6 @@ bgl: *gpu.BindGroupLayout,
pub fn init(app: *App, core: *mach.Core) !void { pub fn init(app: *App, core: *mach.Core) !void {
timer = try mach.Timer.start(); timer = try mach.Timer.start();
try core.setOptions(.{
.size_min = .{ .width = 20, .height = 20 },
});
const vs_module = core.device.createShaderModuleWGSL("vert.wgsl", @embedFile("vert.wgsl")); const vs_module = core.device.createShaderModuleWGSL("vert.wgsl", @embedFile("vert.wgsl"));
const vertex_attributes = [_]gpu.VertexAttribute{ const vertex_attributes = [_]gpu.VertexAttribute{

View file

@ -32,12 +32,6 @@ bind_group: *gpu.BindGroup,
texture_atlas_data: AtlasRGB8, texture_atlas_data: AtlasRGB8,
pub fn init(app: *App, core: *mach.Core) !void { pub fn init(app: *App, core: *mach.Core) !void {
try core.setOptions(.{
.width = 640,
.height = 480,
.size_min = .{ .width = 20, .height = 20 },
});
const queue = core.device.getQueue(); const queue = core.device.getQueue();
// TODO: Refactor texture atlas size number // TODO: Refactor texture atlas size number

View file

@ -30,10 +30,6 @@ var block_dimension: u32 = tile_dimension - (filter_size - 1);
pub fn init(app: *App, core: *mach.Core) !void { pub fn init(app: *App, core: *mach.Core) !void {
const queue = core.device.getQueue(); const queue = core.device.getQueue();
try core.setOptions(.{
.size_min = .{ .width = 20, .height = 20 },
});
const blur_shader_module = core.device.createShaderModuleWGSL("blur.wgsl", @embedFile("blur.wgsl")); const blur_shader_module = core.device.createShaderModuleWGSL("blur.wgsl", @embedFile("blur.wgsl"));
const blur_pipeline_descriptor = gpu.ComputePipeline.Descriptor{ const blur_pipeline_descriptor = gpu.ComputePipeline.Descriptor{

View file

@ -23,10 +23,6 @@ pub const App = @This();
pub fn init(app: *App, core: *mach.Core) !void { pub fn init(app: *App, core: *mach.Core) !void {
timer = try mach.Timer.start(); timer = try mach.Timer.start();
try core.setOptions(.{
.size_min = .{ .width = 20, .height = 20 },
});
const vs_module = core.device.createShaderModuleWGSL("vert.wgsl", @embedFile("vert.wgsl")); const vs_module = core.device.createShaderModuleWGSL("vert.wgsl", @embedFile("vert.wgsl"));
const vertex_attributes = [_]gpu.VertexAttribute{ const vertex_attributes = [_]gpu.VertexAttribute{

View file

@ -23,10 +23,6 @@ bind_group: *gpu.BindGroup,
pub fn init(app: *App, core: *mach.Core) !void { pub fn init(app: *App, core: *mach.Core) !void {
timer = try mach.Timer.start(); timer = try mach.Timer.start();
try core.setOptions(.{
.size_min = .{ .width = 20, .height = 20 },
});
const vs_module = core.device.createShaderModuleWGSL("vert.wgsl", @embedFile("vert.wgsl")); const vs_module = core.device.createShaderModuleWGSL("vert.wgsl", @embedFile("vert.wgsl"));
const vertex_attributes = [_]gpu.VertexAttribute{ const vertex_attributes = [_]gpu.VertexAttribute{

View file

@ -26,10 +26,6 @@ pub const App = @This();
pub fn init(app: *App, core: *mach.Core) !void { pub fn init(app: *App, core: *mach.Core) !void {
timer = try mach.Timer.start(); timer = try mach.Timer.start();
try core.setOptions(.{
.size_min = .{ .width = 20, .height = 20 },
});
const vs_module = core.device.createShaderModuleWGSL("vert.wgsl", @embedFile("vert.wgsl")); const vs_module = core.device.createShaderModuleWGSL("vert.wgsl", @embedFile("vert.wgsl"));
const vertex_attributes = [_]gpu.VertexAttribute{ const vertex_attributes = [_]gpu.VertexAttribute{

View file

@ -24,10 +24,6 @@ pub const App = @This();
pub fn init(app: *App, core: *mach.Core) !void { pub fn init(app: *App, core: *mach.Core) !void {
timer = try mach.Timer.start(); timer = try mach.Timer.start();
try core.setOptions(.{
.size_min = .{ .width = 20, .height = 20 },
});
const vs_module = core.device.createShaderModuleWGSL("vert.wgsl", @embedFile("vert.wgsl")); const vs_module = core.device.createShaderModuleWGSL("vert.wgsl", @embedFile("vert.wgsl"));
const vertex_attributes = [_]gpu.VertexAttribute{ const vertex_attributes = [_]gpu.VertexAttribute{

View file

@ -24,13 +24,6 @@ last_mtime: i128,
pub fn init(app: *App, core: *mach.Core) !void { pub fn init(app: *App, core: *mach.Core) !void {
timer = try std.time.Timer.start(); timer = try std.time.Timer.start();
// 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 doesn't prevent you from minimizing the window.
try core.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;

View file

@ -25,8 +25,10 @@ pub const Options = struct {
/// The height of the window. /// The height of the window.
height: u32 = 480, height: u32 = 480,
/// The minimum allowed size for the window. /// The minimum allowed size for the window. On Linux, if we don't set a minimum size,
size_min: SizeOptional = .{ .width = null, .height = null }, /// you can squish the window to 0 width and height with strange effects, so it's better to leave
/// a minimum size to avoid that. This doesn't prevent you from minimizing the window.
size_min: SizeOptional = .{ .width = 1, .height = 1 },
/// The maximum allowed size for the window. /// The maximum allowed size for the window.
size_max: SizeOptional = .{ .width = null, .height = null }, size_max: SizeOptional = .{ .width = null, .height = null },