Merge raymath and rlgl into main raylib module

This commit is contained in:
Not-Nik 2024-06-05 22:56:07 +02:00
parent 171c2e100c
commit c0d07991d1
Failed to generate hash of commit
15 changed files with 1012 additions and 68 deletions

View file

@ -1,7 +1,6 @@
// raylib-zig (c) Nikolas Wipper 2023
const rl = @import("raylib");
const rlm = @import("raymath");
const MAX_BUILDINGS = 100;
@ -69,12 +68,12 @@ pub fn main() anyerror!void {
}
// Limit camera rotation to 80 degrees (-40 to 40)
camera.rotation = rlm.clamp(camera.rotation, -40, 40);
camera.rotation = rl.math.clamp(camera.rotation, -40, 40);
// Camera zoom controls
camera.zoom += rl.getMouseWheelMove() * 0.05;
camera.zoom = rlm.clamp(camera.zoom, 0.1, 3.0);
camera.zoom = rl.math.clamp(camera.zoom, 0.1, 3.0);
// Camera reset (zoom and rotation)
if (rl.isKeyPressed(rl.KeyboardKey.key_r)) {

View file

@ -10,7 +10,6 @@
//! Copyright (c) Nikolas Wipper 2024
const rl = @import("raylib");
const rlm = @import("raymath");
const screen_width = 800;
const screen_height = 450;
@ -133,7 +132,7 @@ pub fn main() anyerror!void {
}
// Bouncing ball logic
ball_position = rlm.vector2Add(ball_position, ball_speed);
ball_position = ball_position.add(ball_speed);
if (ball_position.x >= (@as(f32, @floatFromInt(rl.getScreenWidth())) - ball_radius) or ball_position.x <= ball_radius) {
ball_speed.x *= -1;