當前位置: 首頁>>代碼示例>>Java>>正文


Java OrthographicCamera.unproject方法代碼示例

本文整理匯總了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;
   }
 
開發者ID:game-libgdx-unity,項目名稱:GDX-Engine,代碼行數:11,代碼來源:Utils.java

示例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;
}
 
開發者ID:Benjozork,項目名稱:Onyx,代碼行數:17,代碼來源:Utils.java

示例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;
}
 
開發者ID:Benjozork,項目名稱:Onyx,代碼行數:17,代碼來源:Utils.java


注:本文中的com.badlogic.gdx.graphics.OrthographicCamera.unproject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。