當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。