本文整理了Java中com.badlogic.gdx.Graphics.getType()
方法的一些代码示例,展示了Graphics.getType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graphics.getType()
方法的具体详情如下:
包路径:com.badlogic.gdx.Graphics
类名称:Graphics
方法名:getType
暂无
代码示例来源:origin: libgdx/libgdx
/** Returns the window handle from LWJGL needed by OIS. */
static public long getWindowHandle () {
// don't need a window handle for Mac OS X
if (IS_MAC) {
return 0;
}
try {
if (Gdx.graphics.getType() == GraphicsType.JGLFW)
return (Long)Gdx.graphics.getClass().getDeclaredMethod("getWindow").invoke(null);
if (Gdx.graphics.getType() == GraphicsType.LWJGL) {
if (Gdx.app.getClass().getName().equals("com.badlogic.gdx.backends.lwjgl.LwjglCanvas")) {
Class canvasClass = Class.forName("com.badlogic.gdx.backends.lwjgl.LwjglCanvas");
Object canvas = canvasClass.getDeclaredMethod("getCanvas").invoke(Gdx.app);
return (Long)invokeMethod(invokeMethod(SwingUtilities.windowForComponent((Component)canvas), "getPeer"), "getHWnd");
}
Class displayClass = Class.forName("org.lwjgl.opengl.Display");
Method getImplementation = displayClass.getDeclaredMethod("getImplementation", new Class[0]);
getImplementation.setAccessible(true);
Object display = getImplementation.invoke(null, (Object[])null);
Field field = display.getClass().getDeclaredField(IS_WINDOWS ? "hwnd" : "parent_window");
field.setAccessible(true);
return (Long)field.get(display);
}
} catch (Exception ex) {
throw new RuntimeException("Unable to get window handle.", ex);
}
return 0;
}
代码示例来源:origin: libgdx/libgdx
if(Gdx.graphics.getType() == GraphicsType.LWJGL3) {
className = "com.badlogic.gdx.controllers.lwjgl3.Lwjgl3ControllerManager";
} else {
代码示例来源:origin: com.badlogicgames.gdx/gdx-controllers-desktop
/** Returns the window handle from LWJGL needed by OIS. */
static public long getWindowHandle () {
// don't need a window handle for Mac OS X
if (IS_MAC) {
return 0;
}
try {
if (Gdx.graphics.getType() == GraphicsType.JGLFW)
return (Long)Gdx.graphics.getClass().getDeclaredMethod("getWindow").invoke(null);
if (Gdx.graphics.getType() == GraphicsType.LWJGL) {
if (Gdx.app.getClass().getName().equals("com.badlogic.gdx.backends.lwjgl.LwjglCanvas")) {
Class canvasClass = Class.forName("com.badlogic.gdx.backends.lwjgl.LwjglCanvas");
Object canvas = canvasClass.getDeclaredMethod("getCanvas").invoke(Gdx.app);
return (Long)invokeMethod(invokeMethod(SwingUtilities.windowForComponent((Component)canvas), "getPeer"), "getHWnd");
}
Class displayClass = Class.forName("org.lwjgl.opengl.Display");
Method getImplementation = displayClass.getDeclaredMethod("getImplementation", new Class[0]);
getImplementation.setAccessible(true);
Object display = getImplementation.invoke(null, (Object[])null);
Field field = display.getClass().getDeclaredField(IS_WINDOWS ? "hwnd" : "parent_window");
field.setAccessible(true);
return (Long)field.get(display);
}
} catch (Exception ex) {
throw new RuntimeException("Unable to get window handle.", ex);
}
return 0;
}
代码示例来源:origin: com.badlogicgames.gdx/gdx-controllers
if(Gdx.graphics.getType() == GraphicsType.LWJGL3) {
className = "com.badlogic.gdx.controllers.lwjgl3.Lwjgl3ControllerManager";
} else {
内容来源于网络,如有侵权,请联系作者删除!