Page 1 of 2
Setting Icon
Posted: Tue Apr 15, 2014 10:56 pm
by dan369
Hey,
Just wondering how exactly you go about setting the window icon using Love?
I've tried using both love.window.setIcon() & supplying the file-path to my image in my config.lua file but both to no avail :/.
Code: Select all
-- Set Window Icon
icon = love.graphics.newImage("Content/Images/icon.png");
success = love.window.setIcon( icon:getData() );
Success does return true, but i still have the bog-standard love icon.
Edit:
On linux, and my icon size is 32x32.
My Icon:
Re: Setting Icon
Posted: Tue Apr 15, 2014 11:49 pm
by Robin
It might help to know what OS you're on and how large icon.png is, in terms of resolution.
Also: yay, 6000 posts!
Re: Setting Icon
Posted: Wed Apr 16, 2014 12:23 am
by dan369
Robin wrote:It might help to know what OS you're on and how large icon.png is, in terms of resolution.
Also: yay, 6000 posts!
Oh right sorry, updated post with info. But just to place it here as-well, Linux & the icon size is 32x32
Re: Setting Icon
Posted: Wed Apr 16, 2014 4:26 am
by Jasoco
Doesn't that option only affect Windows anyway? It only sets the icon that appears in the titlebar. It has nothing to do with changing the icon of the application. The Wiki doesn't clarify but I'm pretty sure it's only used in Windows. (OS X doesn't even have an icon in the titlebar unless the app uses a document metaphor, which Löve doesn't of course.)
Side note: It'd be cool if Löve had a separate option for setting the icon that appears in the Taskbar/Dock that would work across all OS'. Not that it's a really important feature for a game, but whatever.
Re: Setting Icon
Posted: Wed Apr 16, 2014 9:40 am
by T-Bone
What I do with Hat Cat is to not do anything about that in the code, and then build versions of the game for Windows and Mac OS X. For the Windows .exe you can use Resource Hacker to change the icon. For the Mac .app, you can just replace some .icns files inside and it will look nice. For Lunix, there's no nice solution though. I guess you could distribute a .desktop file together with your .love that both launches the game and looks pretty.
Re: Setting Icon
Posted: Wed Apr 16, 2014 10:05 am
by dan369
Seems hacky when there's a built in SDL to-do exactly this (and works perfectly with my projects on Linux/Windows with c++ which use SDL2).
Re: Setting Icon
Posted: Wed Apr 16, 2014 1:14 pm
by Robin
Well, there's three different things that are independent from each other: the window icon (setIcon), the taskbar/dock/unity icon (???), the launcher/file explorer icon (ResHacker/.icns/.desktop, depending on platform).
Re: Setting Icon
Posted: Wed Apr 16, 2014 2:07 pm
by dan369
Robin wrote:Well, there's three different things that are independent from each other: the window icon (setIcon), the taskbar/dock/unity icon (???), the launcher/file explorer icon (ResHacker/.icns/.desktop, depending on platform).
Does this function work correctly for others (regardless of platform)?
Re: Setting Icon
Posted: Wed Apr 16, 2014 2:27 pm
by Robin
So I tried, but it doesn't work for me either (Ubuntu 12.04). (Included a .love that others can run and report back here with little effort on their part.)
Re: Setting Icon
Posted: Wed Apr 16, 2014 3:50 pm
by DaedalusYoung
Works on OS X 10.8.5, it changes the Dock icon to the one supplied.