mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Update demo for using in
This commit is contained in:
+24
-1
@@ -4,6 +4,7 @@ import "core:mem.odin"
|
|||||||
import "core:bits.odin"
|
import "core:bits.odin"
|
||||||
import "core:hash.odin"
|
import "core:hash.odin"
|
||||||
import "core:math.odin"
|
import "core:math.odin"
|
||||||
|
import "core:math/rand.odin"
|
||||||
import "core:os.odin"
|
import "core:os.odin"
|
||||||
import "core:raw.odin"
|
import "core:raw.odin"
|
||||||
import "core:sort.odin"
|
import "core:sort.odin"
|
||||||
@@ -596,7 +597,7 @@ array_programming :: proc() {
|
|||||||
cross :: proc(a, b: Vector3) -> Vector3 {
|
cross :: proc(a, b: Vector3) -> Vector3 {
|
||||||
i := swizzle(a, 1, 2, 0) * swizzle(b, 2, 0, 1);
|
i := swizzle(a, 1, 2, 0) * swizzle(b, 2, 0, 1);
|
||||||
j := swizzle(a, 2, 0, 1) * swizzle(b, 1, 2, 0);
|
j := swizzle(a, 2, 0, 1) * swizzle(b, 1, 2, 0);
|
||||||
return Vector3(i - j);
|
return i - j;
|
||||||
}
|
}
|
||||||
|
|
||||||
blah :: proc(a: Vector3) -> f32 {
|
blah :: proc(a: Vector3) -> f32 {
|
||||||
@@ -609,6 +610,27 @@ array_programming :: proc() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
using println in import "core:fmt.odin"
|
||||||
|
|
||||||
|
using_in :: proc() {
|
||||||
|
using print in fmt;
|
||||||
|
|
||||||
|
println("Hellope1");
|
||||||
|
print("Hellope2\n");
|
||||||
|
|
||||||
|
Foo :: struct {
|
||||||
|
x, y: int,
|
||||||
|
b: bool,
|
||||||
|
}
|
||||||
|
f: Foo;
|
||||||
|
f.x, f.y = 123, 321;
|
||||||
|
println(f);
|
||||||
|
using x, y in f;
|
||||||
|
f.x, f.y = 456, 654;
|
||||||
|
println(f);
|
||||||
|
}
|
||||||
|
|
||||||
main :: proc() {
|
main :: proc() {
|
||||||
when false {
|
when false {
|
||||||
general_stuff();
|
general_stuff();
|
||||||
@@ -617,6 +639,7 @@ main :: proc() {
|
|||||||
parametric_polymorphism();
|
parametric_polymorphism();
|
||||||
threading_example();
|
threading_example();
|
||||||
array_programming();
|
array_programming();
|
||||||
|
using_in();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user