SP Info Presentation Changing color of Text, Buttons, Menus and highlight state (a question 4 Gurus)

Users who are viewing this thread

Swyter

Grandmaster Knight
Well community, someone knows a form to change the color of buttons. :grin: I suppose that the game_variables.txt file has "hiden variables" to change the color of menus (Ive probe that), etc... :grin:

I want to change to white scheme my mod UI :shock:, and use the module.ini specific line to change main menu text color, and the other menu_color variable, in module_game_menus. But now I want to take one more step ahead (i wrote this well?) and modify the rest...


Suggestions are admited :wink:, I need your expert help and M&B gurus experience... (as we say in Spain "the ball is in your roof") :grin:


Thanks in Advance for your great Help :wink:
and Happy Summer... :mrgreen:

See solution at post #10
 
Last edited by a moderator:
With fewer smilies I'd like to add, that I saw an in-production/dead mod give a different colored outline (known as a stroke I think) to the names of all towns on the map. It made them a lot easier to read. Anyone know that trick?
 
Swyter said:
Well community, someone knows a form to change the color of buttons.  :grin: I suppose that the game_variables.txt file has "hiden variables" to change the color of menus (Ive probe that), etc...  :grin:

If you mean the button itself, it's actual textures you have to edit.
 
No, that is too easy  :roll:, I say, the text of buttons, how to change his color. There is hidden variables to edit this (as Main Menu text color, etc...)

I want to replace the ugly green and yellow of highlight button text states... i can not be too hard...


Some help by here?
 
It says buttons and text separately.

Anyway, forget it, it's not the point.
He asked how to change the buttons, i told him how to change the buttons.

To change the text, if the game is like many others, i think you have to replace the font (It's an actual image containing letters) which i think is black by default.
If that's the case, it is that easy.
 
The right topic name is meant to be this. "Changing color of Text: Buttons, Menus and highlight state". But you should still get the idea. At least I did.
 
I got the idea that he want to know how to change the color of Text, Buttons, Menus and Highlight State. Especially since in the topic, he stated it as "buttons" and not "text".

And i believe all of them are images. I havent tried changing the font, but i know for a fact that both buttons, menus, and "highlight state" are images. And i believe the font is so as well.
 
@Eärendil the Mariner reminded me of this thread.

When your cursor moves over any text label (think of the lord or location lists) it changes to pure blue and red. Same for selected labels.
You can't change those colors otherwise, they are hardcoded by the engine. With this you can override them.

Turns out the highlight state for the things I was asking about are hardcoded and don't have their corresponding .txt variables. But for SWC and TLD we ended up replacing those ugly electric blue colors by changing the font file vertex shader with simple rules.

If the vertex color is between this and that shade of blue, replace it with this other color. And it works fine in DirectX 9 mode. :party:

Star Wars Conquest
https://github.com/swconquest/swconquest/blob/master/mb_src.fx#L718-L776 (M&B 1.011)
https://github.com/swconquest/swconquest/blob/master/_wb/mb_src.fx#L525-L583 (Warband)

The Last Days
https://github.com/tldmod/tldmod/blob/master/mb_src.fx#L785-L792 (M&B 1.011)
https://github.com/tldmod/tldmod/blob/master/_wb/mb_src.fx#L5814-L5821 (Warband)

That's nice and all, but how do I use all this?
The short and sweet version is that you need to change the vs_font function of your game that ends up being used for the font_uniform_color, font_background and font_outline HLSL techniques.
  1. Get the Native HLSL shader file in text form. For M&B 1.011 you can find the mb.fx file in the game's root folder when you install the enhanced version, or just grab it from here. The Warband shaders are distributed separately, here.
  2. Get Microsoft's DirectX 9 Shader Compiler binary, you can get it as part of the legacy DirectX SDK or directly from here. You can check that the file is signed by Microsoft and hasn't been tampered with by going to Properties > Digital Signatures; ensure it's valid before running it.
  3. Rename your shader file to mb_src.fx, just to make it clear. Get the compile script from here and fxc64.exe and put everything in the same folder.
  4. Edit the mb_src.fx file with your favorite text editor (if there isn't HLSL, Cg, GLSL syntax highlighting you can set it to C or C++) as shown in the SWC and TLD examples above. You can pretty much copy-paste the highlighted part in the middle of the function and it will work all the same.
  5. Run the compile script by double clicking _compile_fx64.cmd, for Warband it will take a while, depending on your CPU. If everything is okay a new mb.fx file will show up. Put that file next to your mod's module.ini, in the mod root folder and next time you launch the mod the game will pick that file instead of the common one.
  6. Remember that you can live reload the shader file by pressing Ctrl + F when edit mode is enabled in the launcher, without having to restart the game, which makes testing and prototyping a much nicer experience.

Note: Mount&Blade 1.011 has a much more limited support for shaders, maybe you want to use Iron Launcher's dinput8.dll to provide that functionality; just drop that next to the game's binary and everything should work out of the box. While also providing Data folder and core_*.brf resource overrides.
 
Last edited:
Last edited:
Needed to download fx_configuration.h
Found here:

What is the difference between compilator from taleworlds and this one?
The first creates mb_2a.fxo and mb_2b.fxo. And the second produce mb.fx file.
Warband can read from either mb_2a.fxo and mb_2b.fxo or a precompiled mb.fx.

The way the native compiler works, it compiles every shader twice, and compiles shaders with the PS_2_X tag in a different pixel shader model each pass. Basically just doubling your compile time to increase compatibility with systems that can use model 2b but not model 2a.

But, honestly, you're not going to run into a system stuck a ps_2_b these days, so compiling them all in fixed ps_2_* is more than fine, and that's what Swy's does. It looks like he chose 2_b despite it being older with slightly fewer features because Warband likely doesn't pass along the info you need for those features, and it increases the amount of temporary registers you can use.

Page 35 of this pdf can show you the difference between shader models if you're interested: https://developer.amd.com/wordpress/media/2012/10/D3DTutorial_ShaderModels.pdf
 
Last edited:
Thanks for clarification. Another offtopic question: "How did Swyter created a link to github with highlited code?"
1) Click on the first line
2) ctrl+shift+click on the last line
The browser will point to the link in the address line.
 
Last edited:
Back
Top Bottom