How 2 change the City Screen layout?

griffin71

Chieftain
Joined
Jun 10, 2006
Messages
22
Location
Amsterdam
Hi, I'm working on a change of the city screen, but I'm stuck with it.
I want to extend the pane that shows the food and hammer boxes. This can in principal be done by modifying CvMainInterface.py
However, when I change

screen.addPanel( "InterfaceTopLeftBackgroundWidget", u"", u"", True, False, 258, 0, xResolution - 516, yResolution-149, PanelStyles.PANEL_STYLE_STANDARD )

the widget does not extend vertically. Instead, it can only shift down or shrink vertically. (Changes in the width or horizontal position are not a problem though.)
If I also change

screen.setStyle( "InterfaceTopLeftBackgroundWidget", "Panel_City_Top_Style")

to use "Panel_Game_HudMap_Style" instead, the widget does extend vertically, just as I would expect; arguments 6 - 9 then are the lop left position and the width and height of the widget.

This lead me to the conclusion that it is the "Panel_City_Top_Style" that prevents the widget from extending vertically. The styles are defined in Civ4Theme_Custom.thm, but if I change the style there, no changes are reflected in the city screen. Neither after reloading the mod.
Does this mean the SDK has to be recompiled, or are there easier methods available?

Thanks for any help :thumbsup:
 
From the above post I assume you want to extend it vertically (wasn't specified).

Seems to me that you're going after the wrong widget. I'd be very suprised if "InterfaceTopLeftBackgroundWidget" was the top-centre panel (which is the one you seem to be talking about). "CityScreenTopWidget" seems to me to be much more likely (untested).

Just to clarify, in case you are unaware the "[...], 258, 0, xResolution - 516, yResolution-149, [...]" bit in the addPanel method controls the position, and size of the panel. The numbers correspond to, in order: "[...], X position, Y position, X size, Y size, [...]".

Definately no SDK work is required - you can't do anything like this with the SDK. Same with the styles. It's all in CvMainInterface.py.
 
The Great Apple said:
From the above post I assume you want to extend it vertically (wasn't specified).
Indeed so, I'm sorry for the lack of clarity.

The Great Apple said:
Seems to me that you're going after the wrong widget. I'd be very suprised if "InterfaceTopLeftBackgroundWidget" was the top-centre panel (which is the one you seem to be talking about). "CityScreenTopWidget" seems to me to be much more likely (untested).

This was my first guess as well. However, the CityScreenTopWidget is the bar at the very top of the screen, that shows your gold, science bar, and the year.

The Great Apple said:
Just to clarify, in case you are unaware the "[...], 258, 0, xResolution - 516, yResolution-149, [...]" bit in the addPanel method controls the position, and size of the panel. The numbers correspond to, in order: "[...], X position, Y position, X size, Y size, [...]".
I know. That's why I was so surprised to see that Y size has the value of yResolution-149, though the widget only seems to vertically extend from the top of the screen by about 130 pixels or so.
Just to take away all lack of clarity: I am talking about the widget that creates the semi opaque blue background extending form the top of the screen to a few pixels beneeth the food and production bar panel.

What adds to my confusion is that if you change the style of the widget, by saying
screen.setStyle( "InterfaceCenterLeftBackgroundWidget", "Panel_Game_HudMap_Style" )
instead of the default
screen.setStyle( "InterfaceTopLeftBackgroundWidget", "Panel_City_Top_Style" ),
then you will see that the widget does extend to box at the bottom that contains the unit and building icons.

The Great Apple said:
Definately no SDK work is required - you can't do anything like this with the SDK. Same with the styles. It's all in CvMainInterface.py.
OK, I understand that the cityscreen itself is defined by the python calls in CvMainInterface.py.
But then when do the changes made to Civ4Theme_HUD.thm come into effect? Civ4Theme_HUD.thm also has C comments, and will for that reason not be readable to python.
Moreover, CvEnums.h contains the following text:
enum DllExport PanelStyles
enum DllExport PanelStyles // Exposed to Python
{
// Built in styles
PANEL_STYLE_STANDARD,
PANEL_STYLE_STANDARD,
PANEL_STYLE_SOLID,​
So, in order to add a new style, does the SDK have to be recompiled after all?

Thanks a lot for taking the time to look at the problem.

griffin71
 
Back
Top Bottom