Compare commits
2 Commits
abb74e63c5
...
f71692478a
Author | SHA1 | Date |
---|---|---|
zongor | f71692478a | |
zongor | 514fef5b7a |
Binary file not shown.
|
@ -0,0 +1,13 @@
|
|||
# Lisp MMO Project Implementation
|
||||
|
||||
The interesting thing about lisp is that for being the 2nd oldest language, it has some of the most flavors of any programming language.
|
||||
|
||||
Lisp is much easier to implement from a compiler/interpreter point of view due to its structure, so it makes sense that it has so many implementations.
|
||||
|
||||
[We are spoiled for choice for this challenge.](https://github.com/dundalek/awesome-lisp-languages)
|
||||
|
||||
[lisp-µhttpd (game website & webserver) ](./www/README.md)
|
||||
|
||||
[lisp-mmo-server (game backend) using picolisp](./server/README.md)
|
||||
|
||||
[lisp-mmo-client (game frontend / UI) using common lisp](./client/README.md)
|
|
@ -0,0 +1,50 @@
|
|||
#!/usr/bin/env racket
|
||||
#lang racket/base
|
||||
|
||||
(module+ main
|
||||
(require raylib/generated/unsafe)
|
||||
|
||||
(define (sync-camera camera camera_pos target_pos)
|
||||
(set-Camera3D-target! camera target_pos)
|
||||
(set-Vector3-x! camera_pos (Vector3-x target_pos))
|
||||
(set-Vector3-y! camera_pos (+ (Vector3-y target_pos) 10.0))
|
||||
(set-Vector3-z! camera_pos (+ (Vector3-z target_pos) 10.0))
|
||||
(set-Camera3D-position! camera camera_pos))
|
||||
|
||||
(define (move-user camera pos scale)
|
||||
(when (IsKeyDown KEY_RIGHT)
|
||||
(set-Vector3-x! pos (+ (Vector3-x (Camera3D-target camera)) scale)))
|
||||
(when (IsKeyDown KEY_LEFT)
|
||||
(set-Vector3-x! pos (- (Vector3-x (Camera3D-target camera)) scale)))
|
||||
(when (IsKeyDown KEY_UP)
|
||||
(set-Vector3-z! pos (- (Vector3-z (Camera3D-target camera)) scale)))
|
||||
(when (IsKeyDown KEY_DOWN)
|
||||
(set-Vector3-z! pos (+ (Vector3-z (Camera3D-target camera)) scale))))
|
||||
|
||||
(InitWindow 800 450 "racket lisp client : raylib")
|
||||
|
||||
(define camera_pos (make-Vector3 0.0 12.0 14.0))
|
||||
(define target_pos (make-Vector3 0.0 2.0 0.0))
|
||||
|
||||
(define camera (make-Camera3D camera_pos target_pos (make-Vector3 0.0 1.0 0.0) 60.0 CAMERA_PERSPECTIVE))
|
||||
|
||||
(SetTargetFPS 60)
|
||||
|
||||
(let loop ()
|
||||
(when (not (WindowShouldClose))
|
||||
(BeginDrawing)
|
||||
(ClearBackground RAYWHITE)
|
||||
|
||||
(move-user camera target_pos 0.2)
|
||||
(sync-camera camera camera_pos target_pos)
|
||||
|
||||
(BeginMode3D camera)
|
||||
|
||||
(DrawGrid 30 1.0)
|
||||
(DrawCube (Camera3D-target camera) 0.5 0.5 0.5 PURPLE)
|
||||
|
||||
(EndMode3D)
|
||||
(EndDrawing)
|
||||
(loop)))
|
||||
|
||||
(CloseWindow))
|
Loading…
Reference in New Issue