diff options
author | Glenn Morris <rgm@gnu.org> | 2018-09-20 07:50:34 -0700 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2018-09-20 07:50:34 -0700 |
commit | 44c1ce3a370ed94199751d1429a65f40880b9234 (patch) | |
tree | c797f1b9a2aa388b2bfdd9ebe7b2a7555088d5ae /lisp/play | |
parent | 229c51afbf741b20504b821e6fd5da4145a776f5 (diff) | |
parent | d28d54c76754759e5f0fc8254541fbb4ef6a21d8 (diff) | |
download | emacs-44c1ce3a370ed94199751d1429a65f40880b9234.tar.gz |
Merge from origin/emacs-26
d28d54c (origin/emacs-26) More accurate docs for 'text-char-description'
b3baf99 Document synchronous behavior of eshell/make (Bug#32513)
98544ea Fix bs-show with wide characters (Bug#17822)
85af51b Improve Custom menu labels for 2 options
72a2a36 Improve wording of last change in dired-x.texi
d4fa83b Fix GnuTLS test suite with GnuTLS versions 3.4.x
b5bee6b Fix build with gnutls versions 3.0 to 3.2 (Bug#32446)
67eb80e ; * etc/enriched.txt (hanging-indents): Remove extra indent.
c71cfb7 Fix the Bubbles game on TTY frames
3bbf21b Add choice to reshow certificate information (Bug#31877)
6f2c471 * src/alloc.c (Fbool_vector, Flist, Fvector): Doc tweak.
39eecb3 * src/alloc.c (vector): Fix grammatical error in doc string: ...
Diffstat (limited to 'lisp/play')
-rw-r--r-- | lisp/play/bubbles.el | 64 |
1 files changed, 30 insertions, 34 deletions
diff --git a/lisp/play/bubbles.el b/lisp/play/bubbles.el index e30838dfca4..ee2135b9bbe 100644 --- a/lisp/play/bubbles.el +++ b/lisp/play/bubbles.el @@ -250,10 +250,10 @@ Available modes are `shift-default' and `shift-always'." "Indicate whether images have been created successfully.") (defvar bubbles--col-offset 0 - "Horizontal offset for centering the bubbles grid.") + "Horizontal offset for centering the bubbles grid, in pixels.") (defvar bubbles--row-offset 0 - "Vertical offset for centering the bubbles grid.") + "Vertical offset for centering the bubbles grid, in pixels.") (defvar bubbles--save-data nil "List containing bubbles save data (SCORE BUFFERCONTENTS).") @@ -960,33 +960,26 @@ columns on its right towards the left. (defun bubbles--compute-offsets () "Update horizontal and vertical offsets for centering the bubbles grid. Set `bubbles--col-offset' and `bubbles--row-offset'." - (cond ((and (display-images-p) - bubbles--images-ok - (not (eq bubbles-graphics-theme 'ascii)) - (fboundp 'window-inside-pixel-edges)) - ;; compute offset in units of pixels - (let ((bubbles--image-size - (car (image-size (car bubbles--images) t)))) - (setq bubbles--col-offset - (list - (max 0 (/ (- (nth 2 (window-inside-pixel-edges)) - (nth 0 (window-inside-pixel-edges)) - (* ( + bubbles--image-size 2) ;; margin - (bubbles--grid-width))) 2)))) - (setq bubbles--row-offset - (list - (max 0 (/ (- (nth 3 (window-inside-pixel-edges)) - (nth 1 (window-inside-pixel-edges)) - (* (+ bubbles--image-size 1) ;; margin - (bubbles--grid-height))) 2)))))) - (t - ;; compute offset in units of chars - (setq bubbles--col-offset - (max 0 (/ (- (window-width) - (bubbles--grid-width)) 2))) - (setq bubbles--row-offset - (max 0 (/ (- (window-height) - (bubbles--grid-height) 2) 2)))))) + (let* ((use-images-p (and (display-images-p) + bubbles--images-ok + (not (eq bubbles-graphics-theme 'ascii)))) + (bubbles--image-size + (if use-images-p (car (image-size (car bubbles--images) t)) 1)) + ;; In GUI mode, leave thin margins around the images. + (image-hor-size + (if use-images-p (+ bubbles--image-size 2) bubbles--image-size)) + (image-vert-size + (if use-images-p (1+ bubbles--image-size) bubbles--image-size))) + (setq bubbles--col-offset + (max 0 (/ (- (nth 2 (window-body-pixel-edges)) + (nth 0 (window-body-pixel-edges)) + (* image-hor-size (bubbles--grid-width))) + 2))) + (setq bubbles--row-offset + (max 0 (/ (- (nth 3 (window-body-pixel-edges)) + (nth 1 (window-body-pixel-edges)) + (* image-vert-size (bubbles--grid-height))) + 2))))) (defun bubbles--remove-overlays () "Remove all overlays." @@ -1007,7 +1000,8 @@ Set `bubbles--col-offset' and `bubbles--row-offset'." (insert " ") (put-text-property (point-min) (point) 'display - (cons 'space (list :height bubbles--row-offset))) + (cons 'space (list :height + (list bubbles--row-offset)))) (insert "\n") (let ((max-char (length (bubbles--colors)))) (dotimes (i (bubbles--grid-height)) @@ -1015,7 +1009,8 @@ Set `bubbles--col-offset' and `bubbles--row-offset'." (insert " ") (put-text-property p (point) 'display - (cons 'space (list :width bubbles--col-offset)))) + (cons 'space (list :width + (list bubbles--col-offset))))) (dotimes (j (bubbles--grid-width)) (let* ((index (random max-char)) (char (nth index bubbles-chars))) @@ -1025,7 +1020,8 @@ Set `bubbles--col-offset' and `bubbles--row-offset'." (insert "\n ") (put-text-property (1- (point)) (point) 'display - (cons 'space (list :width bubbles--col-offset)))) + (cons 'space (list :width + (list bubbles--col-offset))))) (put-text-property (point-min) (point-max) 'pointer 'arrow)) (bubbles-mode) (bubbles--reset-score) @@ -1177,7 +1173,7 @@ Use optional parameter POS instead of point if given." (insert " ") (put-text-property (1- (point)) (point) 'display - (cons 'space (list :width bubbles--col-offset))) + (cons 'space (list :width (list bubbles--col-offset)))) (insert (format "Score: %4d" bubbles--score)) (put-text-property pos (point) 'status t)))) @@ -1197,7 +1193,7 @@ Use optional parameter POS instead of point if given." (insert "\n ") (put-text-property (1- (point)) (point) 'display - (cons 'space (list :width bubbles--col-offset))) + (cons 'space (list :width (list bubbles--col-offset)))) (insert "Game Over!")) ;; save score (gamegrid-add-score (format "bubbles-%s-%d-%d-%d-scores" |