kopia lustrzana https://github.com/ertdfgcvb/play.core
Invert default aspect ratio
rodzic
a09fbb1303
commit
d30b28fc54
|
@ -9,12 +9,12 @@ import { length } from '/src/modules/vec2.js'
|
|||
|
||||
export function main(coord, context, cursor, buffer) {
|
||||
|
||||
// contex.metrics.aspect contains the font (or cell) aspect ratio
|
||||
const aspectRatio = cursor.pressed ? context.metrics.aspect : 1
|
||||
// contex.metrics.aspect holds the font (or cell) aspect ratio
|
||||
const aspectRatio = cursor.pressed ? 1 : context.metrics.aspect
|
||||
|
||||
// Transform coordinate space to (-1, 1)
|
||||
// width corrected screen aspect (m) and cell aspect (aspectRatio)
|
||||
const m = Math.min(context.cols, context.rows)
|
||||
const m = Math.min(context.cols * aspectRatio, context.rows)
|
||||
const st = {
|
||||
x : 2.0 * (coord.x - context.cols / 2) / m * aspectRatio, // apply aspect
|
||||
y : 2.0 * (coord.y - context.rows / 2) / m
|
||||
|
@ -23,15 +23,15 @@ export function main(coord, context, cursor, buffer) {
|
|||
// Distance of each cell from the center (0, 0)
|
||||
const l = length(st)
|
||||
|
||||
// 0.6 is the radius of the circle
|
||||
return l < 0.6 ? 'X' : '.'
|
||||
// 0.7 is the radius of the circle
|
||||
return l < 0.7 ? 'X' : '.'
|
||||
}
|
||||
|
||||
// Draw some info
|
||||
import { drawBox } from '/src/modules/drawbox.js'
|
||||
export function post(context, cursor, buffer) {
|
||||
// Apply some rounding to the aspect for better output
|
||||
const ar = cursor.pressed ? (''+context.metrics.aspect).substr(0, 8) : 1
|
||||
const ar = cursor.pressed ? 1 : (''+context.metrics.aspect).substr(0, 8)
|
||||
|
||||
// Output string
|
||||
let text = ''
|
||||
|
|
Ładowanie…
Reference in New Issue