From c564af4f6184a0b2fff9129dfe46e682cf0e6c9d Mon Sep 17 00:00:00 2001 From: Not-Nik Date: Mon, 10 Jul 2023 00:57:02 +0200 Subject: [PATCH] Move colors into color struct --- examples/core/2d_camera.zig | 34 +++++++------- examples/core/3d_camera_first_person.zig | 22 +++++----- examples/core/basic_window.zig | 4 +- examples/core/input_keys.zig | 6 +-- examples/core/input_mouse.zig | 12 ++--- examples/core/input_mouse_wheel.zig | 8 ++-- examples/core/input_multitouch.zig | 20 ++++----- examples/shaders/texture_outline.zig | 8 ++-- examples/textures/sprite_anim.zig | 22 +++++----- lib/raylib-zig-types.zig | 56 ++++++++++++------------ lib/raylib-zig.zig | 56 ++++++++++++------------ 11 files changed, 124 insertions(+), 124 deletions(-) diff --git a/examples/core/2d_camera.zig b/examples/core/2d_camera.zig index c791d04..87e4881 100755 --- a/examples/core/2d_camera.zig +++ b/examples/core/2d_camera.zig @@ -81,38 +81,38 @@ pub fn main() anyerror!void { //---------------------------------------------------------------------------------- rl.BeginDrawing(); - rl.ClearBackground(rl.RAYWHITE); + rl.ClearBackground(rl.Color.RAYWHITE); camera.begin(); - rl.DrawRectangle(-6000, 320, 13000, 8000, rl.DARKGRAY); + rl.DrawRectangle(-6000, 320, 13000, 8000, rl.Color.DARKGRAY); for (buildings) |building, i| { rl.DrawRectangleRec(building, buildColors[i]); } - rl.DrawRectangleRec(player, rl.RED); + rl.DrawRectangleRec(player, rl.Color.RED); - rl.DrawLine(@floatToInt(c_int, camera.target.x), -screenHeight * 10, @floatToInt(c_int, camera.target.x), screenHeight * 10, rl.GREEN); - rl.DrawLine(-screenWidth * 10, @floatToInt(c_int, camera.target.y), screenWidth * 10, @floatToInt(c_int, camera.target.y), rl.GREEN); + rl.DrawLine(@floatToInt(c_int, camera.target.x), -screenHeight * 10, @floatToInt(c_int, camera.target.x), screenHeight * 10, rl.Color.GREEN); + rl.DrawLine(-screenWidth * 10, @floatToInt(c_int, camera.target.y), screenWidth * 10, @floatToInt(c_int, camera.target.y), rl.Color.GREEN); camera.end(); - rl.DrawText("SCREEN AREA", 640, 10, 20, rl.RED); + rl.DrawText("SCREEN AREA", 640, 10, 20, rl.Color.RED); - rl.DrawRectangle(0, 0, screenWidth, 5, rl.RED); - rl.DrawRectangle(0, 5, 5, screenHeight - 10, rl.RED); - rl.DrawRectangle(screenWidth - 5, 5, 5, screenHeight - 10, rl.RED); - rl.DrawRectangle(0, screenHeight - 5, screenWidth, 5, rl.RED); + rl.DrawRectangle(0, 0, screenWidth, 5, rl.Color.RED); + rl.DrawRectangle(0, 5, 5, screenHeight - 10, rl.Color.RED); + rl.DrawRectangle(screenWidth - 5, 5, 5, screenHeight - 10, rl.Color.RED); + rl.DrawRectangle(0, screenHeight - 5, screenWidth, 5, rl.Color.RED); - rl.DrawRectangle(10, 10, 250, 113, rl.Fade(rl.SKYBLUE, 0.5)); - rl.DrawRectangleLines(10, 10, 250, 113, rl.BLUE); + rl.DrawRectangle(10, 10, 250, 113, rl.Fade(rl.Color.SKYBLUE, 0.5)); + rl.DrawRectangleLines(10, 10, 250, 113, rl.Color.BLUE); - rl.DrawText("Free 2d camera controls:", 20, 20, 10, rl.BLACK); - rl.DrawText("- Right/Left to move Offset", 40, 40, 10, rl.DARKGRAY); - rl.DrawText("- Mouse Wheel to Zoom in-out", 40, 60, 10, rl.DARKGRAY); - rl.DrawText("- A / S to Rotate", 40, 80, 10, rl.DARKGRAY); - rl.DrawText("- R to reset Zoom and Rotation", 40, 100, 10, rl.DARKGRAY); + rl.DrawText("Free 2d camera controls:", 20, 20, 10, rl.Color.BLACK); + rl.DrawText("- Right/Left to move Offset", 40, 40, 10, rl.Color.DARKGRAY); + rl.DrawText("- Mouse Wheel to Zoom in-out", 40, 60, 10, rl.Color.DARKGRAY); + rl.DrawText("- A / S to Rotate", 40, 80, 10, rl.Color.DARKGRAY); + rl.DrawText("- R to reset Zoom and Rotation", 40, 100, 10, rl.Color.DARKGRAY); rl.EndDrawing(); //---------------------------------------------------------------------------------- diff --git a/examples/core/3d_camera_first_person.zig b/examples/core/3d_camera_first_person.zig index fba9201..815d519 100644 --- a/examples/core/3d_camera_first_person.zig +++ b/examples/core/3d_camera_first_person.zig @@ -47,30 +47,30 @@ pub fn main() anyerror!void { //---------------------------------------------------------------------------------- rl.BeginDrawing(); - rl.ClearBackground(rl.RAYWHITE); + rl.ClearBackground(rl.Color.RAYWHITE); camera.begin(); // Draw ground - rl.DrawPlane(rl.Vector3.init(0, 0, 0), rl.Vector2.init(32, 32), rl.LIGHTGRAY); - rl.DrawCube(rl.Vector3.init(-16.0, 2.5, 0.0), 1.0, 5.0, 32.0, rl.BLUE); // Draw a blue wall - rl.DrawCube(rl.Vector3.init(16.0, 2.5, 0.0), 1.0, 5.0, 32.0, rl.LIME); // Draw a green wall - rl.DrawCube(rl.Vector3.init(0.0, 2.5, 16.0), 32.0, 5.0, 1.0, rl.GOLD); // Draw a yellow wall + rl.DrawPlane(rl.Vector3.init(0, 0, 0), rl.Vector2.init(32, 32), rl.Color.LIGHTGRAY); + rl.DrawCube(rl.Vector3.init(-16.0, 2.5, 0.0), 1.0, 5.0, 32.0, rl.Color.BLUE); // Draw a blue wall + rl.DrawCube(rl.Vector3.init(16.0, 2.5, 0.0), 1.0, 5.0, 32.0, rl.Color.LIME); // Draw a green wall + rl.DrawCube(rl.Vector3.init(0.0, 2.5, 16.0), 32.0, 5.0, 1.0, rl.Color.GOLD); // Draw a yellow wall // Draw some cubes around for (heights) |height, i| { rl.DrawCube(positions[i], 2.0, height, 2.0, colors[i]); - rl.DrawCubeWires(positions[i], 2.0, height, 2.0, rl.MAROON); + rl.DrawCubeWires(positions[i], 2.0, height, 2.0, rl.Color.MAROON); } camera.end(); - rl.DrawRectangle(10, 10, 220, 70, rl.Fade(rl.SKYBLUE, 0.5)); - rl.DrawRectangleLines(10, 10, 220, 70, rl.BLUE); + rl.DrawRectangle(10, 10, 220, 70, rl.Fade(rl.Color.SKYBLUE, 0.5)); + rl.DrawRectangleLines(10, 10, 220, 70, rl.Color.BLUE); - rl.DrawText("First person camera default controls:", 20, 20, 10, rl.BLACK); - rl.DrawText("- Move with keys: W, A, S, D", 40, 40, 10, rl.DARKGRAY); - rl.DrawText("- Mouse move to look around", 40, 60, 10, rl.DARKGRAY); + rl.DrawText("First person camera default controls:", 20, 20, 10, rl.Color.BLACK); + rl.DrawText("- Move with keys: W, A, S, D", 40, 40, 10, rl.Color.DARKGRAY); + rl.DrawText("- Mouse move to look around", 40, 60, 10, rl.Color.DARKGRAY); rl.EndDrawing(); //---------------------------------------------------------------------------------- diff --git a/examples/core/basic_window.zig b/examples/core/basic_window.zig index f6c657e..821d44a 100755 --- a/examples/core/basic_window.zig +++ b/examples/core/basic_window.zig @@ -24,9 +24,9 @@ pub fn main() anyerror!void { //---------------------------------------------------------------------------------- rl.BeginDrawing(); - rl.ClearBackground(rl.WHITE); + rl.ClearBackground(rl.Color.WHITE); - rl.DrawText("Congrats! You created your first window!", 190, 200, 20, rl.LIGHTGRAY); + rl.DrawText("Congrats! You created your first window!", 190, 200, 20, rl.Color.LIGHTGRAY); rl.EndDrawing(); //---------------------------------------------------------------------------------- diff --git a/examples/core/input_keys.zig b/examples/core/input_keys.zig index e8b4e61..0fad8d5 100755 --- a/examples/core/input_keys.zig +++ b/examples/core/input_keys.zig @@ -38,11 +38,11 @@ pub fn main() anyerror!void { //---------------------------------------------------------------------------------- rl.BeginDrawing(); - rl.ClearBackground(rl.RAYWHITE); + rl.ClearBackground(rl.Color.RAYWHITE); - rl.DrawText("move the ball with arrow keys", 10, 10, 20, rl.DARKGRAY); + rl.DrawText("move the ball with arrow keys", 10, 10, 20, rl.Color.DARKGRAY); - rl.DrawCircleV(ballPosition, 50, rl.MAROON); + rl.DrawCircleV(ballPosition, 50, rl.Color.MAROON); rl.EndDrawing(); //---------------------------------------------------------------------------------- diff --git a/examples/core/input_mouse.zig b/examples/core/input_mouse.zig index 64bf46e..fca980c 100755 --- a/examples/core/input_mouse.zig +++ b/examples/core/input_mouse.zig @@ -11,7 +11,7 @@ pub fn main() anyerror!void { rl.InitWindow(screenWidth, screenHeight, "raylib-zig [core] example - mouse input"); var ballPosition = rl.Vector2.init(-100, -100); - var ballColor = rl.DARKBLUE; + var ballColor = rl.Color.DARKBLUE; rl.SetTargetFPS(60); // Set our game to run at 60 frames-per-second //-------------------------------------------------------------------------------------- @@ -25,11 +25,11 @@ pub fn main() anyerror!void { ballPosition.y = @intToFloat(f32, rl.GetMouseY()); if (rl.IsMouseButtonPressed(rl.MouseButton.MOUSE_BUTTON_LEFT)) { - ballColor = rl.MAROON; + ballColor = rl.Color.MAROON; } else if (rl.IsMouseButtonPressed(rl.MouseButton.MOUSE_BUTTON_MIDDLE)) { - ballColor = rl.LIME; + ballColor = rl.Color.LIME; } else if (rl.IsMouseButtonPressed(rl.MouseButton.MOUSE_BUTTON_RIGHT)) { - ballColor = rl.DARKBLUE; + ballColor = rl.Color.DARKBLUE; } //---------------------------------------------------------------------------------- @@ -37,12 +37,12 @@ pub fn main() anyerror!void { //---------------------------------------------------------------------------------- rl.BeginDrawing(); - rl.ClearBackground(rl.RAYWHITE); + rl.ClearBackground(rl.Color.RAYWHITE); rl.DrawCircle(@floatToInt(c_int, ballPosition.x), @floatToInt(c_int, ballPosition.y), 50, ballColor); //DrawCircleV(ballPosition, 40, ballColor); - rl.DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, rl.DARKGRAY); + rl.DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, rl.Color.DARKGRAY); rl.EndDrawing(); //---------------------------------------------------------------------------------- diff --git a/examples/core/input_mouse_wheel.zig b/examples/core/input_mouse_wheel.zig index 67c3725..a7b9580 100755 --- a/examples/core/input_mouse_wheel.zig +++ b/examples/core/input_mouse_wheel.zig @@ -27,12 +27,12 @@ pub fn main() anyerror!void { //---------------------------------------------------------------------------------- rl.BeginDrawing(); - rl.ClearBackground(rl.WHITE); + rl.ClearBackground(rl.Color.WHITE); - rl.DrawRectangle(screenWidth / 2 - 40, @floatToInt(c_int, boxPositionY), 80, 80, rl.MAROON); + rl.DrawRectangle(screenWidth / 2 - 40, @floatToInt(c_int, boxPositionY), 80, 80, rl.Color.MAROON); - rl.DrawText("Use mouse wheel to move the cube up and down!", 10, 10, 20, rl.GRAY); - rl.DrawText(rl.TextFormat("Box position Y: %03i", @floatToInt(c_int, boxPositionY)), 10, 40, 20, rl.LIGHTGRAY); + rl.DrawText("Use mouse wheel to move the cube up and down!", 10, 10, 20, rl.Color.GRAY); + rl.DrawText(rl.TextFormat("Box position Y: %03i", @floatToInt(c_int, boxPositionY)), 10, 40, 20, rl.Color.LIGHTGRAY); rl.EndDrawing(); //---------------------------------------------------------------------------------- diff --git a/examples/core/input_multitouch.zig b/examples/core/input_multitouch.zig index 222f0d0..2b86b85 100755 --- a/examples/core/input_multitouch.zig +++ b/examples/core/input_multitouch.zig @@ -11,7 +11,7 @@ pub fn main() anyerror!void { rl.InitWindow(screenWidth, screenHeight, "raylib-zig [core] example - basic window"); var ballPosition = rl.Vector2.init(-100, -100); - var ballColor = rl.BEIGE; + var ballColor = rl.Color.BEIGE; var touchCounter: f32 = 0; var touchPosition = rl.Vector2.init(0, 0); @@ -25,16 +25,16 @@ pub fn main() anyerror!void { //---------------------------------------------------------------------------------- ballPosition = rl.GetMousePosition(); - ballColor = rl.BEIGE; + ballColor = rl.Color.BEIGE; if (rl.IsMouseButtonDown(rl.MouseButton.MOUSE_BUTTON_LEFT)) { - ballColor = rl.MAROON; + ballColor = rl.Color.MAROON; } if (rl.IsMouseButtonDown(rl.MouseButton.MOUSE_BUTTON_MIDDLE)) { - ballColor = rl.LIME; + ballColor = rl.Color.LIME; } if (rl.IsMouseButtonDown(rl.MouseButton.MOUSE_BUTTON_RIGHT)) { - ballColor = rl.DARKBLUE; + ballColor = rl.Color.DARKBLUE; } if (rl.IsMouseButtonPressed(rl.MouseButton.MOUSE_BUTTON_LEFT)) { @@ -56,7 +56,7 @@ pub fn main() anyerror!void { //---------------------------------------------------------------------------------- rl.BeginDrawing(); - rl.ClearBackground(rl.RAYWHITE); + rl.ClearBackground(rl.Color.RAYWHITE); const nums = [_]i32{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; for (nums) |i| { @@ -66,16 +66,16 @@ pub fn main() anyerror!void { if ((touchPosition.x >= 0) and (touchPosition.y >= 0)) { // Draw circle and touch index number - rl.DrawCircleV(touchPosition, 34, rl.ORANGE); - rl.DrawText(rl.TextFormat("%d", i), @floatToInt(c_int, touchPosition.x) - 10, @floatToInt(c_int, touchPosition.y) - 70, 40, rl.BLACK); + rl.DrawCircleV(touchPosition, 34, rl.Color.ORANGE); + rl.DrawText(rl.TextFormat("%d", i), @floatToInt(c_int, touchPosition.x) - 10, @floatToInt(c_int, touchPosition.y) - 70, 40, rl.Color.BLACK); } } // Draw the normal mouse location rl.DrawCircleV(ballPosition, 30 + (touchCounter * 3), ballColor); - rl.DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, rl.DARKGRAY); - rl.DrawText("touch the screen at multiple locations to get multiple balls", 10, 30, 20, rl.DARKGRAY); + rl.DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, rl.Color.DARKGRAY); + rl.DrawText("touch the screen at multiple locations to get multiple balls", 10, 30, 20, rl.Color.DARKGRAY); rl.EndDrawing(); //---------------------------------------------------------------------------------- diff --git a/examples/shaders/texture_outline.zig b/examples/shaders/texture_outline.zig index 2091aea..cfea2be 100644 --- a/examples/shaders/texture_outline.zig +++ b/examples/shaders/texture_outline.zig @@ -49,17 +49,17 @@ pub fn main() anyerror!void { //---------------------------------------------------------------------------------- rl.BeginDrawing(); - rl.ClearBackground(rl.RAYWHITE); + rl.ClearBackground(rl.Color.RAYWHITE); rl.BeginShaderMode(shdrOutline); - rl.DrawTexture(texture, @divFloor(rl.GetScreenWidth(), 2) - @divFloor(texture.width, 2), -30, rl.WHITE); + rl.DrawTexture(texture, @divFloor(rl.GetScreenWidth(), 2) - @divFloor(texture.width, 2), -30, rl.Color.WHITE); rl.EndShaderMode(); - rl.DrawText("Shader-based\ntexture\noutline", 10, 10, 20, rl.GRAY); + rl.DrawText("Shader-based\ntexture\noutline", 10, 10, 20, rl.Color.GRAY); - rl.DrawText(rl.TextFormat("Outline size: %i px", @floatToInt(i32, outlineSize)), 10, 120, 20, rl.MAROON); + rl.DrawText(rl.TextFormat("Outline size: %i px", @floatToInt(i32, outlineSize)), 10, 120, 20, rl.Color.MAROON); rl.DrawFPS(710, 10); diff --git a/examples/textures/sprite_anim.zig b/examples/textures/sprite_anim.zig index 4e41b1c..137ce93 100644 --- a/examples/textures/sprite_anim.zig +++ b/examples/textures/sprite_anim.zig @@ -62,26 +62,26 @@ pub fn main() anyerror!void { //---------------------------------------------------------------------------------- rl.BeginDrawing(); - rl.ClearBackground(rl.RAYWHITE); + rl.ClearBackground(rl.Color.RAYWHITE); - rl.DrawTexture(scarfy, 15, 40, rl.WHITE); - rl.DrawRectangleLines(15, 40, scarfy.width, scarfy.height, rl.LIME); - rl.DrawRectangleLines(15 + @floatToInt(i32, frameRec.x), 40 + @floatToInt(i32, frameRec.y), @floatToInt(i32, frameRec.width), @floatToInt(i32, frameRec.height), rl.RED); + rl.DrawTexture(scarfy, 15, 40, rl.Color.WHITE); + rl.DrawRectangleLines(15, 40, scarfy.width, scarfy.height, rl.Color.LIME); + rl.DrawRectangleLines(15 + @floatToInt(i32, frameRec.x), 40 + @floatToInt(i32, frameRec.y), @floatToInt(i32, frameRec.width), @floatToInt(i32, frameRec.height), rl.Color.RED); - rl.DrawText("FRAME SPEED: ", 165, 210, 10, rl.DARKGRAY); - rl.DrawText(rl.TextFormat("%02i FPS", framesSpeed), 575, 210, 10, rl.DARKGRAY); - rl.DrawText("PRESS RIGHT/LEFT KEYS to CHANGE SPEED!", 290, 240, 10, rl.DARKGRAY); + rl.DrawText("FRAME SPEED: ", 165, 210, 10, rl.Color.DARKGRAY); + rl.DrawText(rl.TextFormat("%02i FPS", framesSpeed), 575, 210, 10, rl.Color.DARKGRAY); + rl.DrawText("PRESS RIGHT/LEFT KEYS to CHANGE SPEED!", 290, 240, 10, rl.Color.DARKGRAY); for ([_]u32{0} ** MAX_FRAME_SPEED) |_, i| { if (i < framesSpeed) { - rl.DrawRectangle(250 + 21 * @intCast(c_int, i), 205, 20, 20, rl.RED); + rl.DrawRectangle(250 + 21 * @intCast(c_int, i), 205, 20, 20, rl.Color.RED); } - rl.DrawRectangleLines(250 + 21 * @intCast(c_int, i), 205, 20, 20, rl.MAROON); + rl.DrawRectangleLines(250 + 21 * @intCast(c_int, i), 205, 20, 20, rl.Color.MAROON); } - rl.DrawTextureRec(scarfy, frameRec, position, rl.WHITE); // Draw part of the texture + rl.DrawTextureRec(scarfy, frameRec, position, rl.Color.WHITE); // Draw part of the texture - rl.DrawText("(c) Scarfy sprite by Eiden Marsal", screenWidth - 200, screenHeight - 20, 10, rl.GRAY); + rl.DrawText("(c) Scarfy sprite by Eiden Marsal", screenWidth - 200, screenHeight - 20, 10, rl.Color.GRAY); rl.EndDrawing(); //---------------------------------------------------------------------------------- diff --git a/lib/raylib-zig-types.zig b/lib/raylib-zig-types.zig index 4451cea..d5be90d 100755 --- a/lib/raylib-zig-types.zig +++ b/lib/raylib-zig-types.zig @@ -58,39 +58,39 @@ pub const Color = extern struct { b: u8, a: u8, + pub const LIGHTGRAY = Color.init(200, 200, 200, 255); + pub const GRAY = Color.init(130, 130, 130, 255); + pub const DARKGRAY = Color.init(80, 80, 80, 255); + pub const YELLOW = Color.init(253, 249, 0, 255); + pub const GOLD = Color.init(255, 203, 0, 255); + pub const ORANGE = Color.init(255, 161, 0, 255); + pub const PINK = Color.init(255, 161, 0, 255); + pub const RED = Color.init(230, 41, 55, 255); + pub const MAROON = Color.init(190, 33, 55, 255); + pub const GREEN = Color.init(0, 228, 48, 255); + pub const LIME = Color.init(0, 158, 47, 255); + pub const DARKGREEN = Color.init(0, 117, 44, 255); + pub const SKYBLUE = Color.init(102, 191, 255, 255); + pub const BLUE = Color.init(0, 121, 241, 255); + pub const DARKBLUE = Color.init(0, 82, 172, 255); + pub const PURPLE = Color.init(200, 122, 255, 255); + pub const VIOLET = Color.init(135, 60, 190, 255); + pub const DARKPURPLE = Color.init(112, 31, 126, 255); + pub const BEIGE = Color.init(211, 176, 131, 255); + pub const BROWN = Color.init(127, 106, 79, 255); + pub const DARKBROWN = Color.init(76, 63, 47, 255); + + pub const WHITE = Color.init(255, 255, 255, 255); + pub const BLACK = Color.init(0, 0, 0, 255); + pub const BLANK = Color.init(0, 0, 0, 0); + pub const MAGENTA = Color.init(255, 0, 255, 255); + pub const RAYWHITE = Color.init(245, 245, 245, 255); + pub fn init(r: u8, g: u8, b: u8, a: u8) Color { return Color{ .r = r, .g = g, .b = b, .a = a }; } }; -pub const LIGHTGRAY = Color.init(200, 200, 200, 255); -pub const GRAY = Color.init(130, 130, 130, 255); -pub const DARKGRAY = Color.init(80, 80, 80, 255); -pub const YELLOW = Color.init(253, 249, 0, 255); -pub const GOLD = Color.init(255, 203, 0, 255); -pub const ORANGE = Color.init(255, 161, 0, 255); -pub const PINK = Color.init(255, 161, 0, 255); -pub const RED = Color.init(230, 41, 55, 255); -pub const MAROON = Color.init(190, 33, 55, 255); -pub const GREEN = Color.init(0, 228, 48, 255); -pub const LIME = Color.init(0, 158, 47, 255); -pub const DARKGREEN = Color.init(0, 117, 44, 255); -pub const SKYBLUE = Color.init(102, 191, 255, 255); -pub const BLUE = Color.init(0, 121, 241, 255); -pub const DARKBLUE = Color.init(0, 82, 172, 255); -pub const PURPLE = Color.init(200, 122, 255, 255); -pub const VIOLET = Color.init(135, 60, 190, 255); -pub const DARKPURPLE = Color.init(112, 31, 126, 255); -pub const BEIGE = Color.init(211, 176, 131, 255); -pub const BROWN = Color.init(127, 106, 79, 255); -pub const DARKBROWN = Color.init(76, 63, 47, 255); - -pub const WHITE = Color.init(255, 255, 255, 255); -pub const BLACK = Color.init(0, 0, 0, 255); -pub const BLANK = Color.init(0, 0, 0, 0); -pub const MAGENTA = Color.init(255, 0, 255, 255); -pub const RAYWHITE = Color.init(245, 245, 245, 255); - pub const Rectangle = extern struct { x: f32, y: f32, diff --git a/lib/raylib-zig.zig b/lib/raylib-zig.zig index a822e98..8137049 100644 --- a/lib/raylib-zig.zig +++ b/lib/raylib-zig.zig @@ -58,39 +58,39 @@ pub const Color = extern struct { b: u8, a: u8, + pub const LIGHTGRAY = Color.init(200, 200, 200, 255); + pub const GRAY = Color.init(130, 130, 130, 255); + pub const DARKGRAY = Color.init(80, 80, 80, 255); + pub const YELLOW = Color.init(253, 249, 0, 255); + pub const GOLD = Color.init(255, 203, 0, 255); + pub const ORANGE = Color.init(255, 161, 0, 255); + pub const PINK = Color.init(255, 161, 0, 255); + pub const RED = Color.init(230, 41, 55, 255); + pub const MAROON = Color.init(190, 33, 55, 255); + pub const GREEN = Color.init(0, 228, 48, 255); + pub const LIME = Color.init(0, 158, 47, 255); + pub const DARKGREEN = Color.init(0, 117, 44, 255); + pub const SKYBLUE = Color.init(102, 191, 255, 255); + pub const BLUE = Color.init(0, 121, 241, 255); + pub const DARKBLUE = Color.init(0, 82, 172, 255); + pub const PURPLE = Color.init(200, 122, 255, 255); + pub const VIOLET = Color.init(135, 60, 190, 255); + pub const DARKPURPLE = Color.init(112, 31, 126, 255); + pub const BEIGE = Color.init(211, 176, 131, 255); + pub const BROWN = Color.init(127, 106, 79, 255); + pub const DARKBROWN = Color.init(76, 63, 47, 255); + + pub const WHITE = Color.init(255, 255, 255, 255); + pub const BLACK = Color.init(0, 0, 0, 255); + pub const BLANK = Color.init(0, 0, 0, 0); + pub const MAGENTA = Color.init(255, 0, 255, 255); + pub const RAYWHITE = Color.init(245, 245, 245, 255); + pub fn init(r: u8, g: u8, b: u8, a: u8) Color { return Color{ .r = r, .g = g, .b = b, .a = a }; } }; -pub const LIGHTGRAY = Color.init(200, 200, 200, 255); -pub const GRAY = Color.init(130, 130, 130, 255); -pub const DARKGRAY = Color.init(80, 80, 80, 255); -pub const YELLOW = Color.init(253, 249, 0, 255); -pub const GOLD = Color.init(255, 203, 0, 255); -pub const ORANGE = Color.init(255, 161, 0, 255); -pub const PINK = Color.init(255, 161, 0, 255); -pub const RED = Color.init(230, 41, 55, 255); -pub const MAROON = Color.init(190, 33, 55, 255); -pub const GREEN = Color.init(0, 228, 48, 255); -pub const LIME = Color.init(0, 158, 47, 255); -pub const DARKGREEN = Color.init(0, 117, 44, 255); -pub const SKYBLUE = Color.init(102, 191, 255, 255); -pub const BLUE = Color.init(0, 121, 241, 255); -pub const DARKBLUE = Color.init(0, 82, 172, 255); -pub const PURPLE = Color.init(200, 122, 255, 255); -pub const VIOLET = Color.init(135, 60, 190, 255); -pub const DARKPURPLE = Color.init(112, 31, 126, 255); -pub const BEIGE = Color.init(211, 176, 131, 255); -pub const BROWN = Color.init(127, 106, 79, 255); -pub const DARKBROWN = Color.init(76, 63, 47, 255); - -pub const WHITE = Color.init(255, 255, 255, 255); -pub const BLACK = Color.init(0, 0, 0, 255); -pub const BLANK = Color.init(0, 0, 0, 0); -pub const MAGENTA = Color.init(255, 0, 255, 255); -pub const RAYWHITE = Color.init(245, 245, 245, 255); - pub const Rectangle = extern struct { x: f32, y: f32,