janet-lang / jaylib

Janet bindings to Raylib
MIT License
143 stars 37 forks source link

cannot accept floating point to integer functions #55

Open iacore opened 10 months ago

iacore commented 10 months ago

true code:

        (pp nearest-vertex)
        (draw-circle-gradient (splice nearest-vertex) 4.0 :lime :red))))
(264.160827636719 400)
error: bad slot #0, expected 32 bit signed integer, got 264.160827636719
  in jaylib/draw-circle-gradient
  in _thunk [main.janet] (tailcall) on line 42, column 9

Reproduction

(draw-circle-gradient [264.160827636719 400] 4.0 :lime :red)
sogaiu commented 10 months ago

Perhaps this is the current implementation for draw-circle-gradient. It looks like there is an underlying Raylib function named DrawCircleGradient.

Looking at this raylib cheatsheet, I see:

void DrawCircleGradient(int centerX, int centerY, float radius, Color color1, Color color2);       // Draw a gradient-filled circle

It looks like DrawCircleGradient wants the first 2 arguments to be of type int and currently the way those are arranged for is to use janet_getinteger.