15 lines
641 B
TypeScript
15 lines
641 B
TypeScript
import { ensureRendererRegistry } from '../global'
|
|
import { getOrLoadImage, drawCenteredImage } from '../utils/image'
|
|
|
|
const registry = ensureRendererRegistry()
|
|
|
|
registry.christmas_tree = function(context: CanvasRenderingContext2D, x: number, y: number, r: number){
|
|
const assets = (window.YooneSnowSettings && (window.YooneSnowSettings as any).assetsMap) ? (window.YooneSnowSettings as any).assetsMap as Record<string,string> : {}
|
|
const url = assets['christmas_tree'] || ''
|
|
const rec = getOrLoadImage(url)
|
|
if (!rec || !rec.ready || !rec.img) return
|
|
const h = r * 8
|
|
const w = h
|
|
drawCenteredImage(context, rec.img, x, y, w, h)
|
|
}
|