update documentation
This commit is contained in:
parent
7ec2f90d38
commit
9c94e4a6ef
11
README.org
11
README.org
|
@ -34,17 +34,17 @@
|
||||||
- =real= type (f32).
|
- =real= type (f32).
|
||||||
- =int= for integer numbers (i32).
|
- =int= for integer numbers (i32).
|
||||||
- =nat= for unsigned integer numbers (u32).
|
- =nat= for unsigned integer numbers (u32).
|
||||||
- =byte= for interop (u8, i64, etc.).
|
- =byte= arrays for interop (u8, i64, etc.).
|
||||||
- 3D math primitives: =vec=, =mat=, =quat=, and more.
|
- =str= Strings with interpolation, =split=, =replace=, =trim=, etc.
|
||||||
- Strings with interpolation, =split=, =replace=, =trim=, etc.
|
|
||||||
- Error handling:
|
- Error handling:
|
||||||
- try-catch
|
- try-catch
|
||||||
- Null coalescing (=??=) and null checks (=?.=).
|
- Null coalescing (=??=) and null checks (=?.=).
|
||||||
|
- Fortran style array operations.
|
||||||
- Lightweight coroutines with event-loop-driven multitasking.
|
- Lightweight coroutines with event-loop-driven multitasking.
|
||||||
- FFI via C-defined "system calls" (examples provided in VM).
|
- FFI via C-defined "system calls" (examples provided in VM).
|
||||||
|
|
||||||
** Modularity & Ecosystem
|
** Modularity & Ecosystem
|
||||||
- C-like arrays with fat pointers.
|
- Fortran-like arrays.
|
||||||
- Standard library: math, networking, 3D rendering, minimal GUI.
|
- Standard library: math, networking, 3D rendering, minimal GUI.
|
||||||
- =use= keyword for modular code organization via file-based namespaces.
|
- =use= keyword for modular code organization via file-based namespaces.
|
||||||
|
|
||||||
|
@ -55,8 +55,7 @@
|
||||||
- Portable to new systems, microcontrollers, and web via Emscripten.
|
- Portable to new systems, microcontrollers, and web via Emscripten.
|
||||||
|
|
||||||
** Memory Management
|
** Memory Management
|
||||||
- Reference counting for globally scoped objects.
|
- Frame scoped arena allocators
|
||||||
- =weak= keyword to avoid cyclical references.
|
|
||||||
|
|
||||||
** Rendering & I/O
|
** Rendering & I/O
|
||||||
- SDL2-based abstraction for input, audio, and rendering.
|
- SDL2-based abstraction for input, audio, and rendering.
|
||||||
|
|
|
@ -353,10 +353,10 @@ fn «token» («parameter» «type», ...) «return_type» {
|
||||||
:CUSTOM_ID: loops
|
:CUSTOM_ID: loops
|
||||||
:END:
|
:END:
|
||||||
#+begin_src zre
|
#+begin_src zre
|
||||||
for («token» in «collection») { «body» }
|
for («variable» in «collection») { «body» }
|
||||||
#+end_src zre
|
#+end_src zre
|
||||||
|
|
||||||
iterates through each object in the collection setting it to token
|
iterates through each object in the collection setting it to variable
|
||||||
|
|
||||||
#+begin_src zre
|
#+begin_src zre
|
||||||
while («boolean expression») { «body» }
|
while («boolean expression») { «body» }
|
||||||
|
@ -365,7 +365,7 @@ while («boolean expression») { «body» }
|
||||||
loops until the expression is false
|
loops until the expression is false
|
||||||
|
|
||||||
#+begin_src zre
|
#+begin_src zre
|
||||||
do (let «variable» = initial_value, end_value, increment) { «body» }
|
do («variable» = initial_value, end_value, increment) { «body» }
|
||||||
#+end_src zre
|
#+end_src zre
|
||||||
|
|
||||||
loops from initial value to end value by increment value (like a for loop in other languages)
|
loops from initial value to end value by increment value (like a for loop in other languages)
|
||||||
|
|
|
@ -7,7 +7,7 @@ fn main(argc real, argv str[]) {
|
||||||
let username = argv[0]; ! implied str
|
let username = argv[0]; ! implied str
|
||||||
let password = argv[1]; ! implied str
|
let password = argv[1]; ! implied str
|
||||||
|
|
||||||
let me = Player(username, Vec3(0.0, 1.0, 2.0), PURPLE); ! implied Player struct
|
let me = Player(username, [0.0, 1.0, 2.0], PURPLE); ! implied Player struct
|
||||||
|
|
||||||
let running = true;
|
let running = true;
|
||||||
while (running) {
|
while (running) {
|
||||||
|
@ -22,12 +22,12 @@ fn main(argc real, argv str[]) {
|
||||||
}
|
}
|
||||||
splitbox(parent.size 0.75) {
|
splitbox(parent.size 0.75) {
|
||||||
canvas("3D") {
|
canvas("3D") {
|
||||||
model(Floor(Vec3(0, 0, 0), 30));
|
model(Floor([0, 0, 0], 30));
|
||||||
me.update();
|
me.update();
|
||||||
model(Cube(me.pos, Vec3(0.5, 0.5, 0.5), me.appearance));
|
model(Cube(me.pos, [0.5, 0.5, 0.5], me.appearance));
|
||||||
if (let players = me.server.read("players")) {
|
if (let players = me.server.read("players")) {
|
||||||
for (p in players) {
|
for (p in players) {
|
||||||
model(Cube(p.pos, Vec3(0.5, 0.5, 0.5), p.apperance));
|
model(Cube(p.pos, [0.5, 0.5, 0.5], p.apperance));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,10 @@
|
||||||
! Camera .
|
! Camera .
|
||||||
!!
|
!!
|
||||||
type Camera {
|
type Camera {
|
||||||
init(pos Vec3, look Vec3) {
|
init(pos [3]real, look [3]real) {
|
||||||
this.setting = "CAMERA_PERSPECTIVE";
|
this.setting = "CAMERA_PERSPECTIVE";
|
||||||
this.pov = 45.0;
|
this.pov = 45.0;
|
||||||
this.up = Vec3(0.0, 1.0, 0.0);
|
this.up = [0.0, 1.0, 0.0];
|
||||||
this.pos = pos;
|
this.pos = pos;
|
||||||
this.look = look;
|
this.look = look;
|
||||||
}
|
}
|
||||||
|
@ -20,13 +20,13 @@ type Camera {
|
||||||
! Player .
|
! Player .
|
||||||
!!
|
!!
|
||||||
type Player {
|
type Player {
|
||||||
init(username str, pos Vec3, color Color) {
|
init(username str, pos real[3], color Color) {
|
||||||
this.server = Client("tcp://localhost:25565");
|
this.server = Client("tcp://localhost:25565");
|
||||||
this.username = username;
|
this.username = username;
|
||||||
this.pos = pos;
|
this.pos = pos;
|
||||||
this.color = color;
|
this.color = color;
|
||||||
this.camera =
|
this.camera =
|
||||||
Camera((this.pos.x + 10.0, this.pos.y + 10.0, this.pos.z), this.pos);
|
Camera([this.pos.x + 10.0, this.pos.y + 10.0, this.pos.z], this.pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
login(str password) Player[] {
|
login(str password) Player[] {
|
||||||
|
|
|
@ -3,7 +3,7 @@ use "common.ztl";
|
||||||
fn main(argc real, argv str[]) {
|
fn main(argc real, argv str[]) {
|
||||||
let s = Server("tcp://0.0.0.0:25565");
|
let s = Server("tcp://0.0.0.0:25565");
|
||||||
let running = true;
|
let running = true;
|
||||||
let players = [Player("user", [0, 0, 0], RED)];
|
let players = [Player("user", [0., 0., 0.], RED)];
|
||||||
while (running) {
|
while (running) {
|
||||||
if (let client = s.accept("players")) {
|
if (let client = s.accept("players")) {
|
||||||
if (let message = client.get()) {
|
if (let message = client.get()) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
fn add(a int, b int) int {
|
fn add(int a, int b) int {
|
||||||
return a + b;
|
return a + b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue