当前位置: 首页>>代码示例>>Java>>正文


Java LWJGLUtil.getPlatform方法代码示例

本文整理汇总了Java中org.lwjgl.LWJGLUtil.getPlatform方法的典型用法代码示例。如果您正苦于以下问题:Java LWJGLUtil.getPlatform方法的具体用法?Java LWJGLUtil.getPlatform怎么用?Java LWJGLUtil.getPlatform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.lwjgl.LWJGLUtil的用法示例。


在下文中一共展示了LWJGLUtil.getPlatform方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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;
	}
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:21,代码来源:AWTUtil.java

示例2: saveWindowParams

import org.lwjgl.LWJGLUtil; //导入方法依赖的package包/类
private void saveWindowParams() {
    int width = Display.getWidth();
    int height = Display.getHeight();
    int x = Display.getX();
    int y = Display.getY();

    //FIXME by some reason actual window position shifted by 6 pixels on Windows (by 12 at y when maximized)
    if (LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_WINDOWS) {
        x += 6;
        y += 6;
    }

    Preferences prefs = Gdx.app.getPreferences("window_params.xml");
    prefs.putInteger("x", x);
    prefs.putInteger("y", y);
    prefs.putInteger("width", width);
    prefs.putInteger("height", height);
    prefs.flush();
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:20,代码来源:WindowParamsPersistingApplicationWrapper.java

示例3: processWindowMessages

import org.lwjgl.LWJGLUtil; //导入方法依赖的package包/类
@Override
public void processWindowMessages()
{
    // workaround for windows requiring messages being processed on the main thread
    if (LWJGLUtil.getPlatform() != LWJGLUtil.PLATFORM_WINDOWS) return;
    // If we can't grab the mutex, the update call is blocked, probably in native code, just skip it and carry on
    // We'll get another go next time
    if (!SplashProgress.mutex.tryAcquire()) return;
    Display.processMessages();
    SplashProgress.mutex.release();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:12,代码来源:FMLClientHandler.java

示例4: createImplementation

import org.lwjgl.LWJGLUtil; //导入方法依赖的package包/类
static AWTCanvasImplementation createImplementation() {
	switch ( LWJGLUtil.getPlatform() ) {
		case LWJGLUtil.PLATFORM_LINUX:
			return new LinuxCanvasImplementation();
		case LWJGLUtil.PLATFORM_WINDOWS:
			return new WindowsCanvasImplementation();
		case LWJGLUtil.PLATFORM_MACOSX:
			return new MacOSXCanvasImplementation();
		default:
			throw new IllegalStateException("Unsupported platform");
	}
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:13,代码来源:AWTGLCanvas.java

示例5: getImplementation

import org.lwjgl.LWJGLUtil; //导入方法依赖的package包/类
private static ContextAttribsImplementation getImplementation() {
	switch ( LWJGLUtil.getPlatform() ) {
		case LWJGLUtil.PLATFORM_LINUX:
			return new LinuxContextAttribs();
		case LWJGLUtil.PLATFORM_WINDOWS:
			return new WindowsContextAttribs();
		default:
			throw new IllegalStateException("Unsupported platform");
	}
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:11,代码来源:ContextAttribs.java

示例6: unloadOpenGLLibrary

import org.lwjgl.LWJGLUtil; //导入方法依赖的package包/类
/** The OpenGL library reference count is decremented, and if it reaches 0, the library is unloaded. */
public static synchronized void unloadOpenGLLibrary() {
	gl_ref_count--;
	/*
	 * Unload the native OpenGL library unless we're on linux, since
	 * some drivers (NVIDIA proprietary) crash on exit when unloading the library.
	 */
	if ( gl_ref_count == 0 && LWJGLUtil.getPlatform() != LWJGLUtil.PLATFORM_LINUX )
		nUnloadOpenGLLibrary();
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:11,代码来源:GLContext.java

示例7: createDisplayImplementation

import org.lwjgl.LWJGLUtil; //导入方法依赖的package包/类
private static DisplayImplementation createDisplayImplementation() {
	switch ( LWJGLUtil.getPlatform() ) {
		case LWJGLUtil.PLATFORM_LINUX:
			return new LinuxDisplay();
		case LWJGLUtil.PLATFORM_WINDOWS:
			return new WindowsDisplay();
		case LWJGLUtil.PLATFORM_MACOSX:
			return new MacOSXDisplay();
		default:
			throw new IllegalStateException("Unsupported platform");
	}
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:13,代码来源:Display.java

示例8: create

import org.lwjgl.LWJGLUtil; //导入方法依赖的package包/类
public static OSUtil create() {
	int platform = LWJGLUtil.getPlatform();
	switch (platform) {
		case LWJGLUtil.PLATFORM_MACOSX:
			return new MacOSXUtil();
		case LWJGLUtil.PLATFORM_LINUX:
		case LWJGLUtil.PLATFORM_WINDOWS:
		default:
			throw new RuntimeException("Unsupported platform: " + platform);
	}
}
 
开发者ID:sunenielsen,项目名称:tribaltrouble,代码行数:12,代码来源:OSUtil.java

示例9: setCLSharingProperties

import org.lwjgl.LWJGLUtil; //导入方法依赖的package包/类
public synchronized void setCLSharingProperties(final PointerBuffer properties) throws LWJGLException {
	final ByteBuffer peer_handle = peer_info.lockAndGetHandle();
	try {
		switch ( LWJGLUtil.getPlatform() ) {
			case LWJGLUtil.PLATFORM_WINDOWS:
				final WindowsContextImplementation implWindows = (WindowsContextImplementation)implementation;
				properties.put(KHRGLSharing.CL_GL_CONTEXT_KHR).put(implWindows.getHGLRC(handle));
				properties.put(KHRGLSharing.CL_WGL_HDC_KHR).put(implWindows.getHDC(peer_handle));
				break;
			case LWJGLUtil.PLATFORM_LINUX:
				final LinuxContextImplementation implLinux = (LinuxContextImplementation)implementation;
				properties.put(KHRGLSharing.CL_GL_CONTEXT_KHR).put(implLinux.getGLXContext(handle));
				properties.put(KHRGLSharing.CL_GLX_DISPLAY_KHR).put(implLinux.getDisplay(peer_handle));
				break;
			case LWJGLUtil.PLATFORM_MACOSX:
				if (LWJGLUtil.isMacOSXEqualsOrBetterThan(10, 6)) { // only supported on OS X 10.6+
					// http://oscarbg.blogspot.com/2009/10/about-opencl-opengl-interop.html
					final MacOSXContextImplementation implMacOSX = (MacOSXContextImplementation)implementation;
					final long CGLShareGroup = implMacOSX.getCGLShareGroup(handle);
					properties.put(APPLEGLSharing.CL_CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE).put(CGLShareGroup);
					break;
				}
			default:
				throw new UnsupportedOperationException("CL/GL context sharing is not supported on this platform.");
		}
	} finally {
		peer_info.unlock();
	}
}
 
开发者ID:ryancwilliams,项目名称:SpaceStationAlpha,代码行数:30,代码来源:ContextGL.java

示例10: loadNatives

import org.lwjgl.LWJGLUtil; //导入方法依赖的package包/类
private static void loadNatives() throws IOException {
	// Get the native libraries required by this operating system
	final String[] files;
	switch (LWJGLUtil.getPlatform()) {
		case LWJGLUtil.PLATFORM_LINUX:
			files = new String[] { "liblwjgl.so", "liblwjgl64.so", "libopenal.so", "libopenal64.so", "libjinput-linux.so", "libjinput-linux64.so" };
			break;
		case LWJGLUtil.PLATFORM_WINDOWS:
			files = new String[] { "jinput-dx8.dll", "jinput-dx8_64.dll", "jinput-raw.dll", "jinput-raw_64.dll", "jinput-wintab.dll", "lwjgl.dll", "lwjgl64.dll", "OpenAL32.dll", "OpenAL64.dll" };
			break;
		case LWJGLUtil.PLATFORM_MACOSX:
			files = new String[] { "libjinput-osx.jnilib", "liblwjgl.jnilib", "openal.dylib" };
			break;
		default:
			throw new IllegalStateException("Unknown operating system");
	}
	// Locate the natives directory
	final Path nativesDir = FileSystem.BASE_DIRECTORY.resolve("natives").resolve(LWJGLUtil.getPlatformName());
	// Create the natives directory
	Files.createDirectories(nativesDir);
	// Copy each native library into the natives directory
	for (String file : files) {
		try (InputStream stream = FileSystem.getJarResource(file)) {
			Files.copy(stream, nativesDir.resolve(file), StandardCopyOption.REPLACE_EXISTING);
		}
	}
	// Set the library paths
	System.setProperty("org.lwjgl.librarypath", nativesDir.toAbsolutePath().toString());
	System.setProperty("net.java.games.input.librarypath", nativesDir.toAbsolutePath().toString());
}
 
开发者ID:thehutch,项目名称:Fusion,代码行数:31,代码来源:Application.java

示例11: getAttribList

import org.lwjgl.LWJGLUtil; //导入方法依赖的package包/类
IntBuffer getAttribList() {
	if ( LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_MACOSX )
		return null;

	ContextAttribsImplementation implementation = getImplementation();

	int attribCount = 0;

	if ( !(majorVersion == 1 && minorVersion == 0) )
		attribCount += 2;
	if ( 0 < layerPlane )
		attribCount++;

	int flags = 0;
	if ( debug )
		flags |= implementation.getDebugBit();
	if ( forwardCompatible )
		flags |= implementation.getForwardCompatibleBit();
	if ( robustAccess )
		flags |= CONTEXT_ROBUST_ACCESS_BIT_ARB;
	if ( contextResetIsolation )
		flags |= CONTEXT_RESET_ISOLATION_BIT_ARB;
	if ( 0 < flags )
		attribCount++;

	int profileMask = 0;
	if ( profileCore )
		profileMask |= implementation.getProfileCoreBit();
	else if ( profileCompatibility )
		profileMask |= implementation.getProfileCompatibilityBit();
	else if ( profileES )
		profileMask |= CONTEXT_ES2_PROFILE_BIT_EXT;
	if ( 0 < profileMask )
		attribCount++;

	if ( loseContextOnReset )
		attribCount++;

	if ( attribCount == 0 )
		return null;

	final IntBuffer attribs = BufferUtils.createIntBuffer((attribCount * 2) + 1);

	if ( !(majorVersion == 1 && minorVersion == 0) ) {
		attribs.put(implementation.getMajorVersionAttrib()).put(majorVersion);
		attribs.put(implementation.getMinorVersionAttrib()).put(minorVersion);
	}
	if ( 0 < layerPlane )
		attribs.put(implementation.getLayerPlaneAttrib()).put(layerPlane);
	if ( 0 < flags )
		attribs.put(implementation.getFlagsAttrib()).put(flags);
	if ( 0 < profileMask )
		attribs.put(implementation.getProfileMaskAttrib()).put(profileMask);
	if ( loseContextOnReset )
		attribs.put(CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB).put(LOSE_CONTEXT_ON_RESET_ARB);

	attribs.put(0);
	attribs.rewind();
	return attribs;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:61,代码来源:ContextAttribs.java

示例12: create

import org.lwjgl.LWJGLUtil; //导入方法依赖的package包/类
/**
 * @param openDevice Whether to automatically open the device
 * @see #create(String, int, int, boolean)
 */
public static void create(String deviceArguments, int contextFrequency, int contextRefresh, boolean contextSynchronized, boolean openDevice)
	throws LWJGLException {

	if (created)
		throw new IllegalStateException("Only one OpenAL context may be instantiated at any one time.");
	String libname;
	String[] library_names;
	switch (LWJGLUtil.getPlatform()) {
		case LWJGLUtil.PLATFORM_WINDOWS:
			libname = "OpenAL32";
			library_names = new String[]{"OpenAL64.dll", "OpenAL32.dll"};
			break;
		case LWJGLUtil.PLATFORM_LINUX:
			libname = "openal";
			library_names = new String[]{"libopenal64.so", "libopenal.so", "libopenal.so.0"};
			break;
		case LWJGLUtil.PLATFORM_MACOSX:
			libname = "openal";
			library_names = new String[]{"openal.dylib"};
			break;
		default:
			throw new LWJGLException("Unknown platform: " + LWJGLUtil.getPlatform());
	}
	String[] oalPaths = LWJGLUtil.getLibraryPaths(libname, library_names, AL.class.getClassLoader());
	LWJGLUtil.log("Found " + oalPaths.length + " OpenAL paths");
	for ( String oalPath : oalPaths ) {
		try {
			nCreate(oalPath);
			created = true;
			init(deviceArguments, contextFrequency, contextRefresh, contextSynchronized, openDevice);
			break;
		} catch (LWJGLException e) {
			LWJGLUtil.log("Failed to load " + oalPath + ": " + e.getMessage());
		}
	}
	if (!created && LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_MACOSX) {
		// Try to load OpenAL from the framework instead
		nCreateDefault();
		created = true;
		init(deviceArguments, contextFrequency, contextRefresh, contextSynchronized, openDevice);
	}
	if (!created)
		throw new LWJGLException("Could not locate OpenAL library.");
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:49,代码来源:AL.java

示例13: create

import org.lwjgl.LWJGLUtil; //导入方法依赖的package包/类
public static void create() throws LWJGLException {
	if ( created )
		return;
	//throw new IllegalStateException("OpenCL has already been created.");

	final String libname;
	final String[] library_names;
	switch ( LWJGLUtil.getPlatform() ) {
		case LWJGLUtil.PLATFORM_WINDOWS:
			libname = "OpenCL";
			library_names = new String[] { "OpenCL.dll" };
			break;
		case LWJGLUtil.PLATFORM_LINUX:
			libname = "OpenCL";
			library_names = new String[] { "libOpenCL64.so", "libOpenCL.so" }; // TODO: Fix this
			break;
		case LWJGLUtil.PLATFORM_MACOSX:
			libname = "OpenCL";
			library_names = new String[] { "OpenCL.dylib" }; // TODO: Fix this
			break;
		default:
			throw new LWJGLException("Unknown platform: " + LWJGLUtil.getPlatform());
	}

	final String[] oclPaths = LWJGLUtil.getLibraryPaths(libname, library_names, CL.class.getClassLoader());
	LWJGLUtil.log("Found " + oclPaths.length + " OpenCL paths");
	for ( String oclPath : oclPaths ) {
		try {
			nCreate(oclPath);
			created = true;
			break;
		} catch (LWJGLException e) {
			LWJGLUtil.log("Failed to load " + oclPath + ": " + e.getMessage());
		}
	}

	if ( !created && LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_MACOSX ) {
		// Try to load OpenCL from the framework instead
		nCreateDefault();
		created = true;
	}

	if ( !created )
		throw new LWJGLException("Could not locate OpenCL library.");

	if ( !CLCapabilities.OpenCL10 )
		throw new RuntimeException("OpenCL 1.0 not supported.");
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:49,代码来源:CL.java


注:本文中的org.lwjgl.LWJGLUtil.getPlatform方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。