reality-engine/docs/project-syntax-example/client.ul

40 lines
919 B
Plaintext

use "common.ztl";
function main(int argc, str[] argv) {
nat screen_width = 800;
nat screen_height = 450;
str username = argv[1];
str password = argv[2];
Player me(username, [0.0, 1.0, 2.0], PURPLE);
bool running = true;
while (running) {
window("zwl client", screen_width, screen_height) {
splitbox(parent.size 0.25) {
canvas() {
if (button("logout")) {
me.logout();
running = false;
}
}
}
splitbox(parent.size 0.75) {
canvas() {
model(Floor([0, 0, 0], 30));
me.update();
model(Cube(me.pos, [0.5, 0.5, 0.5], me.appearance));
if (Player[] players = me.server.read("players")) {
for (p in players) {
model(Cube(p.pos, [0.5, 0.5, 0.5], p.apperance));
}
}
}
}
}
}
exits("Client Closed Successfully");
}