summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bytepusher.scm44
-rw-r--r--manifest.scm7
2 files changed, 28 insertions, 23 deletions
diff --git a/bytepusher.scm b/bytepusher.scm
index 19cdeae..d72aaf4 100644
--- a/bytepusher.scm
+++ b/bytepusher.scm
@@ -114,23 +114,29 @@
(call-with-renderer
(make-renderer w)
(lambda (renderer)
- (set-renderer-scale! renderer 4 4)
- (clear-renderer renderer)
- (render-copy renderer
- (surface->texture
- renderer
- (bytevector->surface (get-pixels)
- width
- height
- 32
- (* width 4))))
-
- (present-renderer renderer)
- (sleep 10)))))
+ (set-renderer-scale! renderer scale scale)
+ (let ((texture (make-display-texture renderer)))
+ (clear-renderer renderer)
+ (load-display! texture)
+ (render-copy renderer texture)
+ (present-renderer renderer)
+ (sleep 10))))))
(sdl-quit))
;; ---- debug
+;; rendering ----
+(define (make-display-texture renderer)
+ (make-texture renderer 'argb8888 'streaming width height))
+
+(define (load-display! texture)
+ (update-texture texture
+ (make-rect 0 0 width height)
+ (get-pixels)
+ (* width 4)))
+;; ---- rendering
+
+
;; main operation ----
(define (load-program! path)
@@ -152,20 +158,14 @@
(unless (= count 0) (loop (- count 1)))))
(define (loop! renderer)
+ (define texture (make-display-texture renderer))
(set-renderer-scale! renderer 4 4)
(let loop ()
(let ((t0 (sdl-ticks)))
(loop-frame!)
(clear-renderer renderer)
- ;; TODO: Too many copies, improve upstream in Guile-SDL2
- (render-copy renderer
- (surface->texture
- renderer
- (bytevector->surface (get-pixels)
- width
- height
- 32
- (* width 4))))
+ (load-display! texture)
+ (render-copy renderer texture)
(present-renderer renderer)
(let ((t1 (sdl-ticks)))
(unless (> t1 (+ t0 1000/60))
diff --git a/manifest.scm b/manifest.scm
index 54d99a5..d8259c6 100644
--- a/manifest.scm
+++ b/manifest.scm
@@ -1 +1,6 @@
-(specification->manifest (list "guile" "guile-sdl2"))
+(use-modules (gnu packages guile)
+ (guix utils))
+
+(define guile-sdl2 (load "../guile-sdl2/guix.scm"))
+
+(packages->manifest (list guile-3.0-latest guile-sdl2))