View topic - custom Icon & Caption for your game



All times are UTC + 1 hour


Post new topic Reply to topic  [ 27 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: 29 Jun 2011, 12:40 
Spring Developer
User avatar

Joined: 22 Sep 2007, 08:51
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.php?p=493350#p493350]the current engine test release[/url], and report back here if it does not work.


Last edited by hoijui on 29 Jun 2011, 15:06, edited 1 time in total.

Top
 Offline Profile  
 
PostPosted: 29 Jun 2011, 13:11 
AI Coder
User avatar

Joined: 14 Sep 2004, 10:32
Location: Cookieland
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 =)


Top
 Offline Profile  
 
PostPosted: 29 Jun 2011, 14:06 
Spring Developer
User avatar

Joined: 28 Jun 2007, 06:30
When LuaLoadscreen is done, you will be able to call it much earlier.


Top
 Offline Profile  
 
PostPosted: 30 Jun 2011, 03:20 
Evolution RTS Developer
User avatar

Joined: 17 Nov 2005, 02:43
Location: Raegquitting Spring on 04/24/12
Quote:
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?


Top
 Offline Profile  
 
PostPosted: 30 Jun 2011, 12:26 
Spring Developer
User avatar

Joined: 28 Jun 2007, 06:30
That's the way m$ stores any pixel data, even the framebuffer is in that format.


Top
 Offline Profile  
 
PostPosted: 30 Jun 2011, 12:43 
Moderator
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
neat.
Image
The icon is a 32x32 24bit .bmp and it just looks normal. (?)
Code:
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)


Top
 Online Profile  
 
PostPosted: 30 Jun 2011, 15:22 
Spring Developer
User avatar

Joined: 22 Sep 2007, 08:51
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...


Top
 Offline Profile  
 
PostPosted: 30 Jun 2011, 16:05 
Spring Developer
User avatar

Joined: 22 Sep 2007, 08:51
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.


Top
 Offline Profile  
 
PostPosted: 01 Jul 2011, 00:39 
Moderator
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
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.


Top
 Online Profile  
 
PostPosted: 01 Jul 2011, 06:52 
Spring Developer
User avatar

Joined: 22 Sep 2007, 08:51
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
Quote:
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
Quote:
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.


Top
 Offline Profile  
 
PostPosted: 01 Jul 2011, 07:45 
Moderator
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
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:
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.


Top
 Online Profile  
 
PostPosted: 01 Jul 2011, 09:38 
Spring Developer
User avatar

Joined: 22 Sep 2007, 08:51
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
Quote:
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


Top
 Offline Profile  
 
PostPosted: 01 Jul 2011, 18:18 
Kernel Panic Co-Developer
User avatar

Joined: 16 Nov 2004, 13:08
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.


Top
 Offline Profile  
 
PostPosted: 01 Jul 2011, 19:50 
Spring Developer
User avatar

Joined: 22 Sep 2007, 08:51
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.


Top
 Offline Profile  
 
PostPosted: 01 Jul 2011, 19:55 
Zero-K Developer
User avatar

Joined: 10 Sep 2008, 02:11
Location: In search for TheTruth (TM)
He means the .ICO file format. You don't need to supply several pictures, just one ICO with the different sizes in it.


Top
 Offline Profile  
 
PostPosted: 01 Jul 2011, 20:13 
Spring Developer
User avatar

Joined: 22 Sep 2007, 08:51
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.


Top
 Offline Profile  
 
PostPosted: 01 Jul 2011, 21:00 
Kernel Panic Co-Developer
User avatar

Joined: 16 Nov 2004, 13:08
btw, I tried with an ico too, and it didn't like it.


Top
 Offline Profile  
 
PostPosted: 01 Jul 2011, 21:18 
Spring Developer
User avatar

Joined: 22 Sep 2007, 08:51
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.


Top
 Offline Profile  
 
PostPosted: 02 Jul 2011, 14:04 
Moderator
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
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


Top
 Online Profile  
 
PostPosted: 03 Jul 2011, 12:58 
Kernel Panic Co-Developer
User avatar

Joined: 16 Nov 2004, 13:08
Ok, then I'll have to work with what I get instead of what I wish.

Image


Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 27 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Site layout created by Roflcopter et al.