Fix #3 on workaround branch

This commit is contained in:
Not-Nik 2020-05-22 21:05:42 +10:00
parent ae1ab4747e
commit f545110e62
No known key found for this signature in database
GPG Key ID: 08BB71E672DB3BFD
4 changed files with 49 additions and 1 deletions

View File

@ -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 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 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 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"); const examplesStep = b.step("examples", "Builds all the examples");
examplesStep.dependOn(&basicWindow.step); examplesStep.dependOn(&basicWindow.step);

View File

@ -423,6 +423,7 @@ pub const TraceLogType = extern enum(c_int) {
LOG_NONE = 7, LOG_NONE = 7,
}; };
pub const KeyboardKey = extern enum(c_int) { pub const KeyboardKey = extern enum(c_int) {
KEY_NULL = 0,
KEY_APOSTROPHE = 39, KEY_APOSTROPHE = 39,
KEY_COMMA = 44, KEY_COMMA = 44,
KEY_MINUS = 45, KEY_MINUS = 45,

46
tests/del_exit_key.zig Normal file
View File

@ -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
//--------------------------------------------------------------------------------------
}

View File

@ -14,7 +14,7 @@ pub fn main() anyerror!void
const screenWidth = 800; const screenWidth = 800;
const screenHeight = 450; const screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib-zig [core] example - draw sphere"); InitWindow(screenWidth, screenHeight, "raylib-zig [core] test - draw sphere");
var camera = Camera { var camera = Camera {
.position = Vector3 { .x = 0.0, .y = 0.0, .z = 0.0 }, // Camera position .position = Vector3 { .x = 0.0, .y = 0.0, .z = 0.0 }, // Camera position