|
一、[code=javascript]//鼠标样式更换为guiText
//将js文件链接到guiText对象即可
function Start()
{
Screen.showCursor=false;
}
function Update()
{
var msPos=Input.mousePosition;
var imgX=msPos.x-Screen.width/2;
var imgY=msPos.y-Screen.height/2;
guiText.pixelOffset =Vector2(imgX,imgY);
}[/code]
二、
[code=javascript]//用guiTexture代替鼠标样式
//将js链接到guiTexture对象即可
static var curRc=new Rect(0,0,20,20);
function Start()
{
Screen.showCursor=false;
}
function Update()
{
var msPos=Input.mousePosition;
curRc.x=msPos.x-Screen.width/2;
curRc.y=msPos.y-Screen.height/2;
guiTexture.pixelInset=curRc;
}[/code]
|
|