Graphical applications with raylib on 9front 2
This is a continuation of this post.
I recently also ported raylib-owl to run on 9front. It utilizes raylib9, as described in the previous article, alongside a port of owl lisp.
Installation
; hget https://pub.krzysckh.org/raylib9-owl.tgz | tar xvz
; cd raylib9-owl
; build.rc
; cp bin/ol-rl $home/bin/$objtype/ol-rl
if compilation gets stuck on re-building until a fixed point is
reached - kill the process and re-build.rc
it.
Usage
This is a sample Owl lisp program demonstrating basics of raylib.
(import
(owl toplevel)
(owl random)
(prefix (owl sys) sys/)
(raylib))
define *width* 400)
(define *height* 400)
(
define colors (vector red green blue))
(define n-glendas 150)
(
define (eeper)
(1000)
(sleep #t)
(mail 'threadmain
(eeper))
define (init-glendas)
(let loop ((r (seed->rands 42)) (acc ()))
(if (= (length acc) n-glendas) acc
(0 *width*))
(lets ((r x (rand-range r 0 *height*)))
(r y (rand-range r append acc (list (list x y))))))))
(loop r (
define (main args)
(
(with-window"a window"
*width* *height* let* ((pngdata (file->list "/tmp/g.png"))
(".png" pngdata))))
(g (image->texture (list->image let loop ((n 0) (gs (init-glendas)))
(let ((n (if (check-mail) (modulo (+ n 1) (vector-length colors)) n)))
(
(drawvector-ref colors n))
(clear-background (for-each (lambda (pos) (draw-texture g pos red)) gs)
(0 370))
(draw-fps '("Hello" '(0 0) 22 white))
(draw-text-simple
(next-thread)if (window-should-close?)
(
(catch-thread null)lambda (l) (list (car l) (modulo (+ 1 (cadr l)) *height*)))
(loop n (map (
gs))))))))
lambda (args)
("/bin/rc" "-c" "topng < /lib/face/48x48x4/g/glenda.1 > /tmp/g.png"))
(sys/system '(
(thread 'eeper (eeper)) (thread 'threadmain (main args)))
; ol-rl -r file.scm
Limitations ∧ Bugs
same as the c version plus
- scheme→c compilation seems to function correctly, yet compiled programs don't work,
- a lot more