[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/pacmacs b8d1136c3a 014/472: Extract pacman-anim module (#1
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/pacmacs b8d1136c3a 014/472: Extract pacman-anim module (#19) |
Date: |
Thu, 6 Jan 2022 21:59:01 -0500 (EST) |
branch: elpa/pacmacs
commit b8d1136c3a329d2d7c831b530ef5392f39055a54
Author: rexim <reximkut@gmail.com>
Commit: rexim <reximkut@gmail.com>
Extract pacman-anim module (#19)
---
pacman-anim.el | 18 ++++++++++++++++++
pacman.el | 20 ++------------------
test/{pacman-test.el => pacman-anim-test.el} | 3 +--
test/test-helper.el | 2 +-
4 files changed, 22 insertions(+), 21 deletions(-)
diff --git a/pacman-anim.el b/pacman-anim.el
new file mode 100644
index 0000000000..82418f7204
--- /dev/null
+++ b/pacman-anim.el
@@ -0,0 +1,18 @@
+(defun pacman-anim-get-frame (anim)
+ (let ((frames (plist-get anim :frames))
+ (current-frame (plist-get anim :current-frame)))
+ (nth current-frame frames)))
+
+(defun pacman-anim-next-frame (anim)
+ (let* ((frames (plist-get anim :frames))
+ (current-frame (plist-get anim :current-frame))
+ (new-current-frame (mod (+ current-frame 1)
+ (length frames))))
+ (plist-put anim :current-frame new-current-frame)))
+
+(defun pacman-anim-object-next-frame (anim-object)
+ (let ((anim (plist-get anim-object :animation)))
+ (plist-put anim-object :animation
+ (pacman-anim-next-frame anim))))
+
+(provide 'pacman-anim)
diff --git a/pacman.el b/pacman.el
index 464f4ef5e3..ae2475c503 100644
--- a/pacman.el
+++ b/pacman.el
@@ -27,6 +27,8 @@
;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
;; SOFTWARE.
+(require 'pacman-anim)
+
(defconst pacman-buffer-name "*Pacman*")
(defvar pacman-timer nil)
@@ -61,24 +63,6 @@
(defun pacman-insert-image (resource resource-vector)
(insert-image resource " " nil resource-vector))
-;;;###autoload
-(defun pacman-anim-get-frame (anim)
- (let ((frames (plist-get anim :frames))
- (current-frame (plist-get anim :current-frame)))
- (nth current-frame frames)))
-
-(defun pacman-anim-next-frame (anim)
- (let* ((frames (plist-get anim :frames))
- (current-frame (plist-get anim :current-frame))
- (new-current-frame (mod (+ current-frame 1)
- (length frames))))
- (plist-put anim :current-frame new-current-frame)))
-
-(defun pacman-anim-object-next-frame (anim-object)
- (let ((anim (plist-get anim-object :animation)))
- (plist-put anim-object :animation
- (pacman-anim-next-frame anim))))
-
(defun pacman-start ()
(interactive)
(switch-to-buffer-other-window pacman-buffer-name)
diff --git a/test/pacman-test.el b/test/pacman-anim-test.el
similarity index 68%
rename from test/pacman-test.el
rename to test/pacman-anim-test.el
index b14ff48281..7e44a77dcb 100644
--- a/test/pacman-test.el
+++ b/test/pacman-anim-test.el
@@ -2,5 +2,4 @@
(let ((anim (list :frames (number-sequence 1 5)
:current-frame 2)))
(should (equal 3
- (pacman-anim-get-frame anim)
- ))))
+ (pacman-anim-get-frame anim)))))
diff --git a/test/test-helper.el b/test/test-helper.el
index 840eac6771..37e1e81a02 100644
--- a/test/test-helper.el
+++ b/test/test-helper.el
@@ -1,4 +1,4 @@
(require 'el-mock)
(add-to-list 'load-path ".")
-(load "pacman.el")
+(load "pacman-anim.el")
- [nongnu] elpa/pacmacs b8fce3e847 028/472: Add UT for pacman-convert-aseprite-frame function (#22), (continued)
- [nongnu] elpa/pacmacs b8fce3e847 028/472: Add UT for pacman-convert-aseprite-frame function (#22), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 179ea99635 021/472: Add our own sprites. Close #13, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs d0dc2eff12 027/472: Ad UT for pacman-anim-object-next-frame function (#22), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs abb1f366fb 031/472: Merge branch 'uts-for-aseprite-animation-support-22'. Close #22, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs fe05829cd3 004/472: Fix kill buffer problem. Close #7, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 0a532ddc58 011/472: Add gitignore, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 96ad2016a1 001/472: Add initial code for pacman game, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 8eddfbd0df 005/472: Implement resource application layer. Close #3, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs e75db415af 013/472: Enable travis. Close #14, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 646db1b62a 022/472: Kill game window on quit. Close #17, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs b8d1136c3a 014/472: Extract pacman-anim module (#19),
ELPA Syncer <=
- [nongnu] elpa/pacmacs 929fda2cb4 016/472: Define package in Cask file directly (#19), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 043c660152 038/472: Clean up usage instructions in README, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 58cf91b060 032/472: Enable undercover (#27), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 30b5c43879 040/472: License header (#28):, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 59b5b95c2d 039/472: Share the sprites source files. Close #25, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 5780c37396 044/472: Add UT for pacman-make-anim function, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 1f32ee2489 048/472: Implement board state (#5), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 1b26ae45fc 055/472: Convert sprites to XPM. Close #49, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 03a96041d9 056/472: Add a README note about limitations. Close #45, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 13593c3f25 003/472: Remove logging, ELPA Syncer, 2022/01/06