add strokeRect, strokeRect
This commit is contained in:
parent
4130c45449
commit
457931b28d
@ -30,6 +30,34 @@ export function fillRect(x, y, width, height, color) {
|
||||
ctx.fillRect(x, y, width, height);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw a rectangle outline.
|
||||
* @param {number} x
|
||||
* @param {number} y
|
||||
* @param {number} width
|
||||
* @param {number} height
|
||||
* @param {string} color
|
||||
*/
|
||||
export function strokeRect(x, y, width, height, color) {
|
||||
ctx.strokeStyle = color;
|
||||
ctx.lineWidth = 1;
|
||||
ctx.strokeRect(x, y, width, height);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} text
|
||||
* @param {number} x
|
||||
* @param {number} y
|
||||
* @param {string} color
|
||||
*/
|
||||
export function putText(text, x, y, color) {
|
||||
const fontSize = 24;
|
||||
ctx.fillStyle = color;
|
||||
ctx.font = `bold ${fontSize}px monospace`;
|
||||
ctx.fillText(text, x, y + fontSize);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Texture} texture
|
||||
|
Loading…
x
Reference in New Issue
Block a user