Make the size of elements the same in pgtk and X in tetris
* lisp/play/gamegrid.el (gamegrid-glyph-height-mm): Decrease height a bit (since it wasn't really that height). (gamegrid-calculate-glyph-size): Change calculation to work on both X and pgtk (bug#49937). (gamegrid-make-glyph): Inhibit image scaling.
This commit is contained in:
parent
d921424891
commit
f421efdb5f
1 changed files with 17 additions and 8 deletions
|
@ -72,7 +72,7 @@ directory will be used.")
|
|||
(defvar gamegrid-mono-x-face nil)
|
||||
(defvar gamegrid-mono-tty-face nil)
|
||||
|
||||
(defvar gamegrid-glyph-height-mm 7.0
|
||||
(defvar gamegrid-glyph-height-mm 5.0
|
||||
"Desired glyph height in mm.")
|
||||
|
||||
;; ;;;;;;;;;;;;; glyph generation ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
@ -80,12 +80,20 @@ directory will be used.")
|
|||
(defun gamegrid-calculate-glyph-size ()
|
||||
"Calculate appropriate glyph size in pixels based on display resolution.
|
||||
Return a multiple of 8 no less than 16."
|
||||
(if (and (display-pixel-height) (display-mm-height))
|
||||
(let* ((y-pitch (/ (display-pixel-height) (float (display-mm-height))))
|
||||
(pixels (* y-pitch gamegrid-glyph-height-mm))
|
||||
(rounded (* (floor (/ (+ pixels 4) 8)) 8)))
|
||||
(max 16 rounded))
|
||||
16))
|
||||
(let ((atts (car (display-monitor-attributes-list)))
|
||||
y-pitch)
|
||||
(setq y-pitch (cond
|
||||
(atts
|
||||
(/ (nth 4 (assq 'geometry atts))
|
||||
(nth 2 (assq 'mm-size atts))
|
||||
(or (cdr (assq 'scale-factor atts)) 1.0)))
|
||||
((and (display-pixel-height) (display-mm-height))
|
||||
(/ (display-pixel-height) (float (display-mm-height))))))
|
||||
(if y-pitch
|
||||
(let* ((pixels (* y-pitch gamegrid-glyph-height-mm))
|
||||
(rounded (* (floor (/ (+ pixels 4) 8)) 8)))
|
||||
(max 16 rounded))
|
||||
16)))
|
||||
|
||||
;; Example of glyph in XPM format:
|
||||
;;
|
||||
|
@ -336,7 +344,8 @@ format."
|
|||
|
||||
(defun gamegrid-make-glyph (data-spec-list color-spec-list)
|
||||
(let ((data (gamegrid-match-spec-list data-spec-list))
|
||||
(color (gamegrid-match-spec-list color-spec-list)))
|
||||
(color (gamegrid-match-spec-list color-spec-list))
|
||||
(image-scaling-factor 1.0))
|
||||
(cond ((characterp data)
|
||||
(vector data))
|
||||
((eq data 'colorize)
|
||||
|
|
Loading…
Add table
Reference in a new issue