Java Code Examples for org.lwjgl.opengl.Display#setIcon()

The following examples show how to use org.lwjgl.opengl.Display#setIcon() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Window.java    From LowPolyWater with The Unlicense 6 votes vote down vote up
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();
	}
}
 
Example 2
Source File: MixinMinecraft.java    From LiquidBounce with GNU General Public License v3.0 5 votes vote down vote up
@Inject(method = "setWindowIcon", at = @At("HEAD"), cancellable = true)
private void setWindowIcon(CallbackInfo callbackInfo) {
    if(Util.getOSType() != Util.EnumOS.OSX) {
        final ByteBuffer[] liquidBounceFavicon = IconUtils.getFavicon();
        if(liquidBounceFavicon != null) {
            Display.setIcon(liquidBounceFavicon);
            callbackInfo.cancel();
        }
    }
}
 
Example 3
Source File: MixinMinecraft.java    From LiquidBounce with GNU General Public License v3.0 5 votes vote down vote up
@Inject(method = "setWindowIcon", at = @At("HEAD"), cancellable = true)
private void setWindowIcon(CallbackInfo callbackInfo) {
    if(Util.getOSType() != Util.EnumOS.OSX) {
        final ByteBuffer[] liquidBounceFavicon = IconUtils.getFavicon();
        if(liquidBounceFavicon != null) {
            Display.setIcon(liquidBounceFavicon);
            callbackInfo.cancel();
        }
    }
}
 
Example 4
Source File: HyperiumMinecraft.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void setWindowIcon() {
    if (Util.getOSType() != Util.EnumOS.OSX) {
        try (InputStream inputStream16x = Minecraft.class.getResourceAsStream("/assets/hyperium/icons/icon-16x.png");
             InputStream inputStream32x = Minecraft.class.getResourceAsStream("/assets/hyperium/icons/icon-32x.png")) {
            ByteBuffer[] icons = new ByteBuffer[]{Utils.INSTANCE.readImageToBuffer(inputStream16x), Utils.INSTANCE.readImageToBuffer(inputStream32x)};
            Display.setIcon(icons);
        } catch (Exception e) {
            Hyperium.LOGGER.error("Couldn't set Windows Icon", e);
        }
    }
}
 
Example 5
Source File: FEMultiplayer.java    From FEMultiPlayer-V2 with GNU General Public License v3.0 5 votes vote down vote up
public void init(int width, int height, String name) {
	super.init(width, height, name);
	Player p1 = new Player("Player", (byte) 0);
	localPlayer = p1;
	ByteBuffer icon16, icon32;
	icon16 = icon32 = null;
	try {
		icon16 = ByteBuffer.wrap(TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("res/gui/icon16.png")).getTextureData());
		icon32 = ByteBuffer.wrap(TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("res/gui/icon32.png")).getTextureData());
	} catch (IOException e) {
		e.printStackTrace();
	}
	Display.setIcon(new ByteBuffer[]{icon16, icon32});
	FEResources.loadResources();
	FEResources.loadBitmapFonts();
	WeaponFactory.loadWeapons();
	UnitFactory.loadUnits();
	p1.getParty().setColor(Party.TEAM_BLUE);
	
	/* OpenGL final setup */
	glEnable(GL_LINE_SMOOTH);
	
	UnitFactory.getUnit("Lyn");
	connect = new ConnectStage();
	setCurrentStage(new TitleStage());
	SoundTrack.loop("main");
	
}
 
Example 6
Source File: FEMultiplayer.java    From FEMultiplayer with GNU General Public License v3.0 5 votes vote down vote up
public void init(int width, int height, String name) {
	super.init(width, height, name);
	Player p1 = new Player("Player", (byte) 0);
	localPlayer = p1;
	ByteBuffer icon16, icon32;
	icon16 = icon32 = null;
	try {
		icon16 = ByteBuffer.wrap(TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("res/gui/icon16.png")).getTextureData());
		icon32 = ByteBuffer.wrap(TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("res/gui/icon32.png")).getTextureData());
	} catch (IOException e) {
		e.printStackTrace();
	}
	Display.setIcon(new ByteBuffer[]{icon16, icon32});
	FEResources.loadResources();
	FEResources.loadBitmapFonts();
	WeaponFactory.loadWeapons();
	UnitFactory.loadUnits();
	p1.getParty().setColor(Party.TEAM_BLUE);
	
	/* OpenGL final setup */
	glEnable(GL_LINE_SMOOTH);
	
	UnitFactory.getUnit("Lyn");
	connect = new ConnectStage();
	setCurrentStage(new TitleStage());
	messages = new CopyOnWriteArrayList<Message>();
	SoundTrack.loop("main_theme");
	
}