Page 1 of 2
custom Icon & Caption for your game
Posted: 29 Jun 2011, 13:40
by hoijui
if you want to change this:

to be your games icon and name, check out the two new functions here:
http://springrts.com/wiki/Lua_UnsyncedCtrl#Misc
Note: In the very beginning of the loading process, the spring logo & text will be shown anyway, of course, as we first have to init VFS & Lua and load the game archive.
related question on the
Answers site:
http://answers.springlobby.info/questio ... page=1#125
Please test this now, for example with [
http://springrts.com/phpbb/viewtopic.ph ... 50#p493350]the current engine test release[/url], and report back here if it does not work.
Re: custom Icon & Caption for your game
Posted: 29 Jun 2011, 14:11
by AF
How hard would it be to allow the momentary flash to go for games that have prepackaged installers? Is recompilation with a custom icon the only option?
Thanks for this =)
Re: custom Icon & Caption for your game
Posted: 29 Jun 2011, 15:06
by jK
When LuaLoadscreen is done, you will be able to call it much earlier.
Re: custom Icon & Caption for your game
Posted: 30 Jun 2011, 04:20
by Forboding Angel
Note: When loading a 24-bit Windows BMP file, pixel data points are loaded as blue, green, red, and NOT red, green, blue (as one might expect).
O_O Why?
Re: custom Icon & Caption for your game
Posted: 30 Jun 2011, 13:26
by jK
That's the way m$ stores any pixel data, even the framebuffer is in that format.
Re: custom Icon & Caption for your game
Posted: 30 Jun 2011, 13:43
by knorke
neat.

The icon is a 32x32 24bit .bmp and it just looks normal. (?)
Code: Select all
Spring.SetWMCaption ("Spring Tanks - The game with the funny tanks!","Spring Tanks")
Spring.SetWMIcon ("bitmaps\\STicon.bmp")
But shouldn't it just say the short title (""Spring Tanks") in the taskbar?
(windows xp)
Re: custom Icon & Caption for your game
Posted: 30 Jun 2011, 16:22
by hoijui
ahh nice!

thanks for testing, knorke!
and yeah.. that is what i would expect...
i guess i read the string parameters wrong (given to the Lua function).
i'll check...
Re: custom Icon & Caption for your game
Posted: 30 Jun 2011, 17:05
by hoijui
code looks correct to me (also compared to other functions with two string arguments). :/
Could also be a decision by WinXP, or a problem with SDL (first one being more likely).
i wrote a test widget too, and i was able to verify that the two strings are handed over to the SDL function as intended. Documentation of that function is here:
http://sdl.beuc.net/sdl.wiki/SDL_WM_SetCaption
(the
icon parameter is called
titleShort in spring)
Maybe i am reading the docu wrong, but i was not able to get the short title displayed anywhere, whether the window was open or minimized (on Linux). so i guess we can just forget about the shortTitle then.
Re: custom Icon & Caption for your game
Posted: 01 Jul 2011, 01:39
by knorke
I could not get it to work in my own SDL app either.
I think the second paramete is actually not shortTitle but the name of an icon in a resource file or something.
Re: custom Icon & Caption for your game
Posted: 01 Jul 2011, 07:52
by hoijui
i crawled through some more online docu...
what i think is the official doc source, does not explain the parameters to the function at all.
http://www.libsdl.org/docs/html/sdlwmsetcaption.html
the doc i used as reference so far, which i mentioned already
http://sdl.beuc.net/sdl.wiki/SDL_WM_SetCaption
icon is a UTF-8 encoded null-terminated string which will serve as the iconified window title (the text which is displayed in the menu bar or desktop when the window is minimized).
this site has a comment showing a usage scenario.. no real news for us though
http://amiga.sourceforge.net/amigadevhe ... ion=Search
someone who tested the function on different OS
http://www.gpwiki.org/index.php/SDL:Tut ... properties
The Window Title is the title that is on the top of the window in the titlebar. The Icon Title is the name it is given when refering to it in the system. {Check?}
(In linux, at least in GNOME, the Icon Title shows up in the task bar while the window title shows up in the title bar [yay, I checked something ^_^]) (on OS X, at least in Tiger ;->, the Icon Title shows up when you hover over the app's dock icon [yay, I checked something, too!])
i did only test on KDE, not Gnome so far. this sounds like it would work as expected under Gnome and OS X.
Re: custom Icon & Caption for your game
Posted: 01 Jul 2011, 08:45
by knorke
on win xp it uses the "long title" in alt+tab too btw.
dont know if thats correct but I downloaded SDL-1.2.zip from here
http://www.libsdl.org/hg.php
in SDL_syswm.c there is a
void WIN_SetWMCaption(_THIS, const char *title, const char *icon)
http://pastebin.com/VPaGkksJ
The const char *icon seems not to be used?
Strangely, this:
Code: Select all
SDL_WM_SetCaption("bla", "blub");
char *a;
char *b;
SDL_WM_GetCaption(&a, &b);
cout << "a=" << a << endl;
cout << "b=" << b << endl;
prints:
a=bla
b=blub
(with a downloaded sdl.dll, did not compile from source)
There is
SDL_WM_IconifyWindow(); but it just normally minized the window.
Re: custom Icon & Caption for your game
Posted: 01 Jul 2011, 10:38
by hoijui
i browsed the SDL 1.2 sources too now, and i summarized my findings here:
http://www.gpwiki.org/index.php/SDL:Tut ... w-managers
conclusion:
"Icon Title" may only ever be used under X11 (with SDL 1.2).
The reason why even under windows,
SDL_WM_GetCaption returns the correct values, set previously with
SDL_WM_SetCaption:
We call a common function
SDL_WM_SetCaption in
src/video/SDL_video.c, which stores the two strings and passes them on the
*_Set(WM)?Caption function (eg
WIN_SetWMCaption), specific to the underlying window manager.
So the strings are always stored within SDL, but only used seldom for real by the underlying system (which is what we would care about).
i edited the docu here too:
http://springrts.com/wiki/Lua_UnsyncedCtrl#Misc
Re: custom Icon & Caption for your game
Posted: 01 Jul 2011, 19:18
by zwzsg
Can we have support of window's .ico file?
In particular I would be interested in having:
- Transparency (just transparent pixels, I don't need full alpha)
- A different picture for each size.
Re: custom Icon & Caption for your game
Posted: 01 Jul 2011, 20:50
by hoijui
i am not sure anymore where the restriction to BMP comes from. i think it is the windows implementaiton of SDL, or maybe some Win XP limitation ...
i know that on linux, it is no problem to use PNG's with transparency. i tested that.
as you can see in the docu about the SDL function, it is not possible to supply different icons for different sizes, which makes sense, as it would be irritating for the user to see one process to have different images in different places.
Re: custom Icon & Caption for your game
Posted: 01 Jul 2011, 20:55
by MidKnight
He means the .ICO file format. You don't need to supply several pictures, just one ICO with the different sizes in it.
Re: custom Icon & Caption for your game
Posted: 01 Jul 2011, 21:13
by hoijui
hmm... it does not have to be BMP. docu just sais, how the image will be read, if you use a BMP.
It has to be 24bit or 32bit (all systems) and 32x32 (on windows), though.
Re: custom Icon & Caption for your game
Posted: 01 Jul 2011, 22:00
by zwzsg
btw, I tried with an ico too, and it didn't like it.
Re: custom Icon & Caption for your game
Posted: 01 Jul 2011, 22:18
by hoijui
SDL enforces a single image; not merely a single file, but a single array of pixel data, making up an image. it is not possible to use different sized images at the same time, which i think is right.
Re: custom Icon & Caption for your game
Posted: 02 Jul 2011, 15:04
by knorke
iirc SDL only supports .bmp (for anything, not just program icon)
There is SDL_image for .png, .tga and more but even that does not load .ico
Re: custom Icon & Caption for your game
Posted: 03 Jul 2011, 13:58
by zwzsg
Ok, then I'll have to work with what I get instead of what I wish.
