defun-games / claylib

A Common Lisp 2D/3D game toolkit built on top of Raylib 4.5.
zlib License
69 stars 4 forks source link

check-collision-circle-rec isn't wrapped #67

Closed simendsjo closed 1 year ago

simendsjo commented 1 year ago

Tried to create a wrapper, but I end up just calling myself instead of the claylib/ll function :shrug:

Added the following to claylib/src/pt-functions, and exposed the check-collision-circle-rec function in claylib/ll:

(defun check-collision-circle-rec (circle rec)
  "Check if CIRCLE is inside REC."
  (check-type circle circle)
  (check-type rec rl-rectangle)
  (= 0 (claylib/ll:check-collision-circle-rec (c-struct (pos circle))
                                              (float (radius circle))
                                              (c-struct rec))))

But it recurses on itself. I have no idea how... (eq #'claylib:check-collision-circle-rec #'claylib/ll:check-collision-circle-rec) is T, but I don't know enough about lisp to see the next step in resolving why.

invalid number of arguments: 3
   [Condition of type SB-INT:SIMPLE-PROGRAM-ERROR]
Backtrace:
 0: (CHECK-COLLISION-CIRCLE-REC #<CLAYLIB/WRAP:VECTOR2 {#X7F524402D640}> 24.0 #<CLAYLIB/WRAP:RECTANGLE {#X7F5240000BA0}>) [external]
 1: (CHECK-COLLISION-CIRCLE-REC #<CIRCLE :RADIUS 24.0 :COLOR2 #<unbound-slot> :COLOR #<RL-COLOR :R 0 :G 0 :B 0 :A 255 #<RL-COLOR {10018DDD63}> {10018DDD63}> :FILLED T :POS #<VECTOR2 :X 80.0 :Y 209.0 #<VEC..
shelvick commented 1 year ago

You were close. :-) For these pass-through functions we have to export a new symbol and shadow the claylib/ll symbol. I'll push a fix shortly.