janet-lang / jaylib

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

add function to get RenderTexture inner texture field. #21

Closed AlecTroemel closed 3 years ago

AlecTroemel commented 3 years ago

this is useful to render at a different resolution then the window.

(use ../build/jaylib)

(set-trace-log-callback nil)

(init-window 800 600 "Test Game")
(set-target-fps 60)

(def target (load-render-texture 400 300))

(while (not (window-should-close))
  (begin-texture-mode target)
    (draw-circle 200 150 60 :black)
  (end-texture-mode)

  (begin-drawing)
    (clear-background :white)
    (draw-texture-ex (get-rendertexture-texture target) [0 0] 0 2 :white)
  (end-drawing))
(close-window)

thank you for this great library! I'm open to any suggestions :)

bakpakin commented 3 years ago

Looks pretty good, although with out usual naming convention I believe the function should be called get-render-texture-texture2d.