Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
34
Task/Draw-a-sphere/Zig/draw-a-sphere.zig
Normal file
34
Task/Draw-a-sphere/Zig/draw-a-sphere.zig
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
const std = @import("std");
|
||||
const c = @cImport({
|
||||
@cInclude("raylib.h");
|
||||
});
|
||||
|
||||
pub fn main() !void {
|
||||
c.SetConfigFlags(c.FLAG_WINDOW_RESIZABLE | c.FLAG_VSYNC_HINT);
|
||||
c.InitWindow(600, 480, "Draw a Sphere");
|
||||
defer c.CloseWindow();
|
||||
|
||||
const camera = c.Camera3D{
|
||||
.position = .{ .x = 4.5, .y = 4.5, .z = 4.5 },
|
||||
.target = .{ .x = 0, .y = 0, .z = 0 },
|
||||
.up = .{ .x = 0, .y = 1, .z = 0 },
|
||||
.fovy = 45.0,
|
||||
.projection = c.CAMERA_PERSPECTIVE,
|
||||
};
|
||||
|
||||
c.SetTargetFPS(60);
|
||||
|
||||
while (!c.WindowShouldClose()) {
|
||||
c.BeginDrawing();
|
||||
defer c.EndDrawing();
|
||||
|
||||
c.ClearBackground(c.BLACK);
|
||||
|
||||
{
|
||||
c.BeginMode3D(camera);
|
||||
defer c.EndMode3D();
|
||||
|
||||
c.DrawSphereWires(.{ .x = 0, .y = 0, .z = 0 }, 2, 20, 20, c.LIME);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue