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


Java Display.setIcon方法代码示例

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


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

示例1: Window

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
protected Window(Context context, WindowBuilder settings) {
	this.fpsCap = settings.getFpsCap();
	try {
		getSuitableFullScreenModes();
		DisplayMode resolution = getStartResolution(settings);
		Display.setInitialBackground(1, 1, 1);
		this.aspectRatio = (float) resolution.getWidth() / resolution.getHeight();
		setResolution(resolution, settings.isFullScreen());
		if (settings.hasIcon()) {
			Display.setIcon(settings.getIcon());
		}
		Display.setVSyncEnabled(settings.isvSync());
		Display.setTitle(settings.getTitle());
		Display.create(new PixelFormat().withDepthBits(24).withSamples(4), context.getAttribs());
		GL11.glViewport(0, 0, resolution.getWidth(), resolution.getHeight());
	} catch (LWJGLException e) {
		e.printStackTrace();
	}
}
 
开发者ID:TheThinMatrix,项目名称:LowPolyWater,代码行数:20,代码来源:Window.java

示例2: setWindowIcon

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
private void setWindowIcon() {
	Util.EnumOS util$enumos = Util.getOSType();

	if (util$enumos != Util.EnumOS.OSX) {
		InputStream inputstream = null;
		InputStream inputstream1 = null;

		try {
			inputstream = this.mcDefaultResourcePack
					.getInputStreamAssets(new ResourceLocation("icons/icon_16x16.png"));
			inputstream1 = this.mcDefaultResourcePack
					.getInputStreamAssets(new ResourceLocation("icons/icon_32x32.png"));

			if (inputstream != null && inputstream1 != null) {
				Display.setIcon(new ByteBuffer[] { this.readImageToBuffer(inputstream),
						this.readImageToBuffer(inputstream1) });
			}
		} catch (IOException ioexception) {
			logger.error((String) "Couldn\'t set icon", (Throwable) ioexception);
		} finally {
			IOUtils.closeQuietly(inputstream);
			IOUtils.closeQuietly(inputstream1);
		}
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:26,代码来源:Minecraft.java

示例3: Window

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
protected Window(Context context, WindowBuilder settings) {
    this.fpsCap = settings.getFpsCap();
    try {
        getSuitableFullScreenModes();
        DisplayMode resolution = getStartResolution(settings);
        Display.setInitialBackground(0f, 0f, 0f);
        this.aspectRatio = (float) resolution.getWidth() / resolution.getHeight();
        setResolution(resolution, settings.isFullScreen());
        if (settings.hasIcon()) {
            Display.setIcon(settings.getIcon());
        }
        Display.setVSyncEnabled(settings.isvSync());
        Display.setTitle(settings.getTitle());
        Display.create(new PixelFormat().withDepthBits(24).withSamples(4), context.getAttribs());
        GL11.glViewport(0, 0, resolution.getWidth(), resolution.getHeight());
    } catch (LWJGLException e) {
        e.printStackTrace();
    }
}
 
开发者ID:GryPLOfficial,项目名称:EcoSystem-Official,代码行数:20,代码来源:Window.java

示例4: setWindowIcon

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
private void setWindowIcon()
{
    Util.EnumOS util$enumos = Util.getOSType();

    if (util$enumos != Util.EnumOS.OSX)
    {
        InputStream inputstream = null;
        InputStream inputstream1 = null;

        try
        {
            inputstream = this.mcDefaultResourcePack.getInputStreamAssets(new ResourceLocation("icons/icon_16x16.png"));
            inputstream1 = this.mcDefaultResourcePack.getInputStreamAssets(new ResourceLocation("icons/icon_32x32.png"));

            if (inputstream != null && inputstream1 != null)
            {
                Display.setIcon(new ByteBuffer[] {this.readImageToBuffer(inputstream), this.readImageToBuffer(inputstream1)});
            }
        }
        catch (IOException ioexception)
        {
            logger.error((String)"Couldn\'t set icon", (Throwable)ioexception);
        }
        finally
        {
            IOUtils.closeQuietly(inputstream);
            IOUtils.closeQuietly(inputstream1);
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:31,代码来源:Minecraft.java

示例5: setWindowIcon

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
private void setWindowIcon()
{
    Util.EnumOS util$enumos = Util.getOSType();

    if (util$enumos != Util.EnumOS.OSX)
    {
        InputStream inputstream = null;
        InputStream inputstream1 = null;

        try
        {
            inputstream = this.mcDefaultResourcePack.getInputStreamAssets(new ResourceLocation("icons/icon_16x16.png"));
            inputstream1 = this.mcDefaultResourcePack.getInputStreamAssets(new ResourceLocation("icons/icon_32x32.png"));

            if (inputstream != null && inputstream1 != null)
            {
                Display.setIcon(new ByteBuffer[] {this.readImageToBuffer(inputstream), this.readImageToBuffer(inputstream1)});
            }
        }
        catch (IOException ioexception)
        {
            LOGGER.error((String)"Couldn\'t set icon", (Throwable)ioexception);
        }
        finally
        {
            IOUtils.closeQuietly(inputstream);
            IOUtils.closeQuietly(inputstream1);
        }
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:31,代码来源:Minecraft.java

示例6: checkDisplaySettings

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
public static void checkDisplaySettings()
{
    int i = getAntialiasingLevel();

    if (i > 0)
    {
        DisplayMode displaymode = Display.getDisplayMode();
        dbg("FSAA Samples: " + i);

        try
        {
            Display.destroy();
            Display.setDisplayMode(displaymode);
            Display.create((new PixelFormat()).withDepthBits(24).withSamples(i));
            Display.setResizable(false);
            Display.setResizable(true);
        }
        catch (LWJGLException lwjglexception2)
        {
            warn("Error setting FSAA: " + i + "x");
            lwjglexception2.printStackTrace();

            try
            {
                Display.setDisplayMode(displaymode);
                Display.create((new PixelFormat()).withDepthBits(24));
                Display.setResizable(false);
                Display.setResizable(true);
            }
            catch (LWJGLException lwjglexception1)
            {
                lwjglexception1.printStackTrace();

                try
                {
                    Display.setDisplayMode(displaymode);
                    Display.create();
                    Display.setResizable(false);
                    Display.setResizable(true);
                }
                catch (LWJGLException lwjglexception)
                {
                    lwjglexception.printStackTrace();
                }
            }
        }

        if (!Minecraft.isRunningOnMac && getDefaultResourcePack() != null)
        {
            InputStream inputstream = null;
            InputStream inputstream1 = null;

            try
            {
                inputstream = getDefaultResourcePack().getInputStreamAssets(new ResourceLocation("icons/icon_16x16.png"));
                inputstream1 = getDefaultResourcePack().getInputStreamAssets(new ResourceLocation("icons/icon_32x32.png"));

                if (inputstream != null && inputstream1 != null)
                {
                    Display.setIcon(new ByteBuffer[] {readIconImage(inputstream), readIconImage(inputstream1)});
                }
            }
            catch (IOException ioexception)
            {
                warn("Error setting window icon: " + ioexception.getClass().getName() + ": " + ioexception.getMessage());
            }
            finally
            {
                IOUtils.closeQuietly(inputstream);
                IOUtils.closeQuietly(inputstream1);
            }
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:75,代码来源:Config.java

示例7: checkDisplaySettings

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
public static void checkDisplaySettings()
{
    int i = getAntialiasingLevel();

    if (i > 0)
    {
        DisplayMode displaymode = Display.getDisplayMode();
        dbg("FSAA Samples: " + i);

        try
        {
            Display.destroy();
            Display.setDisplayMode(displaymode);
            Display.create((new PixelFormat()).withDepthBits(24).withSamples(i));
            Display.setResizable(false);
            Display.setResizable(true);
        }
        catch (LWJGLException lwjglexception2)
        {
            warn("Error setting FSAA: " + i + "x");
            lwjglexception2.printStackTrace();

            try
            {
                Display.setDisplayMode(displaymode);
                Display.create((new PixelFormat()).withDepthBits(24));
                Display.setResizable(false);
                Display.setResizable(true);
            }
            catch (LWJGLException lwjglexception1)
            {
                lwjglexception1.printStackTrace();

                try
                {
                    Display.setDisplayMode(displaymode);
                    Display.create();
                    Display.setResizable(false);
                    Display.setResizable(true);
                }
                catch (LWJGLException lwjglexception)
                {
                    lwjglexception.printStackTrace();
                }
            }
        }

        if (!Minecraft.IS_RUNNING_ON_MAC && getDefaultResourcePack() != null)
        {
            InputStream inputstream = null;
            InputStream inputstream1 = null;

            try
            {
                inputstream = getDefaultResourcePack().getInputStreamAssets(new ResourceLocation("icons/icon_16x16.png"));
                inputstream1 = getDefaultResourcePack().getInputStreamAssets(new ResourceLocation("icons/icon_32x32.png"));

                if (inputstream != null && inputstream1 != null)
                {
                    Display.setIcon(new ByteBuffer[] {readIconImage(inputstream), readIconImage(inputstream1)});
                }
            }
            catch (IOException ioexception)
            {
                warn("Error setting window icon: " + ioexception.getClass().getName() + ": " + ioexception.getMessage());
            }
            finally
            {
                IOUtils.closeQuietly(inputstream);
                IOUtils.closeQuietly(inputstream1);
            }
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:75,代码来源:Config.java


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