Update enum/const name style
This commit is contained in:
parent
e29e012981
commit
7e95ad81b5
12 changed files with 741 additions and 741 deletions
|
|
@ -46,9 +46,9 @@ pub fn main() anyerror!void {
|
|||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Player movement
|
||||
if (rl.isKeyDown(rl.KeyboardKey.KEY_RIGHT)) {
|
||||
if (rl.isKeyDown(rl.KeyboardKey.key_right)) {
|
||||
player.x += 2;
|
||||
} else if (rl.isKeyDown(rl.KeyboardKey.KEY_LEFT)) {
|
||||
} else if (rl.isKeyDown(rl.KeyboardKey.key_left)) {
|
||||
player.x -= 2;
|
||||
}
|
||||
|
||||
|
|
@ -56,9 +56,9 @@ pub fn main() anyerror!void {
|
|||
camera.target = rl.Vector2.init(player.x + 20, player.y + 20);
|
||||
|
||||
// Camera rotation controls
|
||||
if (rl.isKeyDown(rl.KeyboardKey.KEY_A)) {
|
||||
if (rl.isKeyDown(rl.KeyboardKey.key_a)) {
|
||||
camera.rotation -= 1;
|
||||
} else if (rl.isKeyDown(rl.KeyboardKey.KEY_S)) {
|
||||
} else if (rl.isKeyDown(rl.KeyboardKey.key_s)) {
|
||||
camera.rotation += 1;
|
||||
}
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ pub fn main() anyerror!void {
|
|||
camera.zoom = rlm.clamp(camera.zoom, 0.1, 3.0);
|
||||
|
||||
// Camera reset (zoom and rotation)
|
||||
if (rl.isKeyPressed(rl.KeyboardKey.KEY_R)) {
|
||||
if (rl.isKeyPressed(rl.KeyboardKey.key_r)) {
|
||||
camera.zoom = 1.0;
|
||||
camera.rotation = 0.0;
|
||||
}
|
||||
|
|
@ -81,38 +81,38 @@ pub fn main() anyerror!void {
|
|||
//----------------------------------------------------------------------------------
|
||||
rl.beginDrawing();
|
||||
|
||||
rl.clearBackground(rl.Color.RAYWHITE);
|
||||
rl.clearBackground(rl.Color.ray_white);
|
||||
|
||||
camera.begin();
|
||||
|
||||
rl.drawRectangle(-6000, 320, 13000, 8000, rl.Color.DARKGRAY);
|
||||
rl.drawRectangle(-6000, 320, 13000, 8000, rl.Color.dark_gray);
|
||||
|
||||
for (buildings) |building, i| {
|
||||
rl.drawRectangleRec(building, buildColors[i]);
|
||||
}
|
||||
|
||||
rl.drawRectangleRec(player, rl.Color.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.Color.GREEN);
|
||||
rl.drawLine(-screenWidth * 10, @floatToInt(c_int, camera.target.y), screenWidth * 10, @floatToInt(c_int, camera.target.y), rl.Color.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.Color.RED);
|
||||
rl.drawText("SCREEN AREA", 640, 10, 20, rl.Color.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(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.Color.SKYBLUE, 0.5));
|
||||
rl.drawRectangleLines(10, 10, 250, 113, rl.Color.BLUE);
|
||||
rl.drawRectangle(10, 10, 250, 113, rl.fade(rl.Color.sky_blue, 0.5));
|
||||
rl.drawRectangleLines(10, 10, 250, 113, rl.Color.blue);
|
||||
|
||||
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.drawText("Free 2d camera controls:", 20, 20, 10, rl.Color.black);
|
||||
rl.drawText("- Right/Left to move Offset", 40, 40, 10, rl.Color.dark_gray);
|
||||
rl.drawText("- Mouse Wheel to Zoom in-out", 40, 60, 10, rl.Color.dark_gray);
|
||||
rl.drawText("- A / S to Rotate", 40, 80, 10, rl.Color.dark_gray);
|
||||
rl.drawText("- R to reset Zoom and Rotation", 40, 100, 10, rl.Color.dark_gray);
|
||||
|
||||
rl.endDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ pub fn main() anyerror!void {
|
|||
.target = rl.Vector3.init(0, 1.8, 0),
|
||||
.up = rl.Vector3.init(0, 1, 0),
|
||||
.fovy = 60,
|
||||
.projection = rl.CameraProjection.CAMERA_PERSPECTIVE,
|
||||
.projection = rl.CameraProjection.camera_perspective,
|
||||
};
|
||||
|
||||
var heights: [MAX_COLUMNS]f32 = undefined;
|
||||
|
|
@ -30,7 +30,7 @@ pub fn main() anyerror!void {
|
|||
colors[i] = rl.Color.init(@intCast(u8, rl.getRandomValue(20, 255)), @intCast(u8, rl.getRandomValue(10, 55)), 30, 255);
|
||||
}
|
||||
|
||||
camera.setMode(rl.CameraMode.CAMERA_FIRST_PERSON);
|
||||
camera.setMode(rl.CameraMode.camera_first_person);
|
||||
|
||||
rl.setTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
|
@ -46,30 +46,30 @@ pub fn main() anyerror!void {
|
|||
//----------------------------------------------------------------------------------
|
||||
rl.beginDrawing();
|
||||
|
||||
rl.clearBackground(rl.Color.RAYWHITE);
|
||||
rl.clearBackground(rl.Color.ray_white);
|
||||
|
||||
camera.begin();
|
||||
|
||||
// Draw ground
|
||||
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
|
||||
rl.drawPlane(rl.Vector3.init(0, 0, 0), rl.Vector2.init(32, 32), rl.Color.light_gray);
|
||||
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.Color.MAROON);
|
||||
rl.drawCubeWires(positions[i], 2.0, height, 2.0, rl.Color.maroon);
|
||||
}
|
||||
|
||||
camera.end();
|
||||
|
||||
rl.drawRectangle(10, 10, 220, 70, rl.fade(rl.Color.SKYBLUE, 0.5));
|
||||
rl.drawRectangleLines(10, 10, 220, 70, rl.Color.BLUE);
|
||||
rl.drawRectangle(10, 10, 220, 70, rl.fade(rl.Color.sky_blue, 0.5));
|
||||
rl.drawRectangleLines(10, 10, 220, 70, rl.Color.blue);
|
||||
|
||||
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.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.dark_gray);
|
||||
rl.drawText("- Mouse move to look around", 40, 60, 10, rl.Color.dark_gray);
|
||||
|
||||
rl.endDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ pub fn main() anyerror!void {
|
|||
//----------------------------------------------------------------------------------
|
||||
rl.beginDrawing();
|
||||
|
||||
rl.clearBackground(rl.Color.WHITE);
|
||||
rl.clearBackground(rl.Color.white);
|
||||
|
||||
rl.drawText("Congrats! You created your first window!", 190, 200, 20, rl.Color.LIGHTGRAY);
|
||||
rl.drawText("Congrats! You created your first window!", 190, 200, 20, rl.Color.light_gray);
|
||||
|
||||
rl.endDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -20,16 +20,16 @@ pub fn main() anyerror!void {
|
|||
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
if (rl.isKeyDown(rl.KeyboardKey.KEY_RIGHT)) {
|
||||
if (rl.isKeyDown(rl.KeyboardKey.key_right)) {
|
||||
ballPosition.x += 2.0;
|
||||
}
|
||||
if (rl.isKeyDown(rl.KeyboardKey.KEY_LEFT)) {
|
||||
if (rl.isKeyDown(rl.KeyboardKey.key_left)) {
|
||||
ballPosition.x -= 2.0;
|
||||
}
|
||||
if (rl.isKeyDown(rl.KeyboardKey.KEY_UP)) {
|
||||
if (rl.isKeyDown(rl.KeyboardKey.key_up)) {
|
||||
ballPosition.y -= 2.0;
|
||||
}
|
||||
if (rl.isKeyDown(rl.KeyboardKey.KEY_DOWN)) {
|
||||
if (rl.isKeyDown(rl.KeyboardKey.key_down)) {
|
||||
ballPosition.y += 2.0;
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
@ -38,11 +38,11 @@ pub fn main() anyerror!void {
|
|||
//----------------------------------------------------------------------------------
|
||||
rl.beginDrawing();
|
||||
|
||||
rl.clearBackground(rl.Color.RAYWHITE);
|
||||
rl.clearBackground(rl.Color.ray_white);
|
||||
|
||||
rl.drawText("move the ball with arrow keys", 10, 10, 20, rl.Color.DARKGRAY);
|
||||
rl.drawText("move the ball with arrow keys", 10, 10, 20, rl.Color.dark_gray);
|
||||
|
||||
rl.drawCircleV(ballPosition, 50, rl.Color.MAROON);
|
||||
rl.drawCircleV(ballPosition, 50, rl.Color.maroon);
|
||||
|
||||
rl.endDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -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.Color.DARKBLUE;
|
||||
var ballColor = rl.Color.dark_blue;
|
||||
|
||||
rl.setTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
|
@ -24,12 +24,12 @@ pub fn main() anyerror!void {
|
|||
ballPosition.x = @intToFloat(f32, rl.getMouseX());
|
||||
ballPosition.y = @intToFloat(f32, rl.getMouseY());
|
||||
|
||||
if (rl.isMouseButtonPressed(rl.MouseButton.MOUSE_BUTTON_LEFT)) {
|
||||
ballColor = rl.Color.MAROON;
|
||||
} else if (rl.isMouseButtonPressed(rl.MouseButton.MOUSE_BUTTON_MIDDLE)) {
|
||||
ballColor = rl.Color.LIME;
|
||||
} else if (rl.isMouseButtonPressed(rl.MouseButton.MOUSE_BUTTON_RIGHT)) {
|
||||
ballColor = rl.Color.DARKBLUE;
|
||||
if (rl.isMouseButtonPressed(rl.MouseButton.mouse_button_left)) {
|
||||
ballColor = rl.Color.maroon;
|
||||
} else if (rl.isMouseButtonPressed(rl.MouseButton.mouse_button_middle)) {
|
||||
ballColor = rl.Color.lime;
|
||||
} else if (rl.isMouseButtonPressed(rl.MouseButton.mouse_button_right)) {
|
||||
ballColor = rl.Color.dark_blue;
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -37,12 +37,12 @@ pub fn main() anyerror!void {
|
|||
//----------------------------------------------------------------------------------
|
||||
rl.beginDrawing();
|
||||
|
||||
rl.clearBackground(rl.Color.RAYWHITE);
|
||||
rl.clearBackground(rl.Color.ray_white);
|
||||
|
||||
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.Color.DARKGRAY);
|
||||
rl.drawText("move ball with mouse and click mouse button to change color", 10, 10, 20, rl.Color.dark_gray);
|
||||
|
||||
rl.endDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -27,12 +27,12 @@ pub fn main() anyerror!void {
|
|||
//----------------------------------------------------------------------------------
|
||||
rl.beginDrawing();
|
||||
|
||||
rl.clearBackground(rl.Color.WHITE);
|
||||
rl.clearBackground(rl.Color.white);
|
||||
|
||||
rl.drawRectangle(screenWidth / 2 - 40, @floatToInt(c_int, boxPositionY), 80, 80, rl.Color.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.Color.GRAY);
|
||||
//rl.drawText(rl.textFormat("Box position Y: %03i", .{@floatToInt(c_int, boxPositionY)}), 10, 40, 20, rl.Color.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.light_gray);
|
||||
|
||||
rl.endDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -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.Color.BEIGE;
|
||||
var ballColor = rl.Color.beige;
|
||||
|
||||
var touchCounter: f32 = 0;
|
||||
var touchPosition = rl.Vector2.init(0, 0);
|
||||
|
|
@ -25,25 +25,25 @@ pub fn main() anyerror!void {
|
|||
//----------------------------------------------------------------------------------
|
||||
ballPosition = rl.getMousePosition();
|
||||
|
||||
ballColor = rl.Color.BEIGE;
|
||||
ballColor = rl.Color.beige;
|
||||
|
||||
if (rl.isMouseButtonDown(rl.MouseButton.MOUSE_BUTTON_LEFT)) {
|
||||
ballColor = rl.Color.MAROON;
|
||||
if (rl.isMouseButtonDown(rl.MouseButton.mouse_button_left)) {
|
||||
ballColor = rl.Color.maroon;
|
||||
}
|
||||
if (rl.isMouseButtonDown(rl.MouseButton.MOUSE_BUTTON_MIDDLE)) {
|
||||
ballColor = rl.Color.LIME;
|
||||
if (rl.isMouseButtonDown(rl.MouseButton.mouse_button_middle)) {
|
||||
ballColor = rl.Color.lime;
|
||||
}
|
||||
if (rl.isMouseButtonDown(rl.MouseButton.MOUSE_BUTTON_RIGHT)) {
|
||||
ballColor = rl.Color.DARKBLUE;
|
||||
if (rl.isMouseButtonDown(rl.MouseButton.mouse_button_right)) {
|
||||
ballColor = rl.Color.dark_blue;
|
||||
}
|
||||
|
||||
if (rl.isMouseButtonPressed(rl.MouseButton.MOUSE_BUTTON_LEFT)) {
|
||||
if (rl.isMouseButtonPressed(rl.MouseButton.mouse_button_left)) {
|
||||
touchCounter = 10;
|
||||
}
|
||||
if (rl.isMouseButtonPressed(rl.MouseButton.MOUSE_BUTTON_MIDDLE)) {
|
||||
if (rl.isMouseButtonPressed(rl.MouseButton.mouse_button_middle)) {
|
||||
touchCounter = 10;
|
||||
}
|
||||
if (rl.isMouseButtonPressed(rl.MouseButton.MOUSE_BUTTON_RIGHT)) {
|
||||
if (rl.isMouseButtonPressed(rl.MouseButton.mouse_button_right)) {
|
||||
touchCounter = 10;
|
||||
}
|
||||
|
||||
|
|
@ -56,7 +56,7 @@ pub fn main() anyerror!void {
|
|||
//----------------------------------------------------------------------------------
|
||||
rl.beginDrawing();
|
||||
|
||||
rl.clearBackground(rl.Color.RAYWHITE);
|
||||
rl.clearBackground(rl.Color.ray_white);
|
||||
|
||||
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.Color.ORANGE);
|
||||
//rl.drawText(rl.textFormat("%d", .{i}), @floatToInt(c_int, touchPosition.x) - 10, @floatToInt(c_int, touchPosition.y) - 70, 40, rl.Color.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.Color.DARKGRAY);
|
||||
rl.drawText("touch the screen at multiple locations to get multiple balls", 10, 30, 20, rl.Color.DARKGRAY);
|
||||
rl.drawText("move ball with mouse and click mouse button to change color", 10, 10, 20, rl.Color.dark_gray);
|
||||
rl.drawText("touch the screen at multiple locations to get multiple balls", 10, 30, 20, rl.Color.dark_gray);
|
||||
|
||||
rl.endDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ pub fn main() anyerror!void {
|
|||
const textureSizeLoc = rl.getShaderLocation(shdrOutline, "textureSize");
|
||||
|
||||
// Set shader values (they can be changed later)
|
||||
rl.setShaderValue(shdrOutline, outlineSizeLoc, &outlineSize, @enumToInt(rl.ShaderUniformDataType.SHADER_UNIFORM_FLOAT));
|
||||
rl.setShaderValue(shdrOutline, outlineColorLoc, &outlineColor, @enumToInt(rl.ShaderUniformDataType.SHADER_UNIFORM_VEC4));
|
||||
rl.setShaderValue(shdrOutline, textureSizeLoc, &textureSize, @enumToInt(rl.ShaderUniformDataType.SHADER_UNIFORM_VEC2));
|
||||
rl.setShaderValue(shdrOutline, outlineSizeLoc, &outlineSize, @enumToInt(rl.ShaderUniformDataType.shader_uniform_float));
|
||||
rl.setShaderValue(shdrOutline, outlineColorLoc, &outlineColor, @enumToInt(rl.ShaderUniformDataType.shader_uniform_vec4));
|
||||
rl.setShaderValue(shdrOutline, textureSizeLoc, &textureSize, @enumToInt(rl.ShaderUniformDataType.shader_uniform_vec2));
|
||||
|
||||
rl.setTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
|
@ -42,24 +42,24 @@ pub fn main() anyerror!void {
|
|||
outlineSize += rl.getMouseWheelMove();
|
||||
if (outlineSize < 1.0) outlineSize = 1.0;
|
||||
|
||||
rl.setShaderValue(shdrOutline, outlineSizeLoc, &outlineSize, @enumToInt(rl.ShaderUniformDataType.SHADER_UNIFORM_FLOAT));
|
||||
rl.setShaderValue(shdrOutline, outlineSizeLoc, &outlineSize, @enumToInt(rl.ShaderUniformDataType.shader_uniform_float));
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
rl.beginDrawing();
|
||||
|
||||
rl.clearBackground(rl.Color.RAYWHITE);
|
||||
rl.clearBackground(rl.Color.ray_white);
|
||||
|
||||
rl.beginShaderMode(shdrOutline);
|
||||
|
||||
rl.drawTexture(texture, @divFloor(rl.getScreenWidth(), 2) - @divFloor(texture.width, 2), -30, rl.Color.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.Color.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.Color.MAROON);
|
||||
//rl.drawText(rl.textFormat("Outline size: %i px", @floatToInt(i32, outlineSize)), 10, 120, 20, rl.Color.maroon);
|
||||
|
||||
rl.drawFPS(710, 10);
|
||||
|
||||
|
|
|
|||
|
|
@ -44,9 +44,9 @@ pub fn main() anyerror!void {
|
|||
}
|
||||
|
||||
// Control frames speed
|
||||
if (rl.isKeyPressed(rl.KeyboardKey.KEY_RIGHT)) {
|
||||
if (rl.isKeyPressed(rl.KeyboardKey.key_right)) {
|
||||
framesSpeed += 1;
|
||||
} else if (rl.isKeyPressed(rl.KeyboardKey.KEY_LEFT)) {
|
||||
} else if (rl.isKeyPressed(rl.KeyboardKey.key_left)) {
|
||||
framesSpeed -= 1;
|
||||
}
|
||||
|
||||
|
|
@ -62,26 +62,26 @@ pub fn main() anyerror!void {
|
|||
//----------------------------------------------------------------------------------
|
||||
rl.beginDrawing();
|
||||
|
||||
rl.clearBackground(rl.Color.RAYWHITE);
|
||||
rl.clearBackground(rl.Color.ray_white);
|
||||
|
||||
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.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.Color.DARKGRAY);
|
||||
rl.drawText("FRAME SPEED: ", 165, 210, 10, rl.Color.dark_gray);
|
||||
//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);
|
||||
rl.drawText("PRESS RIGHT/LEFT KEYS to CHANGE SPEED!", 290, 240, 10, rl.Color.dark_gray);
|
||||
|
||||
for ([_]u32{0} ** MAX_FRAME_SPEED) |_, i| {
|
||||
if (i < framesSpeed) {
|
||||
rl.drawRectangle(250 + 21 * @intCast(c_int, i), 205, 20, 20, rl.Color.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.Color.MAROON);
|
||||
rl.drawRectangleLines(250 + 21 * @intCast(c_int, i), 205, 20, 20, rl.Color.maroon);
|
||||
}
|
||||
|
||||
rl.drawTextureRec(scarfy, frameRec, position, rl.Color.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.Color.GRAY);
|
||||
rl.drawText("(c) Scarfy sprite by Eiden Marsal", screenWidth - 200, screenHeight - 20, 10, rl.Color.gray);
|
||||
|
||||
rl.endDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue