diff --git a/build.zig b/build.zig index 117bdb7..025cb8f 100755 --- a/build.zig +++ b/build.zig @@ -36,6 +36,7 @@ pub fn build(b: *Builder) void var modelsLoading = createExe(b, "models_loading" , "examples/models/models_loading.zig" , "Loads a model and renders it"); var mouseRay = createExe(b, "draw_2d" , "tests/draw_2d.zig" , "Testing workaround on 2D drawing functions"); var drawSphere = createExe(b, "draw_sphere" , "tests/draw_sphere.zig" , "Testing workaround on DrawSphere"); + var delExitKey = createExe(b, "del_exit_key" , "tests/del_exit_key.zig" , "Testing disabling of exit key"); const examplesStep = b.step("examples", "Builds all the examples"); examplesStep.dependOn(&basicWindow.step); diff --git a/lib/raylib-zig.zig b/lib/raylib-zig.zig index f573066..3824569 100755 --- a/lib/raylib-zig.zig +++ b/lib/raylib-zig.zig @@ -423,6 +423,7 @@ pub const TraceLogType = extern enum(c_int) { LOG_NONE = 7, }; pub const KeyboardKey = extern enum(c_int) { + KEY_NULL = 0, KEY_APOSTROPHE = 39, KEY_COMMA = 44, KEY_MINUS = 45, diff --git a/tests/del_exit_key.zig b/tests/del_exit_key.zig new file mode 100644 index 0000000..c04f41d --- /dev/null +++ b/tests/del_exit_key.zig @@ -0,0 +1,46 @@ +// +// mouse_ray +// Zig version: 0.6.0 +// Author: Nikolas Wipper +// Date: 2020-02-15 +// + +usingnamespace @import("raylib"); + +pub fn main() anyerror!void +{ + // Initialization + //-------------------------------------------------------------------------------------- + const screenWidth = 800; + const screenHeight = 450; + + InitWindow(screenWidth, screenHeight, "raylib-zig [core] test - disable exit key"); + + SetTargetFPS(60); // Set our game to run at 60 frames-per-second + + //SetExitKey(@intToEnum(KeyboardKey, 0)); + SetExitKey(.KEY_NULL); + //-------------------------------------------------------------------------------------- + + // Main game loop + while (!WindowShouldClose()) // Detect window close button or ESC key + { + + // Draw + //---------------------------------------------------------------------------------- + BeginDrawing(); + + ClearBackground(WHITE); + + + + EndDrawing(); + //---------------------------------------------------------------------------------- + } + + // De-Initialization + //-------------------------------------------------------------------------------------- + CloseWindow(); // Close window and OpenGL context + //-------------------------------------------------------------------------------------- +} + diff --git a/tests/draw_sphere.zig b/tests/draw_sphere.zig index 2f9b8f0..ff66dfe 100644 --- a/tests/draw_sphere.zig +++ b/tests/draw_sphere.zig @@ -14,7 +14,7 @@ pub fn main() anyerror!void const screenWidth = 800; const screenHeight = 450; - InitWindow(screenWidth, screenHeight, "raylib-zig [core] example - draw sphere"); + InitWindow(screenWidth, screenHeight, "raylib-zig [core] test - draw sphere"); var camera = Camera { .position = Vector3 { .x = 0.0, .y = 0.0, .z = 0.0 }, // Camera position