本文整理汇总了Java中org.lwjgl.LWJGLUtil类的典型用法代码示例。如果您正苦于以下问题:Java LWJGLUtil类的具体用法?Java LWJGLUtil怎么用?Java LWJGLUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LWJGLUtil类属于org.lwjgl包,在下文中一共展示了LWJGLUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: destroy
import org.lwjgl.LWJGLUtil; //导入依赖的package包/类
public void destroy() {
synchronized ( GlobalLock.lock ) {
if ( context == null )
return;
try {
releaseContext();
context.forceDestroy();
context = null;
if ( peer_info != null ) {
peer_info.destroy();
peer_info = null;
}
} catch (LWJGLException e) {
LWJGLUtil.log("Exception occurred while destroying Drawable: " + e);
}
}
}
示例2: getNativeCursorCapabilities
import org.lwjgl.LWJGLUtil; //导入依赖的package包/类
public static int getNativeCursorCapabilities() {
if (LWJGLUtil.getPlatform() != LWJGLUtil.PLATFORM_MACOSX || LWJGLUtil.isMacOSXEqualsOrBetterThan(10, 4)) {
int cursor_colors = Toolkit.getDefaultToolkit().getMaximumCursorColors();
boolean supported = cursor_colors >= Short.MAX_VALUE && getMaxCursorSize() > 0;
int caps = supported ? org.lwjgl.input.Cursor.CURSOR_8_BIT_ALPHA | org.lwjgl.input.Cursor.CURSOR_ONE_BIT_TRANSPARENCY: 0 | org.lwjgl.input.Cursor.CURSOR_ANIMATION;
return caps;
} else {
/* Return no capability in Mac OS X 10.3 and earlier , as there are two unsolved bugs (both reported to apple along with
minimal test case):
1. When a custom cursor (or some standard) java.awt.Cursor is assigned to a
Componennt, it is reset to the default pointer cursor when the window is de-
activated and the re-activated. The Cursor can not be reset to the custom cursor,
with another setCursor.
2. When the cursor is moving in the top pixel row (y = 0 in AWT coordinates) in fullscreen
mode, no mouse moved events are reported, even though mouse pressed/released and dragged
events are reported
*/
return 0;
}
}
示例3: getPointerLocation
import org.lwjgl.LWJGLUtil; //导入依赖的package包/类
/**
* Use reflection to access the JDK 1.5 pointer location, if possible and
* only if the given component is on the same screen as the cursor. Return
* null otherwise.
*/
private static Point getPointerLocation(final Component component) {
try {
final GraphicsConfiguration config = component.getGraphicsConfiguration();
if (config != null) {
PointerInfo pointer_info = AccessController.doPrivileged(new PrivilegedExceptionAction<PointerInfo>() {
public PointerInfo run() throws Exception {
return MouseInfo.getPointerInfo();
}
});
GraphicsDevice device = pointer_info.getDevice();
if (device == config.getDevice()) {
return pointer_info.getLocation();
}
return null;
}
} catch (Exception e) {
LWJGLUtil.log("Failed to query pointer location: " + e.getCause());
}
return null;
}
示例4: lockAndGetHandle
import org.lwjgl.LWJGLUtil; //导入依赖的package包/类
public final synchronized ByteBuffer lockAndGetHandle() throws LWJGLException {
Thread this_thread = Thread.currentThread();
while (locking_thread != null && locking_thread != this_thread) {
try {
wait();
} catch (InterruptedException e) {
LWJGLUtil.log("Interrupted while waiting for PeerInfo lock: " + e);
}
}
if (lock_count == 0) {
locking_thread = this_thread;
doLockAndInitHandle();
}
lock_count++;
return getHandle();
}
示例5: isXrandrSupported
import org.lwjgl.LWJGLUtil; //导入依赖的package包/类
private static boolean isXrandrSupported() {
if (Display.getPrivilegedBoolean("LWJGL_DISABLE_XRANDR"))
return false;
lockAWT();
try {
incDisplay();
try {
return nIsXrandrSupported(getDisplay());
} finally {
decDisplay();
}
} catch (LWJGLException e) {
LWJGLUtil.log("Got exception while querying Xrandr support: " + e);
return false;
} finally {
unlockAWT();
}
}
示例6: isXF86VidModeSupported
import org.lwjgl.LWJGLUtil; //导入依赖的package包/类
private static boolean isXF86VidModeSupported() {
lockAWT();
try {
incDisplay();
try {
return nIsXF86VidModeSupported(getDisplay());
} finally {
decDisplay();
}
} catch (LWJGLException e) {
LWJGLUtil.log("Got exception while querying XF86VM support: " + e);
return false;
} finally {
unlockAWT();
}
}
示例7: isNetWMFullscreenSupported
import org.lwjgl.LWJGLUtil; //导入依赖的package包/类
private static boolean isNetWMFullscreenSupported() throws LWJGLException {
if (Display.getPrivilegedBoolean("LWJGL_DISABLE_NETWM"))
return false;
lockAWT();
try {
incDisplay();
try {
return nIsNetWMFullscreenSupported(getDisplay(), getDefaultScreen());
} finally {
decDisplay();
}
} catch (LWJGLException e) {
LWJGLUtil.log("Got exception while querying NetWM support: " + e);
return false;
} finally {
unlockAWT();
}
}
示例8: destroyWindow
import org.lwjgl.LWJGLUtil; //导入依赖的package包/类
public void destroyWindow() {
lockAWT();
try {
if (parent != null) {
parent.removeFocusListener(focus_listener);
}
try {
setNativeCursor(null);
} catch (LWJGLException e) {
LWJGLUtil.log("Failed to reset cursor: " + e.getMessage());
}
nDestroyCursor(getDisplay(), blank_cursor);
blank_cursor = None;
ungrabKeyboard();
nDestroyWindow(getDisplay(), getWindow());
decDisplay();
if ( current_window_mode != WINDOWED )
Compiz.setLegacyFullscreenSupport(false);
} finally {
unlockAWT();
}
}
示例9: resetDisplayMode
import org.lwjgl.LWJGLUtil; //导入依赖的package包/类
public void resetDisplayMode() {
lockAWT();
try {
if( current_displaymode_extension == XRANDR && savedXrandrConfig.length > 0 )
{
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
XRandR.setConfiguration( savedXrandrConfig );
return null;
}
});
}
else
{
switchDisplayMode(saved_mode);
}
if (isXF86VidModeSupported())
doSetGamma(saved_gamma);
Compiz.setLegacyFullscreenSupport(false);
} catch (LWJGLException e) {
LWJGLUtil.log("Caught exception while resetting mode: " + e);
} finally {
unlockAWT();
}
}
示例10: getMinCursorSize
import org.lwjgl.LWJGLUtil; //导入依赖的package包/类
public int getMinCursorSize() {
lockAWT();
try {
incDisplay();
try {
return nGetMinCursorSize(getDisplay(), getWindow());
} finally {
decDisplay();
}
} catch (LWJGLException e) {
LWJGLUtil.log("Exception occurred in getMinCursorSize: " + e);
return 0;
} finally {
unlockAWT();
}
}
示例11: getMaxCursorSize
import org.lwjgl.LWJGLUtil; //导入依赖的package包/类
public int getMaxCursorSize() {
lockAWT();
try {
incDisplay();
try {
return nGetMaxCursorSize(getDisplay(), getWindow());
} finally {
decDisplay();
}
} catch (LWJGLException e) {
LWJGLUtil.log("Exception occurred in getMaxCursorSize: " + e);
return 0;
} finally {
unlockAWT();
}
}
示例12: getPbufferCapabilities
import org.lwjgl.LWJGLUtil; //导入依赖的package包/类
public int getPbufferCapabilities() {
lockAWT();
try {
incDisplay();
try {
return nGetPbufferCapabilities(getDisplay(), getDefaultScreen());
} finally {
decDisplay();
}
} catch (LWJGLException e) {
LWJGLUtil.log("Exception occurred in getPbufferCapabilities: " + e);
return 0;
} finally {
unlockAWT();
}
}
示例13: initNativeStubs
import org.lwjgl.LWJGLUtil; //导入依赖的package包/类
/**
* Helper method to ContextCapabilities. It will try to initialize the native stubs,
* and remove the given extension name from the extension set if the initialization fails.
*/
static void initNativeStubs(final Class<?> extension_class, Set supported_extensions, String ext_name) {
resetNativeStubs(extension_class);
if ( supported_extensions.contains(ext_name) ) {
try {
AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
public Object run() throws Exception {
Method init_stubs_method = extension_class.getDeclaredMethod("initNativeStubs");
init_stubs_method.invoke(null);
return null;
}
});
} catch (Exception e) {
LWJGLUtil.log("Failed to initialize extension " + extension_class + " - exception: " + e);
supported_extensions.remove(ext_name);
}
}
}
示例14: getAvailableDisplayModes
import org.lwjgl.LWJGLUtil; //导入依赖的package包/类
/**
* Returns the entire list of possible fullscreen display modes as an array, in no
* particular order. Although best attempts to filter out invalid modes are done, any
* given mode is not guaranteed to be available nor is it guaranteed to be within the
* current monitor specs (this is especially a problem with the frequency parameter).
* Furthermore, it is not guaranteed that create() will detect an illegal display mode.
* <p/>
* The only certain way to check
* is to call create() and make sure it works.
* Only non-palette-indexed modes are returned (ie. bpp will be 16, 24, or 32).
* Only DisplayModes from this call can be used when the Display is in fullscreen
* mode.
*
* @return an array of all display modes the system reckons it can handle.
*/
public static DisplayMode[] getAvailableDisplayModes() throws LWJGLException {
synchronized ( GlobalLock.lock ) {
DisplayMode[] unfilteredModes = display_impl.getAvailableDisplayModes();
if ( unfilteredModes == null ) {
return new DisplayMode[0];
}
// We'll use a HashSet to filter out the duplicated modes
HashSet<DisplayMode> modes = new HashSet<DisplayMode>(unfilteredModes.length);
modes.addAll(Arrays.asList(unfilteredModes));
DisplayMode[] filteredModes = new DisplayMode[modes.size()];
modes.toArray(filteredModes);
LWJGLUtil.log("Removed " + (unfilteredModes.length - filteredModes.length) + " duplicate displaymodes");
return filteredModes;
}
}
示例15: findConfiguration
import org.lwjgl.LWJGLUtil; //导入依赖的package包/类
/**
* Find a proper GraphicsConfiguration from the given GraphicsDevice and PixelFormat.
*
* @return The GraphicsConfiguration corresponding to a visual that matches the pixel format.
*/
public GraphicsConfiguration findConfiguration(GraphicsDevice device, PixelFormat pixel_format) throws LWJGLException {
try {
int screen = getScreenFromDevice(device);
int visual_id_matching_format = findVisualIDFromFormat(screen, pixel_format);
GraphicsConfiguration[] configurations = device.getConfigurations();
for ( GraphicsConfiguration configuration : configurations ) {
int visual_id = getVisualIDFromConfiguration(configuration);
if ( visual_id == visual_id_matching_format )
return configuration;
}
} catch (LWJGLException e) {
LWJGLUtil.log("Got exception while trying to determine configuration: " + e);
}
return null; // In case we failed to locate the visual, or if we're not on a SUN JDK
}