[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/pacmacs 3070cf0e6a 063/472: Merge branch 'refactor-image-r
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/pacmacs 3070cf0e6a 063/472: Merge branch 'refactor-image-resource-51'. Close #51 |
Date: |
Thu, 6 Jan 2022 21:59:13 -0500 (EST) |
branch: elpa/pacmacs
commit 3070cf0e6ade12d3f191e72493cce151d8616613
Merge: 1414723d42 298b950310
Author: rexim <reximkut@gmail.com>
Commit: rexim <reximkut@gmail.com>
Merge branch 'refactor-image-resource-51'. Close #51
---
pacman-anim.el | 4 ++--
pacman-resources.el => pacman-image.el | 19 ++++++++++++++++---
pacman.el | 16 +++++-----------
test/pacman-anim-test.el | 2 +-
4 files changed, 24 insertions(+), 17 deletions(-)
diff --git a/pacman-anim.el b/pacman-anim.el
index 8dedc4b128..4fe3b118e4 100644
--- a/pacman-anim.el
+++ b/pacman-anim.el
@@ -34,7 +34,7 @@
(require 'json)
-(require 'pacman-resources)
+(require 'pacman-image)
(defun pacman-make-anim (frames sprite-sheet)
(list :frames frames
@@ -44,7 +44,7 @@
(defun pacman-load-anim (aseprite-json-file sprite-sheet-file)
(let* ((aseprite-json (json-read-file aseprite-json-file))
(aseprite-frames (cdr (assoc 'frames aseprite-json)))
- (sprite-sheet (pacman-load-resource sprite-sheet-file)))
+ (sprite-sheet (pacman-load-image sprite-sheet-file)))
(pacman-make-anim
(mapcar 'pacman-convert-aseprite-frame
(sort aseprite-frames
diff --git a/pacman-resources.el b/pacman-image.el
similarity index 77%
rename from pacman-resources.el
rename to pacman-image.el
index 87b9a9327d..df1849c2b2 100644
--- a/pacman-resources.el
+++ b/pacman-image.el
@@ -1,4 +1,4 @@
-;;; pacman-resources.el --- Pacman for Emacs
+;;; pacman-image.el --- Pacman for Emacs
;; Copyright (C) 2015 Codingteam
@@ -32,13 +32,26 @@
;;; Code:
-(defun pacman-load-resource (filename)
+(defun pacman-load-image (filename)
(create-image (concat default-directory filename)
'xpm nil :heuristic-mask t))
(defun pacman-insert-image (resource resource-vector)
(insert-image resource " " nil resource-vector))
-(provide 'pacman-resources)
+(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-image)
;;; pacman-anim.el ends here
diff --git a/pacman.el b/pacman.el
index dbff9f7b22..2ddfbeec99 100644
--- a/pacman.el
+++ b/pacman.el
@@ -36,7 +36,7 @@
;;; Code:
(require 'pacman-anim)
-(require 'pacman-resources)
+(require 'pacman-image)
(require 'pacman-utils)
(defconst pacman-buffer-name "*Pacman*")
@@ -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))
diff --git a/test/pacman-anim-test.el b/test/pacman-anim-test.el
index 7db3407348..c82dc1b6aa 100644
--- a/test/pacman-anim-test.el
+++ b/test/pacman-anim-test.el
@@ -84,6 +84,6 @@
input-sprite-sheet)))
(with-mock
(mock (json-read-file *) => input-aseprite-format)
- (mock (pacman-load-resource *) => input-sprite-sheet)
+ (mock (pacman-load-image *) => input-sprite-sheet)
(should (equal expected-output
(pacman-load-anim "foo" "bar"))))))
- [nongnu] elpa/pacmacs 9b2c497eb9 431/472: Handle error during level list loading (#191), (continued)
- [nongnu] elpa/pacmacs 9b2c497eb9 431/472: Handle error during level list loading (#191), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 2cf174ca7e 434/472: Create signs folder with game over sign (#191), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 7d4356c92c 445/472: Implement pacmacs-score-awesome (#203), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 0f4eb7aebf 452/472: Decouple score page render from sign render (#203), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs a12795e835 455/472: Introduce pacmacs-scores-mode (#203), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs cdae42dba5 461/472: Replace too specific function with composition, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 864fe2b02e 465/472: Bump the copyright year for all the files, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs edadbe5e53 469/472: Bump version to 0.1, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs db16fba9cd 470/472: Add missing license statement, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 98ce700143 023/472: Hide cursor in the game's buffer. Close #12, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 3070cf0e6a 063/472: Merge branch 'refactor-image-resource-51'. Close #51,
ELPA Syncer <=
- [nongnu] elpa/pacmacs 1a678dfee7 110/472: Refactor out pacmacs--object-at-p (#74), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 5492ed0a87 118/472: Refactor pacmacs-render-state (#74), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs b5078d2632 141/472: Move most of the rendering stuff to pacman-render, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs a460cd8b06 148/472: Merge pull request #107 from rexim/feature/new-maps, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs c426f6ac91 078/472: Fix some accidental paredit typo, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 4341b23d87 094/472: Implement wraparound. Close #67, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 12942ddeff 113/472: Refactor out pacmacs--fill-board (#74), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 91408c074d 115/472: Refactor pacmacs--track-object (#74), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs ed40addf95 116/472: Refactor pacmacs--put-object (#74), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs eac9d47c62 117/472: Refactor pacmacs-render-track-board (#74), ELPA Syncer, 2022/01/06