emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/pacmacs f79355209d 060/472: Refactor out functions for cre


From: ELPA Syncer
Subject: [nongnu] elpa/pacmacs f79355209d 060/472: Refactor out functions for creating images (#51)
Date: Thu, 6 Jan 2022 21:59:13 -0500 (EST)

branch: elpa/pacmacs
commit f79355209d0365936b01f25d4e70965c8fd0ed03
Author: rexim <reximkut@gmail.com>
Commit: rexim <reximkut@gmail.com>

    Refactor out functions for creating images (#51)
---
 pacman-resources.el | 13 +++++++++++++
 pacman.el           | 14 ++++----------
 2 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/pacman-resources.el b/pacman-resources.el
index 87b9a9327d..781ca7d8d1 100644
--- a/pacman-resources.el
+++ b/pacman-resources.el
@@ -39,6 +39,19 @@
 (defun pacman-insert-image (resource resource-vector)
   (insert-image resource " " nil resource-vector))
 
+(defun pacman-create-color-block (width height color)
+  (create-image
+   (make-vector
+    width (make-bool-vector height t))
+   'xbm t :width width :height height
+   :foreground color))
+
+(defun pacman-create-transparent-block (width height)
+  (create-image
+   (make-vector
+    width (make-bool-vector height nil))
+   'xbm t :width width :height height))
+
 (provide 'pacman-resources)
 
 ;;; pacman-anim.el ends here
diff --git a/pacman.el b/pacman.el
index dbff9f7b22..cd4dc6437b 100644
--- a/pacman.el
+++ b/pacman.el
@@ -69,19 +69,13 @@
                                          "sprites/Pacman-Chomping-Right.xpm")))
 (defvar pacman-empty-cell nil)
 (setq pacman-empty-cell
-      (list :animation (pacman-make-anim '((0 0 40 40))
-                                         (create-image
-                                          (make-vector
-                                           40 (make-bool-vector 40 nil))
-                                          'xbm t :width 40 :height 40))))
+      (list :animation
+            (pacman-make-anim '((0 0 40 40))
+                              (pacman-create-transparent-block 40 40))))
 
 (defun pacman--make-wall-cell (row column)
   (list :animation (pacman-make-anim '((0 0 40 40))
-                                     (create-image
-                                      (make-vector
-                                       40 (make-bool-vector 40 t))
-                                      'xbm t :width 40 :height 40
-                                      :foreground "red"))
+                                     (pacman-create-color-block 40 40 "red"))
         :row row
         :column column))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]