Game Development Community

1.7.0 windowtitle- mania

by Shaderman · in Torque Game Engine Advanced · 04/08/2008 (11:48 am) · 6 replies

I just noticed that the window title is set 3 (!) times during Stronghold startup:

1) in Win32WindowManager::createWindow() - win32WindowMgr.cpp @ line 140
2) in initializeCommon() - common/gameScripts/common.cs @ line 35
3) in initClient() - game/scriptsAndAssets/client/init.cs @ line 70

Amazing, isn't it? :)

#1
04/08/2008 (1:00 pm)
Yah, unfortunately it is a bit convoluted, and honestly it should only be 2 instead of 3, but here's why:

As an engine, we need to be able to handle the case where there is nothing set as default, as well as the case where this is the very first run, ever, and the end project hasn't decided to set the title in their scriptsAndAssets/client/init.cs, so the window is sete when it is actually created to a default (step 1 above).

The case 2 should probably be removed, and will probably be addressed in the next point release.

This does bring up an underlying structure issue regarding the concept of /common in the script environment:

While it may not seem like much, the new ability to separate the engine source code into "engine code" and "application code" is a change that we've wanted for a long, long time, and is extremely nice to use--but we really don't have an equivalent for the script environment yet.

In a perfect world, one solution would be to have all of the "common" code refactored to a higher level, and "included" in all the game projects, instead of literally copied into each one as it stands now. We (Matt, myself, and the Associates) talked about it a bit, but the implementation time made it not feasible for this release, and we hadn't yet come up with a solid way of implementing it consistently, so we tabled it for a future release.
#2
04/08/2008 (5:07 pm)
Edit: nevermind, I re-read Zepp's post.
#3
04/09/2008 (3:13 am)
Thanks for your answer Stephen, I think I understood the problem :)

Since we're not living in a perfect world, wouldn't it be an acceptable compromise to not set a title (leave it blank) in the engine source (1), remove the call from common.cs (2) and set a default title only in init.cs (3)? Even people that can't or don't want to compile the source could set a title in a script file this way.
#4
04/15/2008 (10:25 am)
Setting the title in script overrides the initial title set in the engine source so there is no reason you would have to recompile.
#5
07/05/2008 (12:54 pm)
@Matt: For a short time the engine title pops up before the script initializes and takes over, so it is a good idea to make it blank.
#6
07/05/2008 (1:20 pm)
I too was digging through the code trying to find where the engine title was defined, but I couldn't seem to locate it. I know how to set the title for the window, but for the first few seconds before everything fires up "Torque Game Engine Advanced" is displayed on the window's title.