Fonts updates and sound
I n the previous entry I mentioned the how font support was implemented. But after some testing it's just not finished yet. The one problem is, that AssetJa2Font class represents just one concrete font, like 10 pt Arial bold. What is also needed is a class that will group various font assets like normal, bold and italic. Therefor new class was created, AssetFontClass. This has also another benefit - if in future I would like to replace for instance font10arial.sti with some other open-source alternative, it would be no problem. I would just create the AssetFontClass asset with another font and it will work. The default font classes (from JA2 assets) are generated using menu option.
There was also another change regarding the fonts and it was metrics computation. When I initially implemented font support, I didn't bother using right values for various properties of the font metrics (like ascentline, descentline, ...) which resulted in wrong rendering of the text, like for instance alignment wasn't working properly. This was fixed and new importer options were added to be able to specify it per font basis. Because of those changes, the TextWithShadow component was replaced by the generic TextComponent which is now using AssetFontClass directly.
The next new thing that I was working on was SoundManager. It is based on ScriptableObjectManager class. At first I wasn't sure if there should be global sound manager or it should be per-scene basis, but it's same as with the camera. There need to be a "singleton" that will handle sound and music whole time. Default mixer and audio group was also created. The SoundManager is now used in main menu scene, where the background music is playing. Because this background music should also play in for instance credits, the audio source couldn't be in main menu scene as it would be destroyed, when the credits scene would be loaded. Therefor SoundManager has special method for attaching the audio source to it and it would be played till it isn't destroyed.
The work for the credits scene has also began. The parsing of .edt file is working. They are just blobs which are encrypted by primitive algorithm.
Finally, quite a bugs were fixed, as always (like preventing adding duplicitous asset ref mocker values for the same component).

Comments