[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/pacmacs 8d63cc3f30 358/472: Multicolor walls (#138)
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/pacmacs 8d63cc3f30 358/472: Multicolor walls (#138) |
Date: |
Thu, 6 Jan 2022 21:59:39 -0500 (EST) |
branch: elpa/pacmacs
commit 8d63cc3f307fbcbf9b14bb14364bf37b65c726e8
Author: rexim <reximkut@gmail.com>
Commit: rexim <reximkut@gmail.com>
Multicolor walls (#138)
---
pacmacs-image.el | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/pacmacs-image.el b/pacmacs-image.el
index a0b8159130..8e67b91338 100644
--- a/pacmacs-image.el
+++ b/pacmacs-image.el
@@ -34,6 +34,10 @@
(require 'dash)
+(defconst pacmacs--wall-palette ["#1111bb"
+ "#3333dd"
+ "#5555ff"])
+
(defvar pacmacs--wall-blocks
(make-hash-table))
@@ -46,17 +50,17 @@
(defun pacmacs--put-bits-dot (bits row column weight)
(dotimes (i weight)
(dotimes (j weight)
- (aset (aref bits (+ i row)) (+ j column) t))))
+ (aset (aref bits (+ i row)) (+ j column) 0))))
(defun pacmacs--put-vertical-bar (bits column height weight)
(dotimes (w weight)
(dotimes (i height)
- (aset (aref bits i) (+ column w) t))))
+ (aset (aref bits i) (+ column w) w))))
(defun pacmacs--put-horizontal-bar (bits row width weight)
(dotimes (w weight)
(dotimes (i width)
- (aset (aref bits (+ row w)) i t))))
+ (aset (aref bits (+ row w)) i w))))
(defun pacmacs--bit-list-to-integer (bit-list)
(let ((result 0))
@@ -65,19 +69,30 @@
(if bit 1 0))))
result))
+(defun pacmacs--generate-xpm-palette (palette)
+ (let* ((n (length palette))
+ (palette-indices (number-sequence 0 (1- n))))
+ (->> (-map #'identity palette)
+ (-zip-with #'cons palette-indices)
+ (-map (-lambda ((index . color))
+ (format "\"%c c %s\",\n" (+ index ?a) color)))
+ (apply #'concat))))
+
(defun pacmacs--bits-to-xpm (bits width height)
(concat
"/* XPM */\n"
"static char *tile[] = {\n"
"/**/\n"
- (format "\"%d %d 2 1\",\n" width height)
+ (format "\"%d %d %d 1\",\n" width height (1+ (length
pacmacs--wall-palette)))
"\" c None\",\n"
- "\". c #5555ff\",\n"
+ (pacmacs--generate-xpm-palette pacmacs--wall-palette)
"/* pixels */\n"
(mapconcat
(lambda (row)
(format "\"%s\""
- (mapconcat (-lambda (bit) (if bit "." " ")) row "")))
+ (mapconcat (-lambda (bit)
+ (if bit (format "%c" (+ bit ?a)) " "))
+ row "")))
bits
",\n")
"\n};"))
- [nongnu] elpa/pacmacs 0103a77462 302/472: Remove replace-filtered-game-objects (#153), (continued)
- [nongnu] elpa/pacmacs 0103a77462 302/472: Remove replace-filtered-game-objects (#153), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs ee76ee2dc0 299/472: UT for pacmacs--run-away-direction (#153), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs cec13dd618 308/472: Fix Emacs 24.3 build fail (#159), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs e662ec9be7 313/472: Disable Emacs 24.3 in the Travis build (#165), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs fa83e10d82 325/472: Get rid of dup code in track object mech (#159), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 51117fc5db 336/472: Rename 5th big pill level accordingly (#162), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 0a33c04fc1 333/472: Add fourth big pill level (#162), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 402d176003 339/472: Remove unused functions (#171), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 71b977fd22 343/472: Transform it-recorder.el to an additional module, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs ad5cdc8efd 349/472: Add att.txt to gitignore, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 8d63cc3f30 358/472: Multicolor walls (#138),
ELPA Syncer <=
- [nongnu] elpa/pacmacs aed2853780 373/472: Move wall weight to the constants (#138), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 8166e4d3d7 363/472: Merge pull request #181 from codingteam/terrified-timer-reset-173, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 4679fcef60 381/472: Fix put-horizontal-bar UT (#138), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs b96be7f8d8 402/472: Fix text read only problem (#134), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 8836f12761 410/472: Kill the game buffer on initialization (#134), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 689c09287c 423/472: Add UT for step-ghosts func, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 0126187ee8 428/472: Merge pull request #197 from codingteam/sorting-score-table-on-read-write-194, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 988c61b190 432/472: Load leves from custom folder (#191), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 23d315e54f 437/472: Trigger MELPA update, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 66dd6b0aee 446/472: Enable truncate lines for score table (#203), ELPA Syncer, 2022/01/06