• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Platform类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.lwjgl.system.Platform的典型用法代码示例。如果您正苦于以下问题:Java Platform类的具体用法?Java Platform怎么用?Java Platform使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Platform类属于org.lwjgl.system包,在下文中一共展示了Platform类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: glfwCreateWindow

import org.lwjgl.system.Platform; //导入依赖的package包/类
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;
}
 
开发者ID:LWJGLX,项目名称:debug,代码行数:17,代码来源:GLFW.java


示例2: setOpenGLContextVersion

import org.lwjgl.system.Platform; //导入依赖的package包/类
@Override
public WindowBuilder setOpenGLContextVersion(OpenGLContextVersion version) {
    if(version.type == OpenGLContext.OPENGL_ES) {
        glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API);
    } else if(version.type == OpenGLContext.OPENGL_COMPAT) {
        glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_COMPAT_PROFILE);
    } else if(version.type == OpenGLContext.OPENGL_CORE) {
        glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
        if(Platform.get() == Platform.MACOSX)
            glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, 1);
    }

    core = version.type == OpenGLContext.OPENGL_CORE;

    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, version.major);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, version.minor);
    return this;
}
 
开发者ID:melchor629,项目名称:Java-GLEngine,代码行数:19,代码来源:LWJGLWindow.java


示例3: load

import org.lwjgl.system.Platform; //导入依赖的package包/类
/*************************************************************************
 * 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;
}
 
开发者ID:TechShroom,项目名称:EmergencyLanding,代码行数:33,代码来源:IconLoader.java


示例4: generateTexture

import org.lwjgl.system.Platform; //导入依赖的package包/类
public static BufferedTexture generateTexture(String parentDir, String name) {
    if (parentDir == null) {
        parentDir =
                System.getProperty("user.home", (Platform.get() == Platform.WINDOWS ? "C:" : "") + File.separator);
    }
    if (name == null) {
        throw new IllegalStateException("name cannot be null");
    }
    try {
        return LUtils
                .processPathData(parentDir
                        + ((parentDir.matches(ENDS_WITH_DOUBLE_WINDOWS_SEPEARATOR)
                                || name.matches(STARTS_WITH_DOUBLE_WINDOWS_SEPERATOR)) ? "" : File.separator)
                        + name, BufferedTexture::fromInputStream);
    } catch (IOException e) {
        throw new RuntimeException("Error retriving stream", e);
    }
}
 
开发者ID:TechShroom,项目名称:EmergencyLanding,代码行数:19,代码来源:BufferedTexture.java


示例5: initNatives

import org.lwjgl.system.Platform; //导入依赖的package包/类
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());
}
 
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:14,代码来源:NullEngine.java


示例6: createInstance

import org.lwjgl.system.Platform; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:httpdigest,项目名称:lwjgl3-swt,代码行数:43,代码来源:SimpleDemo.java


示例7: createInstance

import org.lwjgl.system.Platform; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:httpdigest,项目名称:lwjgl3-awt,代码行数:43,代码来源:SimpleDemo.java


示例8: createInstance

import org.lwjgl.system.Platform; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:httpdigest,项目名称:lwjgl3-swt,代码行数:53,代码来源:ClearScreenDemo.java


示例9: VKCanvas

import org.lwjgl.system.Platform; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:httpdigest,项目名称:lwjgl3-swt,代码行数:20,代码来源:VKCanvas.java


示例10: GLCanvas

import org.lwjgl.system.Platform; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:httpdigest,项目名称:lwjgl3-swt,代码行数:25,代码来源:GLCanvas.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OnCompressListener类代码示例发布时间:2022-05-23
下一篇:
Java ForbiddenException类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap