mmo-project/lisp/client/picolisp/client.l

79 lines
3.1 KiB
Plaintext
Raw Normal View History

2023-11-18 18:06:43 -05:00
(scl 4)
(load "@lib/clang.l")
(clang "structs" '("-lraylib")
(BeginMode3D (pos tgt up fovy projection) PilBeginMode3D NIL (cons (car pos) -1.0)
(cons (cadr pos) -1.0)
(cons (caddr pos) -1.0)
(cons (car tgt) -1.0)
(cons (cadr tgt) -1.0)
(cons (caddr tgt) -1.0)
(cons (car up) -1.0)
(cons (cadr up) -1.0)
(cons (caddr up) -1.0)
fovy projection)
(DrawCube (pos width height length col) PilDrawCube NIL (cons (car pos) -1.0)
(cons (cadr pos) -1.0)
(cons (caddr pos) -1.0)
(cons width -1.0)
(cons length -1.0)
(cons height -1.0) col)
)
#include <stdio.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)
{
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);
}
void PilDrawCube(float pos_x, float pos_y, float pos_z, float width, float height, float length, Color color) {
DrawCube((Vector3){pos_x, pos_y, pos_z}, width, height, length, color);
}
/**/
(de raylib @ (pass native "libraylib.dylib"))
(setq screen_width 800
screen_height 450
KEY_RIGHT 262
KEY_LEFT 263
KEY_DOWN 264
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 target_pos (list 0.0 2.0 0.0) )
(setq up_vec (list 0.0 1.0 0.0) )
(raylib "InitWindow" NIL screen_width screen_height "raylib [core] example - basic window")
(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)
(raylib "DrawGrid" NIL 30 (cons 1.0 -1.0))
(DrawCube target_pos 0.5 0.5 0.5 MAROON)
(raylib "EndMode3D")
(raylib "EndDrawing") )
(raylib "CloseWindow")
(bye)