A downloadable extension

Download NowName your own price

Quick links: Source code

This small extension allows you to dynamically change window icon (also seen in taskbar) and taskbar badges (commonly used for notifications and such) in your GameMaker games.

Functions (GameMaker):

  • window_set_icon(path_to_ico)
    Changes the window icon. Path should point to a valid ICO file.
  • window_set_icon_buffer(buffer_with_an_ico_inside)
    Changes the window icon. The buffer should contain a valid ICO file.
  • window_set_icon_surface(surface, set_big_icon)
    Changes the window icon to match the pixels in a surface.
    "big" (32x32) icon may used for display in taskbar.
  • window_reset_icon()
    Resets the window icon to whatever it was on game start.
  • window_set_overlay_icon(path_to_ico, ?description)
    Changes the little overlay/notification badge icon shown in the corner of the window. Path should point to a valid ICO file.
  • window_set_overlay_icon_buffer(buffer_with_an_ico_inside, ?description)
    Changes the little overlay/notification badge icon shown in the corner of the taskbar button. The buffer should contain a valid ICO file.
  • window_set_overlay_icon_surface(surface, ?description)
    Changes the little overlay/notification badge icon shown in the corner of the taskbar button to match pixels in a surface.
  • window_reset_overlay_icon()
    Resets/removes the little overlay/notification badge icon.

Functions (C#):

  • WindowIconTools.SetIcon(texture2d or null, kind)
    Changes small or big icon for the window to match the given texture with format=BGRA32.
    In non-Unity C#, you provide an array of bgra bytes, width, and height instead of a texture.
  • WindowIconTools.SetOverlayIcon(texture2d or null, opt. description)
    Changes the overlay icon in the taskbar.
  • WindowIconTools.SetProgress(progressState, numCompleted, numTotal)
    This is an equivalent of the other extension I made and is only here because it didn't really "cost" anything to add.

So, for example, if you had a "some.ico" in your Included Files, you could do

window_set_icon("some.ico");

Have fun !

StatusReleased
CategoryAssets
Rating
Rated 5.0 out of 5 stars
(2 total ratings)
AuthorYellowAfterlife

Download

Download NowName your own price

Click download now to get access to the following files:

window_set_icon-for-GMS1.gmez 11 kB
Version 1.1
window_set_icon-for-GMS2.yymp 15 kB
Version 1.1
window_set_icon-for-GMS2.3+.yymps 22 kB
Version 1.1
window_set_icon.gmez 41 kB
window_set_icon.yymp 49 kB
WindowIconToolsUnity.unitypackage 2 kB
WindowIconTools.cs 10 kB

Development log

Comments

Log in with itch.io to leave a comment.

wow, didn't even know that windows supported changing icons so rapidly

(1 edit)

Hello!
Do you have any plans on updating the GameMaker version to work properly with the newer versions of the engine?

(+2)(-1)

That is done. I’ll take a few dollars if you have them as this extension made $15 in 2 years time.

(5 edits)

Holy shit that was quick, and you know what you deserve it, you replied super quickly and delivered for what is a FREE extension, you could have just gone "I'm busy, sorry, bye check up on this later", so I'll send you 5$, and that makes it 20$ total (I actually plan on buying another one but running kinda low on money atm, since my main currency isn't in USD so I gotta do some tricky stuff to get said currency).

And seriously, I know it's a tiny extension but only getting 15$ in a 2-year span is just underrated considering that GM built-in stuff is limited and this extension solves all of that. I guess it is kinda the faith of Pay What You Want stuff on this site; not many people would pay if they can just get it for free.

Edit: I had some weird issues with the icons not showing up but I figured it was just due to exporting them with the wrong size,  so don't mind the many edits/extra deleted message. lol

Deleted 1 year ago
(+1)

Such is the fate of these small extensions - they are undeniably useful, but only to a number of people.

I originally relied on simply not having to touch them ever again after initial development, but GameMaker updates now move quickly enough that you do have to update something now and then, which becomes an issue when you have accumulated dozens of extensions over years.

Is it possible to differenciate the icon in the top left corner and the icon in the taskbar? I want to make the icon in the top left transparent and the icon in the taskbar shouldn't be changed

As per description, window_set_icon_surface (GM) or kind argument in WindowIconTools.SetIcon (Unity) would let you control that.

Got it working!

Thanks for the quick reply

Hey YAL, there appears to be an error in that the line buffer_get_surface(_buf, _sf, 0,0); has 4 variables which will return an error. The way I fixed it was I manually went through the .gml of the extension and made it 3 arguments getting rid of the last ,0)

That’s because GMS2.3.1 changed the function signature (reducing argument count from 5 to 3), breaking every single extension released prior to that.

Awesome stuff!

Do you know if this works on Mac?

(+1)

It does not. You would need to write a DyLib for that, this might be a clue if Apple didn't change API since then.

Feel free to send a PR if you manage to figure it out! Someone else said that they were looking into making this work with Linux.

This is super helpful! Thank you very much. Came from reddit, this is exactly what I needed!

On another note, do you know how to create a texture with the BGRA32 format? I can't seem to get one working in Unity, and converting it doesn't seem to be much use either. The progress bar is extremely useful though!

(1 edit) (+1)

For whatever reason you can't set a texture to import as BGRA, but you can create a new texture in BGRA format and carry over the pixels to it, like so (also seen in test project on git):

Texture2D ConvertTexture(Texture2D texture, TextureFormat format) {
    var tex = new Texture2D(texture.width, texture.height, format, false);
    tex.SetPixels32(texture.GetPixels32());
    return tex;
}

Thank you!

(+1)

Thank you this is great!