From a7fa7755de3b677e9cadca0e65d9743336f4f0a7 Mon Sep 17 00:00:00 2001 From: sacredbirdman <43012733+sacredbirdman@users.noreply.github.com> Date: Mon, 27 Apr 2020 20:43:42 +0300 Subject: [PATCH] zig 0.6.0 compatibility --- ReadMe.md | 4 ++-- build.zig | 2 +- examples/core/2d_camera.zig | 14 +++++++------- examples/core/basic_window.zig | 6 +++--- examples/core/input_keys.zig | 4 ++-- examples/core/input_mouse.zig | 4 ++-- examples/core/input_mouse_wheel.zig | 6 +++--- examples/core/input_multitouch.zig | 8 ++++---- examples/models/models_loading.zig | 20 ++++++++++---------- lib/raylib-zig-math.zig | 2 +- 10 files changed, 35 insertions(+), 35 deletions(-) diff --git a/ReadMe.md b/ReadMe.md index 130f172..893f77b 100755 --- a/ReadMe.md +++ b/ReadMe.md @@ -14,7 +14,7 @@ pub fn main() anyerror!void const screenWidth = 800; const screenHeight = 450; - InitWindow(screenWidth, screenHeight, c"MyWindow"); + InitWindow(screenWidth, screenHeight, "MyWindow"); SetTargetFPS(60); // Set our game to run at 60 frames-per-second //-------------------------------------------------------------------------------------- @@ -28,7 +28,7 @@ pub fn main() anyerror!void ClearBackground(WHITE); - DrawText(c"Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY); + DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY); EndDrawing(); //---------------------------------------------------------------------------------- diff --git a/build.zig b/build.zig index 06071c4..f0bd440 100755 --- a/build.zig +++ b/build.zig @@ -1,6 +1,6 @@ // // build -// Zig version: 0.5.0 +// Zig version: 0.6.0 // Author: Nikolas Wipper // Date: 2020-02-15 // diff --git a/examples/core/2d_camera.zig b/examples/core/2d_camera.zig index 534951c..e186693 100755 --- a/examples/core/2d_camera.zig +++ b/examples/core/2d_camera.zig @@ -17,7 +17,7 @@ pub fn main() anyerror!void const screenWidth = 800; const screenHeight = 450; - InitWindow(screenWidth, screenHeight, c"raylib-zig [core] example - 2d camera"); + InitWindow(screenWidth, screenHeight, "raylib-zig [core] example - 2d camera"); var player = Rectangle { .x = 400, .y = 280, .width = 40, .height = 40 }; var buildings: [MAX_BUILDINGS]Rectangle = undefined; @@ -107,7 +107,7 @@ pub fn main() anyerror!void EndMode2D(); - DrawText(c"SCREEN AREA", 640, 10, 20, RED); + DrawText("SCREEN AREA", 640, 10, 20, RED); DrawRectangle(0, 0, screenWidth, 5, RED); DrawRectangle(0, 5, 5, screenHeight - 10, RED); @@ -117,11 +117,11 @@ pub fn main() anyerror!void DrawRectangle( 10, 10, 250, 113, Fade(SKYBLUE, 0.5)); DrawRectangleLines( 10, 10, 250, 113, BLUE); - DrawText(c"Free 2d camera controls:", 20, 20, 10, BLACK); - DrawText(c"- Right/Left to move Offset", 40, 40, 10, DARKGRAY); - DrawText(c"- Mouse Wheel to Zoom in-out", 40, 60, 10, DARKGRAY); - DrawText(c"- A / S to Rotate", 40, 80, 10, DARKGRAY); - DrawText(c"- R to reset Zoom and Rotation", 40, 100, 10, DARKGRAY); + DrawText("Free 2d camera controls:", 20, 20, 10, BLACK); + DrawText("- Right/Left to move Offset", 40, 40, 10, DARKGRAY); + DrawText("- Mouse Wheel to Zoom in-out", 40, 60, 10, DARKGRAY); + DrawText("- A / S to Rotate", 40, 80, 10, DARKGRAY); + DrawText("- R to reset Zoom and Rotation", 40, 100, 10, DARKGRAY); EndDrawing(); //---------------------------------------------------------------------------------- diff --git a/examples/core/basic_window.zig b/examples/core/basic_window.zig index a884da5..24e7103 100755 --- a/examples/core/basic_window.zig +++ b/examples/core/basic_window.zig @@ -1,6 +1,6 @@ // // basic_window -// Zig version: 0.5.0 +// Zig version: 0.6.0 // Author: Nikolas Wipper // Date: 2020-02-15 // @@ -14,7 +14,7 @@ pub fn main() anyerror!void const screenWidth = 800; const screenHeight = 450; - InitWindow(screenWidth, screenHeight, c"raylib-zig [core] example - basic window"); + InitWindow(screenWidth, screenHeight, "raylib-zig [core] example - basic window"); SetTargetFPS(60); // Set our game to run at 60 frames-per-second //-------------------------------------------------------------------------------------- @@ -33,7 +33,7 @@ pub fn main() anyerror!void ClearBackground(WHITE); - DrawText(c"Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY); + DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY); EndDrawing(); //---------------------------------------------------------------------------------- diff --git a/examples/core/input_keys.zig b/examples/core/input_keys.zig index 58d3567..149a3b7 100755 --- a/examples/core/input_keys.zig +++ b/examples/core/input_keys.zig @@ -14,7 +14,7 @@ pub fn main() anyerror!void const screenWidth = 800; const screenHeight = 450; - InitWindow(screenWidth, screenHeight, c"raylib-zig [core] example - keyboard input"); + InitWindow(screenWidth, screenHeight, "raylib-zig [core] example - keyboard input"); var ballPosition = Vector2 { .x = screenWidth/2, .y = screenHeight/2 }; @@ -38,7 +38,7 @@ pub fn main() anyerror!void ClearBackground(RAYWHITE); - DrawText(c"move the ball with arrow keys", 10, 10, 20, DARKGRAY); + DrawText("move the ball with arrow keys", 10, 10, 20, DARKGRAY); DrawCircle(@floatToInt(c_int, ballPosition.x), @floatToInt(c_int, ballPosition.y), 50, MAROON); //DrawCircleV(ballPosition, 50, MAROON); diff --git a/examples/core/input_mouse.zig b/examples/core/input_mouse.zig index 460fdfd..b88ba25 100755 --- a/examples/core/input_mouse.zig +++ b/examples/core/input_mouse.zig @@ -14,7 +14,7 @@ pub fn main() anyerror!void const screenWidth = 800; const screenHeight = 450; - InitWindow(screenWidth, screenHeight, c"raylib-zig [core] example - mouse input"); + InitWindow(screenWidth, screenHeight, "raylib-zig [core] example - mouse input"); var ballPosition = Vector2 { .x = -100.0, .y = -100.0 }; var ballColor = DARKBLUE; @@ -43,7 +43,7 @@ pub fn main() anyerror!void DrawCircle(@floatToInt(c_int, ballPosition.x), @floatToInt(c_int, ballPosition.y), 50, ballColor); //DrawCircleV(ballPosition, 40, ballColor); - DrawText(c"move ball with mouse and click mouse button to change color", 10, 10, 20, DARKGRAY); + DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, DARKGRAY); EndDrawing(); //---------------------------------------------------------------------------------- diff --git a/examples/core/input_mouse_wheel.zig b/examples/core/input_mouse_wheel.zig index 22b8322..42cc419 100755 --- a/examples/core/input_mouse_wheel.zig +++ b/examples/core/input_mouse_wheel.zig @@ -14,7 +14,7 @@ pub fn main() anyerror!void const screenWidth = 800; const screenHeight = 450; - InitWindow(screenWidth, screenHeight, c"raylib-zig [core] example - basic window"); + InitWindow(screenWidth, screenHeight, "raylib-zig [core] example - basic window"); var boxPositionY: i32 = screenHeight / 2 - 40; var scrollSpeed: i32 = 4; // Scrolling speed in pixels @@ -38,8 +38,8 @@ pub fn main() anyerror!void DrawRectangle(screenWidth/2 - 40, boxPositionY, 80, 80, MAROON); - DrawText(c"Use mouse wheel to move the cube up and down!", 10, 10, 20, GRAY); - DrawText(FormatText(c"Box position Y: %03i", boxPositionY), 10, 40, 20, LIGHTGRAY); + DrawText("Use mouse wheel to move the cube up and down!", 10, 10, 20, GRAY); + DrawText(FormatText("Box position Y: %03i", boxPositionY), 10, 40, 20, LIGHTGRAY); EndDrawing(); //---------------------------------------------------------------------------------- diff --git a/examples/core/input_multitouch.zig b/examples/core/input_multitouch.zig index 6068ef4..24d0765 100755 --- a/examples/core/input_multitouch.zig +++ b/examples/core/input_multitouch.zig @@ -14,7 +14,7 @@ pub fn main() anyerror!void const screenWidth = 800; const screenHeight = 450; - InitWindow(screenWidth, screenHeight, c"raylib-zig [core] example - basic window"); + InitWindow(screenWidth, screenHeight, "raylib-zig [core] example - basic window"); var ballPosition = Vector2 { .x = -100.0, .y = -100.0 }; var ballColor = BEIGE; @@ -61,7 +61,7 @@ pub fn main() anyerror!void // Draw circle and touch index number DrawCircle(@floatToInt(c_int, touchPosition.x), @floatToInt(c_int, touchPosition.y), 34, ORANGE); //DrawCircleV(touchPosition, 34, ORANGE); - DrawText(FormatText(c"%d", i), @floatToInt(c_int, touchPosition.x) - 10, @floatToInt(c_int, touchPosition.y) - 70, 40, BLACK); + DrawText(FormatText("%d", i), @floatToInt(c_int, touchPosition.x) - 10, @floatToInt(c_int, touchPosition.y) - 70, 40, BLACK); } } @@ -69,8 +69,8 @@ pub fn main() anyerror!void DrawCircle(@floatToInt(c_int, ballPosition.x), @floatToInt(c_int, ballPosition.y), 30 + (touchCounter*3), ballColor); //DrawCircleV(ballPosition, 30 + (touchCounter*3), ballColor); - DrawText(c"move ball with mouse and click mouse button to change color", 10, 10, 20, DARKGRAY); - DrawText(c"touch the screen at multiple locations to get multiple balls", 10, 30, 20, DARKGRAY); + DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, DARKGRAY); + DrawText("touch the screen at multiple locations to get multiple balls", 10, 30, 20, DARKGRAY); EndDrawing(); //---------------------------------------------------------------------------------- diff --git a/examples/models/models_loading.zig b/examples/models/models_loading.zig index 20eee69..83dfd02 100755 --- a/examples/models/models_loading.zig +++ b/examples/models/models_loading.zig @@ -14,7 +14,7 @@ pub fn main() anyerror!void const screenWidth = 800; const screenHeight = 450; - InitWindow(screenWidth, screenHeight, c"raylib [models] example - models loading"); + InitWindow(screenWidth, screenHeight, "raylib [models] example - models loading"); // Define the camera to look into our 3d world var camera = Camera { @@ -25,8 +25,8 @@ pub fn main() anyerror!void .type = CameraType.CAMERA_PERSPECTIVE // Camera mode type }; - var model = LoadModel(c"resources/models/castle.obj"); // Load model - var texture = LoadTexture(c"resources/models/castle_diffuse.png"); // Load model texture + var model = LoadModel("resources/models/castle.obj"); // Load model + var texture = LoadTexture("resources/models/castle_diffuse.png"); // Load model texture model.materials[0].maps[@enumToInt(MAP_DIFFUSE)].texture = texture; // Set map diffuse texture var position = Vector3 { .x = 0.0, .y = 0.0, .z = 0.0 }; // Set model position @@ -58,9 +58,9 @@ pub fn main() anyerror!void if (count == 1) // Only support one file dropped { - if (IsFileExtension(droppedFiles[0], c".obj") or - IsFileExtension(droppedFiles[0], c".gltf") or - IsFileExtension(droppedFiles[0], c".iqm")) // Model file formats supported + if (IsFileExtension(droppedFiles[0], ".obj") or + IsFileExtension(droppedFiles[0], ".gltf") or + IsFileExtension(droppedFiles[0], ".iqm")) // Model file formats supported { UnloadModel(model); // Unload previous model model = LoadModel(droppedFiles[0]); // Load new model @@ -70,7 +70,7 @@ pub fn main() anyerror!void // TODO: Move camera position from target enough distance to visualize model properly } - else if (IsFileExtension(droppedFiles[0], c".png")) // Texture file formats supported + else if (IsFileExtension(droppedFiles[0], ".png")) // Texture file formats supported { // Unload current model texture and load new one UnloadTexture(texture); @@ -113,10 +113,10 @@ pub fn main() anyerror!void EndMode3D(); - DrawText(c"Drag & drop model to load mesh/texture.", 10, GetScreenHeight() - 20, 10, DARKGRAY); - if (selected) DrawText(c"MODEL SELECTED", GetScreenWidth() - 110, 10, 10, GREEN); + DrawText("Drag & drop model to load mesh/texture.", 10, GetScreenHeight() - 20, 10, DARKGRAY); + if (selected) DrawText("MODEL SELECTED", GetScreenWidth() - 110, 10, 10, GREEN); - DrawText(c"(c) Castle 3D model by Alberto Cano", screenWidth - 200, screenHeight - 20, 10, GRAY); + DrawText("(c) Castle 3D model by Alberto Cano", screenWidth - 200, screenHeight - 20, 10, GRAY); DrawFPS(10, 10); diff --git a/lib/raylib-zig-math.zig b/lib/raylib-zig-math.zig index d5c38d3..0fc709c 100755 --- a/lib/raylib-zig-math.zig +++ b/lib/raylib-zig-math.zig @@ -1,6 +1,6 @@ // // rayzig_math -// Zig version: 0.5.0 +// Zig version: 0.6.0 // Author: Nikolas Wipper // Date: 2020-02-15 //