~ntgg/snake-zig

a5d2874ffb9c29eeec3a6fd430e21bbc93ae0948 — Noah Graff 6 months ago 890d784
removed clap stuff, because zig can't comple it
4 files changed, 0 insertions(+), 84 deletions(-)

D .gitmodules
M build.zig
M src/main.zig
D vendor/clap
D .gitmodules => .gitmodules +0 -3
@@ 1,3 0,0 @@
[submodule "vendor/clap"]
	path = vendor/clap
	url = https://github.com/Hejsil/zig-clap.git

M build.zig => build.zig +0 -2
@@ 7,8 7,6 @@ pub fn build(b: *Builder) void {
    exe.setBuildMode(mode);
    exe.setTheTarget(target);

    exe.addPackagePath("clap", "vendor/clap/clap.zig");

    exe.addIncludeDir("stb_image");
    exe.addCSourceFile("stb_image/stb_image_impl.c", [_][]const u8{"-std=c99"});
    exe.linkSystemLibrary("c");

M src/main.zig => src/main.zig +0 -78
@@ 1,6 1,5 @@
const std = @import("std");
const ArrayList = std.ArrayList;
const clap = @import("clap");
const c = @import("c.zig");
const panic = std.debug.panic;
const AllShaders = @import("shaders.zig").AllShaders;


@@ 28,83 27,6 @@ const default_window_width = 800;
const default_window_height = 800;

pub fn main() anyerror!void {
    // there is a compiler error with zig when compiling clap's ComptimeClap struct.
    // will implement later. Most of this is probably wrong
    //
    // const params = [_]clap.Param([]const u8){
    //     clap.Param([]const u8){
    //         .id = "Show help and exit",
    //         .names = clap.Names{ .short = 'h', .long = "help" },
    //     },
    //     clap.Param([]const u8){
    //         .id = "Window width",
    //         .names = clap.Names{ .long = "window-width" },
    //         .takes_value = true,
    //     },
    //     clap.Param([]const u8){
    //         .id = "Window height",
    //         .names = clap.Names{ .long = "window-height" },
    //         .takes_value = true,
    //     },
    //     clap.Param([]const u8){
    //         .id = "Grid width",
    //         .names = clap.Names{ .short = 'w', .long = "grid-width" },
    //         .takes_value = true,
    //     },
    //     clap.Param([]const u8){
    //         .id = "Grid height",
    //         .names = clap.Names{ .short = 'h', .long = "grid-height" },
    //         .takes_value = true,
    //     },
    // };

    // const args = init: {
    //     var iter = clap.args.OsIterator.init(c_allocator);
    //     defer iter.deinit();
    //     // skip exe path
    //     _ = try iter.next();
    //     break :init clap.ComptimeClap([]const u8, params).parse(c_allocator, clap.args.OsIterator, &iter);
    // };
    // defer args.deinit();

    // if (args.flag("--help")) {
    //     const stdout = init: {
    //         const file = try std.io.getStdOut();
    //         break :init file.outStream().stream;
    //     };
    //     try clap.help(stdout, params);
    //     return;
    // }

    // const grid_width = if (args.option("--grid-width")) |width| {
    //     std.fmt.parseInt(usize, width, 10) catch |err| {
    //         std.debug.warn("Could not parse grid-width, goind with default width {}", default_grid_width);
    //         default_grid_width;
    //     };
    // } else default_grid_width;

    // const grid_height = if (args.option("--grid-height")) |height| {
    //     std.fmt.parseInt(usize, height, 10) catch |err| {
    //         std.debug.warn("Could not parse grid-height, goind with default height {}", default_grid_height);
    //         default_grid_height;
    //     };
    // } else default_grid_height;

    // const window_width = if (args.option("--grid-height")) |height| {
    //     std.fmt.parseInt(usize, height, 10) catch |err| {
    //         std.debug.warn("Could not parse grid-height, goind with default width {}", default_window_width);
    //         default_window_width;
    //     };
    // } else default_window_width;

    // const window_height = if (args.option("--window-height")) |height| {
    //     std.fmt.parseInt(usize, height, 10) catch |err| {
    //         std.debug.warn("Could not parse window-height, goind with default height {}", default_window_height);
    //         default_window_height;
    //     };
    // } else default_window_height;

    // var ctx = Context.init(grid_width, grid_height, window_width, window_height);
    var ctx = Context.init(8, 8, 800, 800);
    defer ctx.deinit();
    _ = c.glfwSetKeyCallback(ctx.window, keyCallback);

D vendor/clap => vendor/clap +0 -1
@@ 1,1 0,0 @@
Subproject commit 56e7be2835311888ef43f403e5d6bc2118c953fe