跳到主要内容

convertToScreenCoords 将场景坐标转换为屏幕坐标

convertToScreenCoords

类型: MethodDeclaration

定义位置: camera.ts

描述

将场景坐标转换为屏幕坐标

参数 scenePos: 拥有场景坐标的对象

返回值:场景坐标点(公共)

参数

参数名类型描述默认值
scenePosPoint--

返回值

类型: Point

场景坐标点(公共)

源代码

位置: 第 412 行

public convertToScreenCoords(scenePos: Point): Point {
const point = Scene.sharedPoint
const x = scenePos.x * Scene.binding!.tileWidth
const y = scenePos.y * Scene.binding!.tileHeight
point.x = (x - this.scrollLeft) / this.width * GL.width
point.y = (y - this.scrollTop) / this.height * GL.height
return point
}

文档生成时间:2025/7/7 12:07:06