Coder Social home page Coder Social logo

Comments (2)

longlene avatar longlene commented on July 22, 2024

ok, I encounter the same problem with update-camera and still no way to use struct and pointer to struct at the same time.
Maybe implement update-camera in pure Lisp is a way?

from cl-raylib.

olegharput avatar olegharput commented on July 22, 2024

check this example:

(defun input-keys ()
(let* ((screen-width 800)
(screen-height 450)
(ball-position (r::make-vector2 :x (/ screen-width 2.0) :y (/ screen-height 2.0))))
(unwind-protect
(progn
(r:init-window screen-width screen-height "raylib [core] example - keyboard input")
(r:set-target-fps 60)
(loop
:do
(when (r:is-key-down +key-right+)
(setf (r::vector2-x ball-position) (+ (r::vector2-x ball-position) 2.0)))
(when (r:is-key-down +key-left+)
(setf (r::vector2-x ball-position) (- (r::vector2-x ball-position) 2.0)))
(when (r:is-key-down +key-down+)
(setf (r::vector2-y ball-position) (+ (r::vector2-y ball-position) 2.0)))
(when (r:is-key-down +key-up+)
(setf (r::vector2-y ball-position) (- (r::vector2-y ball-position) 2.0)))
(r:begin-drawing)
(r:clear-background r:+raywhite+)
(r:draw-text "move the ball with arrow keys" 10 10 20 +darkgray+)
(r:draw-circle-v ball-position 50.0 +maroon+)
(r:end-drawing)
:until (r:window-should-close)))
(r:close-window))))

;; +key-right+=262
;; +key-left+=263
;; ...
;; check the others in https://github.com/longlene/cl-raylib/blob/master/src/raylib.lisp

from cl-raylib.

longlene avatar longlene commented on July 22, 2024

I'll close the issue as camera related API should be usable now.

from cl-raylib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.