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

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

[nongnu] elpa/pacmacs e7abee5bd3 091/472: Lazy init of empty cell (#70)


From: ELPA Syncer
Subject: [nongnu] elpa/pacmacs e7abee5bd3 091/472: Lazy init of empty cell (#70)
Date: Thu, 6 Jan 2022 21:59:15 -0500 (EST)

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

    Lazy init of empty cell (#70)
---
 pacmacs.el | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/pacmacs.el b/pacmacs.el
index 9c7afb5919..90ec5badb1 100644
--- a/pacmacs.el
+++ b/pacmacs.el
@@ -72,10 +72,6 @@
 (defvar pacmacs-pills nil)
 
 (defvar pacmacs-empty-cell nil)
-(setq pacmacs-empty-cell
-      (list :current-animation
-            (pacmacs-make-anim (list (pacmacs-make-frame '(0 0 40 40) 100))
-                               (pacmacs-create-transparent-block 40 40))))
 
 (defvar pacmacs-board nil)
 (defvar pacmacs-track-board nil)
@@ -184,6 +180,14 @@
     (plist-put game-object :direction direction)
     (plist-put game-object :current-animation (plist-get direction-animations 
direction))))
 
+(defun pacmacs--make-empty-cell ()
+  (if pacmacs-empty-cell
+      pacmacs-empty-cell
+    (setq pacmacs-empty-cell
+          (list :current-animation
+                (pacmacs-make-anim (list (pacmacs-make-frame '(0 0 40 40) 100))
+                                   (pacmacs-create-transparent-block 40 
40))))))
+
 (defun pacmacs-step-object (game-object)
   (plist-bind ((row :row)
                (column :column)
@@ -337,9 +341,9 @@
     (pacmacs-render-track-board))
 
   (pacmacs--fill-board pacmacs-board
-                      pacmacs-board-width
-                      pacmacs-board-height
-                      pacmacs-empty-cell)
+                       pacmacs-board-width
+                       pacmacs-board-height
+                       (pacmacs--make-empty-cell))
 
   (pacmacs-put-object pacmacs-player-state)
 



reply via email to

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