本文整理汇总了Java中org.lwjgl.system.Platform.WINDOWS属性的典型用法代码示例。如果您正苦于以下问题:Java Platform.WINDOWS属性的具体用法?Java Platform.WINDOWS怎么用?Java Platform.WINDOWS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.lwjgl.system.Platform
的用法示例。
在下文中一共展示了Platform.WINDOWS属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: glfwCreateWindow
public static long glfwCreateWindow(int width, int height, ByteBuffer title, long monitor, long share) {
if (Properties.VALIDATE.enabled) {
RT.checkGlfwMonitor(monitor);
RT.checkGlfwWindow(share);
org.lwjgl.glfw.GLFW.glfwWindowHint(org.lwjgl.glfw.GLFW.GLFW_OPENGL_DEBUG_CONTEXT, org.lwjgl.glfw.GLFW.GLFW_TRUE);
if (Platform.get() == Platform.WINDOWS || Properties.STRICT.enabled) {
Context ctx = CONTEXTS.get(share);
if (ctx != null && ctx.currentInThread != null && ctx.currentInThread != Thread.currentThread()) {
RT.throwISEOrLogError("Context of share window[" + ctx.counter + "] is current in another thread [" + ctx.currentInThread + "]");
}
}
}
long window = org.lwjgl.glfw.GLFW.glfwCreateWindow(width, height, title, monitor, share);
createWindow(window, share);
return window;
}
示例2: load
/*************************************************************************
* Loads an icon in ByteBuffer form.
*
* @param is
* The location of the Image to use as an icon.
*
* @return An array of ByteBuffers containing the pixel data for the icon in
* varying sizes.
*************************************************************************/
public static ByteBuffer[] load(InputStream is) {
BufferedImage image = null;
try {
image = ImageIO.read(is);
} catch (IOException e) {
e.printStackTrace();
}
ByteBuffer[] buffers = null;
Platform plat = Platform.get();
System.err.println("Assuming platform " + LUtils.PLATFORM_NAME);
if (plat == Platform.WINDOWS) {
buffers = new ByteBuffer[2];
buffers[0] = loadInstance(image, 16);
buffers[1] = loadInstance(image, 32);
} else if (plat == Platform.MACOSX) {
buffers = new ByteBuffer[1];
buffers[0] = loadInstance(image, 128);
} else {
buffers = new ByteBuffer[1];
buffers[0] = loadInstance(image, 32);
}
return buffers;
}
示例3: initNatives
private static void initNatives() throws InitializationException {
Platform platform = Platform.get();
String path = NATIVE_DIR + "/";
if (platform == Platform.WINDOWS)
path += "windows";
else if (platform == Platform.MACOSX)
path += "macos";
else if (platform == Platform.LINUX)
path += "linux";
else
throw new InitializationException("Unsupported platform");
System.setProperty("org.lwjgl.librarypath", new File(path).getAbsolutePath());
}
示例4: createInstance
/**
* Create a Vulkan instance using LWJGL 3.
*
* @return the VkInstance handle
*/
private static VkInstance createInstance() {
VkApplicationInfo appInfo = VkApplicationInfo.calloc()
.sType(VK_STRUCTURE_TYPE_APPLICATION_INFO)
.pApplicationName(memUTF8("SWT Vulkan Demo"))
.pEngineName(memUTF8(""))
.apiVersion(VK_MAKE_VERSION(1, 0, 2));
ByteBuffer VK_KHR_SURFACE_EXTENSION = memUTF8(VK_KHR_SURFACE_EXTENSION_NAME);
ByteBuffer VK_KHR_OS_SURFACE_EXTENSION;
if (Platform.get() == Platform.WINDOWS)
VK_KHR_OS_SURFACE_EXTENSION = memUTF8(VK_KHR_WIN32_SURFACE_EXTENSION_NAME);
else
VK_KHR_OS_SURFACE_EXTENSION = memUTF8(VK_KHR_XLIB_SURFACE_EXTENSION_NAME);
PointerBuffer ppEnabledExtensionNames = memAllocPointer(2);
ppEnabledExtensionNames.put(VK_KHR_SURFACE_EXTENSION);
ppEnabledExtensionNames.put(VK_KHR_OS_SURFACE_EXTENSION);
ppEnabledExtensionNames.flip();
VkInstanceCreateInfo pCreateInfo = VkInstanceCreateInfo.calloc()
.sType(VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO)
.pNext(0L)
.pApplicationInfo(appInfo);
if (ppEnabledExtensionNames.remaining() > 0) {
pCreateInfo.ppEnabledExtensionNames(ppEnabledExtensionNames);
}
PointerBuffer pInstance = MemoryUtil.memAllocPointer(1);
int err = vkCreateInstance(pCreateInfo, null, pInstance);
if (err != VK_SUCCESS) {
throw new RuntimeException("Failed to create VkInstance: " + translateVulkanResult(err));
}
long instance = pInstance.get(0);
memFree(pInstance);
VkInstance ret = new VkInstance(instance, pCreateInfo);
memFree(ppEnabledExtensionNames);
memFree(VK_KHR_OS_SURFACE_EXTENSION);
memFree(VK_KHR_SURFACE_EXTENSION);
appInfo.free();
return ret;
}
示例5: createInstance
/**
* Create a Vulkan instance using LWJGL 3.
*
* @return the VkInstance handle
*/
private static VkInstance createInstance() {
VkApplicationInfo appInfo = VkApplicationInfo.calloc()
.sType(VK_STRUCTURE_TYPE_APPLICATION_INFO)
.pApplicationName(memUTF8("AWT Vulkan Demo"))
.pEngineName(memUTF8(""))
.apiVersion(VK_MAKE_VERSION(1, 0, 2));
ByteBuffer VK_KHR_SURFACE_EXTENSION = memUTF8(VK_KHR_SURFACE_EXTENSION_NAME);
ByteBuffer VK_KHR_OS_SURFACE_EXTENSION;
if (Platform.get() == Platform.WINDOWS)
VK_KHR_OS_SURFACE_EXTENSION = memUTF8(VK_KHR_WIN32_SURFACE_EXTENSION_NAME);
else
VK_KHR_OS_SURFACE_EXTENSION = memUTF8(VK_KHR_XLIB_SURFACE_EXTENSION_NAME);
PointerBuffer ppEnabledExtensionNames = memAllocPointer(2);
ppEnabledExtensionNames.put(VK_KHR_SURFACE_EXTENSION);
ppEnabledExtensionNames.put(VK_KHR_OS_SURFACE_EXTENSION);
ppEnabledExtensionNames.flip();
VkInstanceCreateInfo pCreateInfo = VkInstanceCreateInfo.calloc()
.sType(VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO)
.pNext(0L)
.pApplicationInfo(appInfo);
if (ppEnabledExtensionNames.remaining() > 0) {
pCreateInfo.ppEnabledExtensionNames(ppEnabledExtensionNames);
}
PointerBuffer pInstance = MemoryUtil.memAllocPointer(1);
int err = vkCreateInstance(pCreateInfo, null, pInstance);
if (err != VK_SUCCESS) {
throw new RuntimeException("Failed to create VkInstance: " + translateVulkanResult(err));
}
long instance = pInstance.get(0);
memFree(pInstance);
VkInstance ret = new VkInstance(instance, pCreateInfo);
memFree(ppEnabledExtensionNames);
memFree(VK_KHR_OS_SURFACE_EXTENSION);
memFree(VK_KHR_SURFACE_EXTENSION);
appInfo.free();
return ret;
}
示例6: createInstance
/**
* Create a Vulkan {@link VkInstance} using LWJGL 3.
* <p>
* The {@link VkInstance} represents a handle to the Vulkan API and we need that instance for about everything we do.
*
* @return the VkInstance handle
*/
private static VkInstance createInstance() {
VkApplicationInfo appInfo = VkApplicationInfo.calloc()
.sType(VK_STRUCTURE_TYPE_APPLICATION_INFO)
.pApplicationName(memUTF8("SWT Vulkan Demo"))
.pEngineName(memUTF8(""))
.apiVersion(VK_MAKE_VERSION(1, 0, 2));
ByteBuffer VK_KHR_SURFACE_EXTENSION = memUTF8(VK_KHR_SURFACE_EXTENSION_NAME);
ByteBuffer VK_EXT_DEBUG_REPORT_EXTENSION = memUTF8(VK_EXT_DEBUG_REPORT_EXTENSION_NAME);
ByteBuffer VK_KHR_OS_SURFACE_EXTENSION;
if (Platform.get() == Platform.WINDOWS)
VK_KHR_OS_SURFACE_EXTENSION = memUTF8(VK_KHR_WIN32_SURFACE_EXTENSION_NAME);
else
VK_KHR_OS_SURFACE_EXTENSION = memUTF8(VK_KHR_XLIB_SURFACE_EXTENSION_NAME);
PointerBuffer ppEnabledExtensionNames = memAllocPointer(3)
.put(VK_KHR_SURFACE_EXTENSION)
.put(VK_KHR_OS_SURFACE_EXTENSION)
.put(VK_EXT_DEBUG_REPORT_EXTENSION)
.flip();
PointerBuffer ppEnabledLayerNames = memAllocPointer(layers.length);
for (int i = 0; validation && i < layers.length; i++)
ppEnabledLayerNames.put(layers[i]);
ppEnabledLayerNames.flip();
VkInstanceCreateInfo pCreateInfo = VkInstanceCreateInfo.calloc()
.sType(VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO)
.pNext(NULL)
.pApplicationInfo(appInfo)
.ppEnabledExtensionNames(ppEnabledExtensionNames)
.ppEnabledLayerNames(ppEnabledLayerNames);
PointerBuffer pInstance = memAllocPointer(1);
int err = vkCreateInstance(pCreateInfo, null, pInstance);
long instance = pInstance.get(0);
memFree(pInstance);
if (err != VK_SUCCESS) {
throw new AssertionError("Failed to create VkInstance: " + translateVulkanResult(err));
}
VkInstance ret = new VkInstance(instance, pCreateInfo);
pCreateInfo.free();
memFree(ppEnabledLayerNames);
memFree(ppEnabledExtensionNames);
memFree(VK_KHR_OS_SURFACE_EXTENSION);
memFree(VK_EXT_DEBUG_REPORT_EXTENSION);
memFree(VK_KHR_SURFACE_EXTENSION);
appInfo.free();
return ret;
}
示例7: VKCanvas
/**
* Create a {@link VKCanvas} widget using the attributes described in the supplied {@link VKData} object.
*
* @param parent
* a parent composite widget
* @param style
* the bitwise OR'ing of widget styles
* @param data
* the necessary data to create a VKCanvas
*/
public VKCanvas(Composite parent, int style, VKData data) {
super(parent, platformCanvas.checkStyle(parent, style));
if (Platform.get() == Platform.WINDOWS) {
platformCanvas.resetStyle(parent);
}
if (data == null)
SWT.error(SWT.ERROR_NULL_ARGUMENT);
surface = platformCanvas.create(this, data);
}
示例8: GLCanvas
/**
* Create a GLCanvas widget using the attributes described in the GLData
* object provided.
*
* @param parent a composite widget
* @param style the bitwise OR'ing of widget styles
* @param data the requested attributes of the GLCanvas
*
* @exception IllegalArgumentException
* <ul>
* <li>ERROR_NULL_ARGUMENT when the data is null
* <li>ERROR_UNSUPPORTED_DEPTH when the requested attributes cannot be provided
* </ul>
*/
public GLCanvas(Composite parent, int style, GLData data) {
super(parent, platformCanvas.checkStyle(parent, style));
if (Platform.get() == Platform.WINDOWS) {
platformCanvas.resetStyle(parent);
}
if (data == null)
SWT.error(SWT.ERROR_NULL_ARGUMENT);
effective = new GLData();
context = platformCanvas.create(this, data, effective);
}