| Paste number 79165: | An OpenRM/OpenGL backend for SDL in just a few lines of Common Lisp code. |
| Pasted by: | Balooga |
| When: | 1 year, 4 months ago |
| Share: | Tweet this! | http://paste.lisp.org/+1P31 |
| Channel: | #lisp |
| Paste contents: |
(defun sdl-backend ()
(make-instance 'rm::sdl-window
:width 320 :height 240
:title-caption "Using OpenRM as a backend for SDL."
:icon-caption "Using OpenRM as a backend for SDL.")
(make-instance 'rm:scene
:window (rm::default-window)
:camera (make-instance 'rm::camera-2d)
:viewport #(0.0 0.0 1.0 1.0)
:compute-view-from-geometry nil)
(let* ((surface (sdl:create-surface 100 100))
(image (rm::load-image surface))
(sprite (rm::new-sprite :xy/z (calculate-image-center (rm::default-window) image)
:images image)))
(rm::add-node sprite (rm::default-scene))
(setf (sdl:frame-rate) nil)
(sdl:with-events ()
(:key-down-event ()
(sdl:push-quit-event))
(:quit-event () t)
(:idle ()
(sdl:fill-surface (sdl:color :r (random 255) :g (random 255) :b (random 255) :a (random 255))
:surface surface)
(rm::render (rm::default-window)))))
(rm::clean-up))
This paste has no annotations.