本文整理了Java中com.jme3.app.Application.getContext()
方法的一些代码示例,展示了Application.getContext()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Application.getContext()
方法的具体详情如下:
包路径:com.jme3.app.Application
类名称:Application
方法名:getContext
暂无
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
public void initialize() {
logger.config("Initializing VR mouse manager.");
// load default mouseimage
mouseImage = new Picture("mouse");
setImage("Common/Util/mouse.png");
// hide default cursor by making it invisible
MouseInput mi = environment.getApplication().getContext().getMouseInput();
if( mi instanceof GlfwMouseInputVR ){
((GlfwMouseInputVR)mi).hideActiveCursor();
}
centerMouse();
logger.config("Initialized VR mouse manager [SUCCESS]");
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
public void centerMouse() {
if (environment != null){
if (environment.getApplication() != null){
// set mouse in center of the screen if newly added
Vector2f size = environment.getVRGUIManager().getCanvasSize();
MouseInput mi = environment.getApplication().getContext().getMouseInput();
AppSettings as = environment.getApplication().getContext().getSettings();
if( mi instanceof GlfwMouseInputVR ) ((GlfwMouseInputVR)mi).setCursorPosition((int)(as.getWidth() / 2f), (int)(as.getHeight() / 2f));
if( environment.isInVR() ) {
cursorPos.x = size.x / 2f;
cursorPos.y = size.y / 2f;
recentCenterCount = 2;
}
} else {
throw new IllegalStateException("This VR environment is not attached to any application.");
}
} else {
throw new IllegalStateException("This VR view manager is not attached to any VR environment.");
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Get the ratio between the {@link #getCanvasSize() GUI canvas size} and the application main windows (if available) or the screen size.
* @return the ratio between the {@link #getCanvasSize() GUI canvas size} and the application main windows (if available).
* @see #getCanvasSize()
*/
public Vector2f getCanvasToWindowRatio() {
if (environment != null){
if (environment.getApplication() != null){
if( ratio == null ) {
ratio = new Vector2f();
Vector2f canvas = getCanvasSize();
int width = Integer.min(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode().getWidth(),
environment.getApplication().getContext().getSettings().getWidth());
int height = Integer.min(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode().getHeight(),
environment.getApplication().getContext().getSettings().getHeight());
ratio.x = Float.max(1f, canvas.x / width);
ratio.y = Float.max(1f, canvas.y / height);
}
return ratio;
} else {
throw new IllegalStateException("VR GUI manager underlying environment is not attached to any application.");
}
} else {
throw new IllegalStateException("VR GUI manager is not attached to any environment.");
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
if (size.x < environment.getApplication().getContext().getSettings().getWidth()) {
size.x = environment.getApplication().getContext().getSettings().getWidth();
if (size.y < environment.getApplication().getContext().getSettings().getHeight()) {
size.y = environment.getApplication().getContext().getSettings().getHeight();
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
if( size.x < environment.getApplication().getContext().getSettings().getWidth() ) {
size.x = environment.getApplication().getContext().getSettings().getWidth();
if( size.y < environment.getApplication().getContext().getSettings().getHeight() ) {
size.y = environment.getApplication().getContext().getSettings().getHeight();
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
if( size.x < environment.getApplication().getContext().getSettings().getWidth() ) {
size.x = environment.getApplication().getContext().getSettings().getWidth();
if( size.y < environment.getApplication().getContext().getSettings().getHeight() ) {
size.y = environment.getApplication().getContext().getSettings().getHeight();
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
if (size.x < environment.getApplication().getContext().getSettings().getWidth()) {
size.x = environment.getApplication().getContext().getSettings().getWidth();
if (size.y < environment.getApplication().getContext().getSettings().getHeight()) {
size.y = environment.getApplication().getContext().getSettings().getHeight();
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
int origWidth = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode().getWidth();
int origHeight = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode().getHeight();
long window = ((LwjglWindow)environment.getApplication().getContext()).getWindowHandle();
Vector2f windowSize = new Vector2f();
((OSVR)environment.getVRHardware()).getRenderSize(windowSize);
windowSize.x = Math.max(windowSize.x * 2f, leftCamera.getWidth());
org.lwjgl.glfw.GLFW.glfwSetWindowSize(window, (int)windowSize.x, (int)windowSize.y);
environment.getApplication().getContext().getSettings().setResolution((int)windowSize.x, (int)windowSize.y);
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Get the GUI canvas size. This method return the size in pixels of the GUI available area within the VR view.
* @return the GUI canvas size. This method return the size in pixels of the GUI available area within the VR view.
*/
public Vector2f getCanvasSize() {
if (environment != null){
if (environment.getApplication() != null){
if( screenSize == null ) {
if( environment.isInVR() && environment.getVRHardware() != null ) {
screenSize = new Vector2f();
environment.getVRHardware().getRenderSize(screenSize);
screenSize.multLocal(environment.getVRViewManager().getResolutionMuliplier());
} else {
AppSettings as = environment.getApplication().getContext().getSettings();
screenSize = new Vector2f(as.getWidth(), as.getHeight());
}
}
return screenSize;
} else {
throw new IllegalStateException("VR GUI manager underlying environment is not attached to any application.");
}
} else {
throw new IllegalStateException("VR GUI manager is not attached to any environment.");
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
if (environment.getApplication().getContext().getSettings().isSwapBuffers()) {
setupMirrorBuffers(environment.getCamera(), dualEyeTex, true);
if (environment.getApplication().getContext().getSettings().isSwapBuffers()) {
setupMirrorBuffers(environment.getCamera(), leftEyeTexture, false);
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
centerMouse();
if (environment.getApplication().getContext() instanceof LwjglWindow){
GLFW.glfwSetInputMode(((LwjglWindow)environment.getApplication().getContext()).getWindowHandle(), GLFW.GLFW_CURSOR, GLFW.GLFW_CURSOR_DISABLED);
MouseInput mi = environment.getApplication().getContext().getMouseInput();
if( mi instanceof GlfwMouseInputVR ) {
if( recentCenterCount <= 0 ) {
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
if( environment.getApplication().getContext().getSettings().isSwapBuffers() ) {
setupMirrorBuffers(environment.getCamera(), dualEyeTex, true);
if( environment.getApplication().getContext().getSettings().isSwapBuffers() ) {
setupMirrorBuffers(environment.getCamera(), leftEyeTexture, false);
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
if( environment.getApplication().getContext().getSettings().isSwapBuffers() ) {
setupMirrorBuffers(environment.getCamera(), dualEyeTex, true);
if( environment.getApplication().getContext().getSettings().isSwapBuffers() ) {
setupMirrorBuffers(environment.getCamera(), leftEyeTexture, false);
代码示例来源:origin: us.ihmc.thirdparty.jme/jme3-desktop
app.createCanvas();
context = (JmeCanvasContext) app.getContext();
canvas = context.getCanvas();
canvas.setSize(getWidth(), getHeight());
代码示例来源:origin: jMonkeyEngine-Contributions/Lemur
if (app.getContext().getTouchInput() == null) {
this.mouseState = new MouseAppState(app);
} else {
gammaEnabled = app.getContext().getSettings().isGammaCorrection();
内容来源于网络,如有侵权,请联系作者删除!