Setting Icon

General discussion about LÖVE, Lua, game development, puns, and unicorns.
dan369
Prole
Posts: 44
Joined: Tue Apr 15, 2014 10:53 pm

Setting Icon

Post 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:
Image
Last edited by dan369 on Wed Apr 16, 2014 12:30 am, edited 3 times in total.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Setting Icon

Post 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!
Help us help you: attach a .love.
dan369
Prole
Posts: 44
Joined: Tue Apr 15, 2014 10:53 pm

Re: Setting Icon

Post 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
User avatar
Jasoco
Inner party member
Posts: 3727
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Setting Icon

Post 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.
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Re: Setting Icon

Post 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.
dan369
Prole
Posts: 44
Joined: Tue Apr 15, 2014 10:53 pm

Re: Setting Icon

Post 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).
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Setting Icon

Post 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).
Help us help you: attach a .love.
dan369
Prole
Posts: 44
Joined: Tue Apr 15, 2014 10:53 pm

Re: Setting Icon

Post 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)?
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Setting Icon

Post 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.)
Attachments
icontest.love
(581 Bytes) Downloaded 334 times
Help us help you: attach a .love.
User avatar
DaedalusYoung
Party member
Posts: 413
Joined: Sun Jul 14, 2013 8:04 pm

Re: Setting Icon

Post by DaedalusYoung »

Works on OS X 10.8.5, it changes the Dock icon to the one supplied.
Post Reply

Who is online

Users browsing this forum: slime and 5 guests