const std = @import("std"); const rl = @import("raylib"); const gi = @import("raygui"); const gr = @import("Drawers"); const cm = @import("Cam"); const panel = @import("Gui"); const io = @import("InputOps"); var text: [:0]u8 = undefined; const screen_width = 1920; const screen_height = 1080; const allocator = std.heap.c_allocator; // C deki malloc a ulaşır pub fn main() anyerror!void { var shapes = try std.ArrayList(io.Shape).initCapacity(allocator, 1024); defer shapes.deinit(allocator); var my_gui = panel.GUI.init(@floatFromInt(screen_width), @floatFromInt(screen_height)); const my_cube = io.Shape.initCube(rl.Vector3.init(0, 0, 0), .red, 2.0, 2.0, 2.0); const my_sphere = io.Shape.initSphere(rl.Vector3.init(2.0, 0, 0), .gold, 1.0); const my_cylinder = io.Shape.initCylinder(rl.Vector3.init(-2.0, 0, 0), .pink, 1, 1); try shapes.append(allocator, my_cube); try shapes.append(allocator, my_sphere); try shapes.append(allocator, my_cylinder); panel.is_cursor_hidden = false; io.is_object_dragging = false; rl.initWindow(screen_width, screen_height, "YELBEGEN"); defer rl.closeWindow(); var cam = rl.Camera3D{ .position = rl.Vector3.init(10, 10, 10), .target = rl.Vector3.init(0,0,0), .up = rl.Vector3.init(0, 1.0, 0), .fovy = 45.0, .projection = rl.CameraProjection.perspective, }; rl.setTargetFPS(60); while (!rl.windowShouldClose()) { io.inputControls(); io.findClosestHitObject(rl.getMousePosition(), cam, &shapes); if (io.freeMode) { rl.updateCamera(&cam, .free); } rl.beginDrawing(); defer rl.endDrawing(); rl.clearBackground(.ray_white); rl.beginMode3D(cam); io.drawShapes(&shapes); rl.drawGrid(10, 1.0); rl.endMode3D(); rl.drawText(rl.textFormat("x:%.2f y:%.2f z:%.2f", .{cam.position.x, cam.position.y, cam.position.z}), 180, 200, 20, .light_gray); rl.drawText(rl.textFormat("x : %d y : %d", .{rl.getScreenWidth(), rl.getScreenHeight()}), 50, 50, 20, .red); my_gui.draw(); rl.drawFPS(200, 200); if (io.is_object_dragging) { rl.drawText("Nesne drag...", 10, 10, 20, .dark_gray); } else { rl.drawText("Nesne hazır...", 10, 10, 20, .dark_gray); } } }