Rename demo, add www, server, make client work
This commit is contained in:
parent
ff1b75c044
commit
f29296b216
|
@ -3,76 +3,100 @@
|
||||||
(load "@lib/clang.l")
|
(load "@lib/clang.l")
|
||||||
|
|
||||||
(clang "structs" '("-lraylib")
|
(clang "structs" '("-lraylib")
|
||||||
(BeginMode3D (pos tgt up fovy projection) PilBeginMode3D NIL (cons (car pos) -1.0)
|
(DrawCube (pos w l h color) PilDrawCube NIL (cons (car pos) -1.0)
|
||||||
(cons (cadr pos) -1.0)
|
(cons (cadr pos) -1.0)
|
||||||
(cons (caddr pos) -1.0)
|
(cons (caddr pos) -1.0)
|
||||||
(cons (car tgt) -1.0)
|
(cons w -1.0)
|
||||||
(cons (cadr tgt) -1.0)
|
(cons l -1.0)
|
||||||
(cons (caddr tgt) -1.0)
|
(cons h -1.0)
|
||||||
(cons (car up) -1.0)
|
color)
|
||||||
(cons (cadr up) -1.0)
|
(BeginMode3D (pos target) PilBeginMode3D NIL (cons (car pos) -1.0)
|
||||||
(cons (caddr up) -1.0)
|
(cons (cadr pos) -1.0)
|
||||||
fovy projection)
|
(cons (caddr pos) -1.0)
|
||||||
(DrawCube (pos width height length col) PilDrawCube NIL (cons (car pos) -1.0)
|
(cons (car target) -1.0)
|
||||||
(cons (cadr pos) -1.0)
|
(cons (cadr target) -1.0)
|
||||||
(cons (caddr pos) -1.0)
|
(cons (caddr target) -1.0) ) )
|
||||||
(cons width -1.0)
|
|
||||||
(cons length -1.0)
|
|
||||||
(cons height -1.0) col)
|
|
||||||
)
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
|
||||||
void PilBeginMode3D(float pos_x, float pos_y, float pos_z, float tgt_x, float tgt_y, float tgt_z, float up_x, float up_y, float up_z, float fovy, int projection)
|
void
|
||||||
|
PilBeginMode3D (float pos_x, float pos_y, float pos_z, float tgt_x, float tgt_y, float tgt_z)
|
||||||
{
|
{
|
||||||
Camera camera = {0};
|
Camera camera = {0};
|
||||||
camera.position = (Vector3){pos_x,pos_y,pos_z};
|
|
||||||
camera.target = (Vector3){tgt_x,tgt_y,tgt_z};
|
|
||||||
camera.up = (Vector3){up_x,up_y,up_z};
|
|
||||||
camera.fovy = fovy;
|
|
||||||
camera.projection = projection;
|
|
||||||
|
|
||||||
BeginMode3D(camera);
|
Vector3 position = {0};
|
||||||
|
position.x = pos_x;
|
||||||
|
position.y = pos_y;
|
||||||
|
position.z = pos_z;
|
||||||
|
|
||||||
|
Vector3 target = {0};
|
||||||
|
target.x = tgt_x;
|
||||||
|
target.y = tgt_y;
|
||||||
|
target.z = tgt_z;
|
||||||
|
|
||||||
|
camera.position = position;
|
||||||
|
camera.target = target;
|
||||||
|
camera.up = (Vector3){0.0f, 1.0f, 0.0f};
|
||||||
|
camera.fovy = 60.0f;
|
||||||
|
camera.projection = 0;
|
||||||
|
|
||||||
|
UpdateCameraPro(&camera, (Vector3){0.0f,0.0f,0.0f},(Vector3){0.0f,0.0f,0.0f},0.0f);
|
||||||
|
|
||||||
|
BeginMode3D(camera);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PilDrawCube(float pos_x, float pos_y, float pos_z, float width, float height, float length, Color color) {
|
void
|
||||||
DrawCube((Vector3){pos_x, pos_y, pos_z}, width, height, length, color);
|
PilDrawCube (float pos_x, float pos_y, float pos_z, float w, float l, float h, Color color)
|
||||||
|
{
|
||||||
|
Vector3 position = {0};
|
||||||
|
position.x = pos_x;
|
||||||
|
position.y = pos_y;
|
||||||
|
position.z = pos_z;
|
||||||
|
|
||||||
|
DrawCube(position, w, l, h, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
|
|
||||||
(de raylib @ (pass native "libraylib.dylib"))
|
(de raylib @ (pass native "libraylib.so"))
|
||||||
|
|
||||||
(setq screen_width 800
|
(de MovePos (pos)
|
||||||
screen_height 450
|
(when (=1 (raylib "IsKeyDown" 'B KEY_RIGHT)) (inc pos 0.2))
|
||||||
KEY_RIGHT 262
|
(when (=1 (raylib "IsKeyDown" 'B KEY_LEFT)) (dec pos 0.2))
|
||||||
KEY_LEFT 263
|
(when (=1 (raylib "IsKeyDown" 'B KEY_UP)) (dec (cddr pos) 0.2))
|
||||||
KEY_DOWN 264
|
(when (=1 (raylib "IsKeyDown" 'B KEY_DOWN)) (inc (cddr pos) 0.2)) )
|
||||||
KEY_UP 265
|
|
||||||
CAMERA_PERSPECTIVE 0
|
|
||||||
RAYWHITE (hex "FFF5F5F5")
|
|
||||||
DARKGRAY (hex "FF505050")
|
|
||||||
MAROON (hex "FF3721BE"))
|
|
||||||
|
|
||||||
(setq camera_pos (list 0.0 12.0 14.0) )
|
(setq screen_width 800
|
||||||
(setq target_pos (list 0.0 2.0 0.0) )
|
screen_height 450
|
||||||
(setq up_vec (list 0.0 1.0 0.0) )
|
KEY_RIGHT 262
|
||||||
|
KEY_LEFT 263
|
||||||
|
KEY_DOWN 264
|
||||||
|
KEY_UP 265
|
||||||
|
MOUSE_BUTTON_LEFT 0
|
||||||
|
RAYWHITE (hex "FFF5F5F5")
|
||||||
|
DARKGRAY (hex "FF505050")
|
||||||
|
MAROON (hex "FF3721BE"))
|
||||||
|
|
||||||
|
(raylib "InitWindow" NIL screen_width screen_height "raylib mmo - picolisp")
|
||||||
|
|
||||||
|
(setq camera_pos (list 0.0 10.0 10.0) )
|
||||||
|
(setq target_pos (list 0.0 0.0 0.0) )
|
||||||
|
|
||||||
(raylib "InitWindow" NIL screen_width screen_height "raylib [core] example - basic window")
|
|
||||||
(raylib "SetTargetFPS" NIL 60)
|
(raylib "SetTargetFPS" NIL 60)
|
||||||
(until (= 1 (raylib "WindowShouldClose" 'B))
|
|
||||||
(raylib "BeginDrawing")
|
|
||||||
(raylib "ClearBackground" NIL RAYWHITE)
|
|
||||||
|
|
||||||
(BeginMode3D camera_pos target_pos up_vec 60.0 0)
|
(while (=0 (raylib "WindowShouldClose" 'B))
|
||||||
|
|
||||||
(raylib "DrawGrid" NIL 30 (cons 1.0 -1.0))
|
(MovePos camera_pos)
|
||||||
|
(MovePos target_pos)
|
||||||
|
|
||||||
(DrawCube target_pos 0.5 0.5 0.5 MAROON)
|
(raylib "BeginDrawing")
|
||||||
|
(raylib "ClearBackground" NIL RAYWHITE )
|
||||||
|
(BeginMode3D camera_pos target_pos)
|
||||||
|
(raylib "DrawGrid" NIL 30 (cons 1.0 -1.0))
|
||||||
|
(DrawCube target_pos 0.5 0.5 0.5 MAROON)
|
||||||
|
(raylib "EndMode3D")
|
||||||
|
(raylib "EndDrawing") )
|
||||||
|
|
||||||
(raylib "EndMode3D")
|
|
||||||
(raylib "EndDrawing") )
|
|
||||||
(raylib "CloseWindow")
|
(raylib "CloseWindow")
|
||||||
(bye)
|
(bye)
|
||||||
|
|
||||||
|
|
|
@ -1,51 +0,0 @@
|
||||||
(scl 4)
|
|
||||||
|
|
||||||
(load "@lib/clang.l")
|
|
||||||
|
|
||||||
(clang "structs" '("-lraylib")
|
|
||||||
(DrawCircleV (pos r col) PilDrawCircleV NIL (cons (car pos) -1.0) (cons (cadr pos) -1.0) (cons r -1.0) col) )
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "raylib.h"
|
|
||||||
void PilDrawCircleV (float x, float y, float r, Color col){
|
|
||||||
Vector2 v = {x,y};
|
|
||||||
DrawCircleV(v,r,col);
|
|
||||||
DrawCircle(x,y,r,col);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**/
|
|
||||||
|
|
||||||
(de raylib @ (pass native "libraylib.dylib"))
|
|
||||||
|
|
||||||
(setq screenWidth 800
|
|
||||||
screenHeight 450
|
|
||||||
KEY_RIGHT 262
|
|
||||||
KEY_LEFT 263
|
|
||||||
KEY_DOWN 264
|
|
||||||
KEY_UP 265
|
|
||||||
RAYWHITE (hex "FFF5F5F5")
|
|
||||||
DARKGRAY (hex "FF505050")
|
|
||||||
MAROON (hex "FF3721BE"))
|
|
||||||
|
|
||||||
(raylib "InitWindow" NIL screenWidth screenHeight "raylib [core] example - keyboard input")
|
|
||||||
|
|
||||||
(setq ballPosition (list (*/ screenWidth 1.0 2) (*/ screenHeight 1.0 2)) )
|
|
||||||
|
|
||||||
(raylib "SetTargetFPS" NIL 60)
|
|
||||||
|
|
||||||
|
|
||||||
(while (=0 (raylib "WindowShouldClose" 'B))
|
|
||||||
(when (=1 (raylib "IsKeyDown" 'B KEY_RIGHT)) (inc ballPosition 2.))
|
|
||||||
(when (=1 (raylib "IsKeyDown" 'B KEY_LEFT)) (dec ballPosition 2.))
|
|
||||||
(when (=1 (raylib "IsKeyDown" 'B KEY_UP)) (dec (cdr ballPosition) 2.))
|
|
||||||
(when (=1 (raylib "IsKeyDown" 'B KEY_DOWN)) (inc (cdr ballPosition) 2.))
|
|
||||||
|
|
||||||
(raylib "BeginDrawing")
|
|
||||||
(raylib "ClearBackground" NIL RAYWHITE )
|
|
||||||
(raylib "DrawText" NIL "move the ball with arrow keys" 10 10 20 DARKGRAY)
|
|
||||||
(DrawCircleV ballPosition 50.0 MAROON)
|
|
||||||
(raylib "EndDrawing")
|
|
||||||
)
|
|
||||||
|
|
||||||
(raylib "CloseWindow")
|
|
||||||
(bye)
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
(de chat Lst
|
||||||
|
(out *Sock
|
||||||
|
(mapc prin Lst)
|
||||||
|
(prinl) ) )
|
||||||
|
|
||||||
|
(setq *Port (port 4004))
|
||||||
|
|
||||||
|
(loop
|
||||||
|
(setq *Sock (listen *Port))
|
||||||
|
(NIL (fork) (close *Port))
|
||||||
|
(close *Sock) )
|
||||||
|
|
||||||
|
(out *Sock
|
||||||
|
(prin "Please enter your name: ")
|
||||||
|
(flush) )
|
||||||
|
(in *Sock (setq *Name (line T)))
|
||||||
|
|
||||||
|
(tell 'chat "+++ " *Name " arrived +++")
|
||||||
|
|
||||||
|
(task *Sock
|
||||||
|
(in @
|
||||||
|
(ifn (eof)
|
||||||
|
(tell 'chat *Name "> " (line T))
|
||||||
|
(tell 'chat "--- " *Name " left ---")
|
||||||
|
(bye) ) ) )
|
||||||
|
(wait)
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
#!/bin/sh
|
||||||
|
pil www.l -main -go -wait
|
Binary file not shown.
|
@ -0,0 +1,27 @@
|
||||||
|
|
||||||
|
(allowed ()
|
||||||
|
"!work" "@lib.css" )
|
||||||
|
|
||||||
|
(load "@lib/http.l" "@lib/xhtml.l" "@lib/form.l")
|
||||||
|
|
||||||
|
(class +User +Entity)
|
||||||
|
(rel username (+Need +Sn +Idx +String))
|
||||||
|
(rel password (+String))
|
||||||
|
(rel px (+Number))
|
||||||
|
(rel py (+Number))
|
||||||
|
(rel appearance (+String))
|
||||||
|
(rel login (+Date))
|
||||||
|
(rel created (+Date))
|
||||||
|
|
||||||
|
(de work ()
|
||||||
|
(app)
|
||||||
|
(action
|
||||||
|
(html 0 "MMO Project" "@lib.css" NIL
|
||||||
|
(<h1> NIL "hello world!") ) ) )
|
||||||
|
|
||||||
|
(de main ()
|
||||||
|
(locale "US")
|
||||||
|
(pool "users.db") )
|
||||||
|
|
||||||
|
(de go ()
|
||||||
|
(server 8080 "!work") )
|
Loading…
Reference in New Issue