custom Icon & Caption for your game

custom Icon & Caption for your game

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

custom Icon & Caption for your game

Post by hoijui »

if you want to change this:
Image
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.
Last edited by hoijui on 29 Jun 2011, 16:06, edited 1 time in total.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: custom Icon & Caption for your game

Post 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 =)
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: custom Icon & Caption for your game

Post by jK »

When LuaLoadscreen is done, you will be able to call it much earlier.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: custom Icon & Caption for your game

Post 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?
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: custom Icon & Caption for your game

Post by jK »

That's the way m$ stores any pixel data, even the framebuffer is in that format.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: custom Icon & Caption for your game

Post by knorke »

neat.
Image
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)
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: custom Icon & Caption for your game

Post 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...
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: custom Icon & Caption for your game

Post 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.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: custom Icon & Caption for your game

Post 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.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: custom Icon & Caption for your game

Post 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.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: custom Icon & Caption for your game

Post 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.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: custom Icon & Caption for your game

Post 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
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: custom Icon & Caption for your game

Post 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.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: custom Icon & Caption for your game

Post 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.
User avatar
MidKnight
Posts: 2652
Joined: 10 Sep 2008, 03:11

Re: custom Icon & Caption for your game

Post 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.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: custom Icon & Caption for your game

Post 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.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: custom Icon & Caption for your game

Post by zwzsg »

btw, I tried with an ico too, and it didn't like it.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: custom Icon & Caption for your game

Post 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.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: custom Icon & Caption for your game

Post 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
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: custom Icon & Caption for your game

Post by zwzsg »

Ok, then I'll have to work with what I get instead of what I wish.

Image
Post Reply

Return to “Game Development”