103 lines
2.5 KiB
Plaintext
103 lines
2.5 KiB
Plaintext
(scl 4)
|
|
|
|
(load "@lib/clang.l")
|
|
|
|
(clang "structs" '("-lraylib")
|
|
(DrawCube (pos w l h color) PilDrawCube NIL (cons (car pos) -1.0)
|
|
(cons (cadr pos) -1.0)
|
|
(cons (caddr pos) -1.0)
|
|
(cons w -1.0)
|
|
(cons l -1.0)
|
|
(cons h -1.0)
|
|
color)
|
|
(BeginMode3D (pos target) PilBeginMode3D NIL (cons (car pos) -1.0)
|
|
(cons (cadr pos) -1.0)
|
|
(cons (caddr pos) -1.0)
|
|
(cons (car target) -1.0)
|
|
(cons (cadr target) -1.0)
|
|
(cons (caddr target) -1.0) ) )
|
|
|
|
#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)
|
|
{
|
|
Camera camera = {0};
|
|
|
|
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 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.so"))
|
|
|
|
(de MovePos (pos)
|
|
(when (=1 (raylib "IsKeyDown" 'B KEY_RIGHT)) (inc pos 0.2))
|
|
(when (=1 (raylib "IsKeyDown" 'B KEY_LEFT)) (dec pos 0.2))
|
|
(when (=1 (raylib "IsKeyDown" 'B KEY_UP)) (dec (cddr pos) 0.2))
|
|
(when (=1 (raylib "IsKeyDown" 'B KEY_DOWN)) (inc (cddr pos) 0.2)) )
|
|
|
|
(setq screen_width 800
|
|
screen_height 450
|
|
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 "SetTargetFPS" NIL 60)
|
|
|
|
(while (=0 (raylib "WindowShouldClose" 'B))
|
|
|
|
(MovePos camera_pos)
|
|
(MovePos target_pos)
|
|
|
|
(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 "CloseWindow")
|
|
(bye)
|