本文整理匯總了Java中com.badlogic.gdx.graphics.OrthographicCamera.unproject方法的典型用法代碼示例。如果您正苦於以下問題:Java OrthographicCamera.unproject方法的具體用法?Java OrthographicCamera.unproject怎麽用?Java OrthographicCamera.unproject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.graphics.OrthographicCamera
的用法示例。
在下文中一共展示了OrthographicCamera.unproject方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: touchInRectangle
import com.badlogic.gdx.graphics.OrthographicCamera; //導入方法依賴的package包/類
public static boolean touchInRectangle(Rectangle r, OrthographicCamera camera) {
if (Gdx.input.isTouched()) {
Vector3 touchPos = new Vector3();
touchPos.set(Gdx.input.getX(), Gdx.input.getY(), 0);
camera.unproject(touchPos);
return r.x <= touchPos.x && r.x + r.width >= touchPos.x
&& r.y <= touchPos.y && r.y + r.height >= touchPos.y;
}
return false;
}
示例2: unprojectWorld
import com.badlogic.gdx.graphics.OrthographicCamera; //導入方法依賴的package包/類
/**
* Translates a point from screen coordinates to world coordinates.<br>
* This method returns an internally cached vector instance, do not store this instance!
*
* @param x the x position of the point
* @param y the y position of the point
*
* @return the point position in world coordinates.
*/
public static Vector2 unprojectWorld(float x, float y) {
v3.set(x, y, 0);
OrthographicCamera camera = GameManager.getWorldCamera();
camera.unproject(v3);
v2.set(v3.x, v3.y);
return v2;
}
示例3: unprojectGui
import com.badlogic.gdx.graphics.OrthographicCamera; //導入方法依賴的package包/類
/**
* Translate a point from screen coordinates to gui coordinates.<br>
* This method returns an internally cached vector instance, do not store this instance!
*
* @param x the x position of the point
* @param y the y position of the point
*
* @return the point position in world coordinates.
*/
public static Vector2 unprojectGui(float x, float y) {
v3.set(x, y, 0);
OrthographicCamera camera = GameManager.getGuiCamera();
camera.unproject(v3);
v2.set(v3.x, v3.y);
return v2;
}