First start
commit
f39ebe66f2
|
@ -0,0 +1,31 @@
|
|||
const std = @import("std");
|
||||
const writer = std.io.getStdOut().writer();
|
||||
const expect = std.testing.expect;
|
||||
|
||||
fn Vec3(comptime T: type) type {
|
||||
return struct {
|
||||
const Self = @This();
|
||||
x: T,
|
||||
y: T,
|
||||
z: T,
|
||||
fn init(this: *Self, x: T, y: T, z: T) void {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
fn print(this: Self) !void {
|
||||
try writer.print("X: %d\nY: %d\nZ: %d\n", .{this.x, this.y, this.x});
|
||||
}
|
||||
|
||||
//fn add(this: *Self, other: Self) {
|
||||
//
|
||||
//}
|
||||
};
|
||||
}
|
||||
|
||||
pub fn main() !void {
|
||||
var vec1: Vec3(u64) = undefined;
|
||||
vec1.init(2, 4, 3);
|
||||
vec1.print();
|
||||
}
|
Loading…
Reference in New Issue