43 lines
		
	
	
		
			998 B
		
	
	
	
		
			Fortran
		
	
	
	
			
		
		
	
	
			43 lines
		
	
	
		
			998 B
		
	
	
	
		
			Fortran
		
	
	
	
| use "common.ztl";
 | |
| 
 | |
| function main(int argc, str[] argv) {
 | |
|   nat screen_width = 800; 
 | |
|   nat screen_height = 450;
 | |
| 
 | |
|   if (argv < 2) {
 | |
|     exits("usage: zre client.ul <username> <password>");
 | |
|   }
 | |
|   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");
 | |
| }
 |