So, having finally got dev builds working, I'm trying to actually do something useful for the project.
Question: How do I get the text size of the default font?
I know the method I need: MyGUI::ResourceTrueTypeFont::getDefaultHeight()
I know the resource I need: the "Magic Cards" font.
I know that "Magic Cards" is set as the default font in resources/mygui/openmw_settings.xml, which is then defined in openmw_font.xml
What I don't know is what MyGUI incantation I need to ask it "give me your default Font resource and call getDefaultHeight on it."
MyGUI is so horribly documented, I'm also going to ask if anyone's expressed any interest in ditching MyGUI for, I dunno, something with proper documentation? Or any documentation at all?
Thanks!
help with MyGUI
Re: help with MyGUI
I agree that some documentation could be improved, but you could have picked a better example.
A google search for "MyGUI default font" leads to http://mygui.info/docs/class_my_g_u_i_1 ... nager.html
From there I'd say it's pretty obvious:
Some people have proposed switching to HTML/librocket, but no one stepped forward to do the work. Seems unlikely to happen, now that we already have ~25k lines of GUI code written using MyGUI
I'd imagine we could add a "HTML widget" to MyGUI that lets you write HTML, so we would have HTML in addition to MyGUI rather than as complete replacement. Mod authors could take their pick.
A google search for "MyGUI default font" leads to http://mygui.info/docs/class_my_g_u_i_1 ... nager.html
From there I'd say it's pretty obvious:
Code: Select all
MyGUI::FontManager& fontMgr = MyGUI::FontManager::getInstance();
int defaultHeight = fontMgr.getByName(fontMgr.getDefaultFont())->getDefaultHeight()
I'm quite happy with MyGUI myself. The codebase is very solid and is modular enough that we could add any feature we wanted.I'm also going to ask if anyone's expressed any interest in ditching MyGUI
Some people have proposed switching to HTML/librocket, but no one stepped forward to do the work. Seems unlikely to happen, now that we already have ~25k lines of GUI code written using MyGUI
I'd imagine we could add a "HTML widget" to MyGUI that lets you write HTML, so we would have HTML in addition to MyGUI rather than as complete replacement. Mod authors could take their pick.
Re: help with MyGUI
Of course it's something simple... Thanks
Class docs are one thing, but anything else (like the files actually included in the "docs" folder) is all in Russian.
Is the xml schema actually documented anywhere? The only thing I've found is a short and outdated list on the ogre wiki.
Class docs are one thing, but anything else (like the files actually included in the "docs" folder) is all in Russian.
Is the xml schema actually documented anywhere? The only thing I've found is a short and outdated list on the ogre wiki.
Re: help with MyGUI
Making some progress!
I didn't go into it in the OP, but I'm working on making the UI scale properly relative to the text size, because I'm old and can't read tiny text very well anymore. And because Morrowind has a ton of text in it, poor legibility is a huge barrier to enjoying the game. This is actually what put OpenMW on my radar in the first place.
Fortunately, increasing the text size was pretty easy! It also made all the UI glitches stand out like a sore thumb, so I'm exploring ways to fix them, whether it's XML editing or code changes.
First up: the player stats window.
Here's what it looks like without any code changes (roughly -- the level/race/class were cropped before some XML changes I didn't revert before making the screenshot):
The first thing I did was to change the sLineHeight so it wasn't const, and setting it to the default font's height in the widget constructor. This solved part of the problem, but the tops of the lines were getting cut off:
I found the culprit where the "height" value of the coord1 was hard-set to a value (18) instead of using sLineHeight, and once I fixed that, the layout looks much better:
(note, the box around the skills is missing due to an XML edit, not a rendering bug)
Now to try to work the same magic for the left pane..
I didn't go into it in the OP, but I'm working on making the UI scale properly relative to the text size, because I'm old and can't read tiny text very well anymore. And because Morrowind has a ton of text in it, poor legibility is a huge barrier to enjoying the game. This is actually what put OpenMW on my radar in the first place.
Fortunately, increasing the text size was pretty easy! It also made all the UI glitches stand out like a sore thumb, so I'm exploring ways to fix them, whether it's XML editing or code changes.
First up: the player stats window.
Here's what it looks like without any code changes (roughly -- the level/race/class were cropped before some XML changes I didn't revert before making the screenshot):
The first thing I did was to change the sLineHeight so it wasn't const, and setting it to the default font's height in the widget constructor. This solved part of the problem, but the tops of the lines were getting cut off:
I found the culprit where the "height" value of the coord1 was hard-set to a value (18) instead of using sLineHeight, and once I fixed that, the layout looks much better:
(note, the box around the skills is missing due to an XML edit, not a rendering bug)
Now to try to work the same magic for the left pane..
Re: help with MyGUI
health/magicka/fatigue section is working now.
Re: help with MyGUI
Cool! Have you thought about handling cases where the text is too big and makes a part of the menu go off-screen?
Re: help with MyGUI
Not in terms of throwing up an error dialog or anything, but I'll try scaling up to obscene sizes to see how it looks.
For sane text sizes, though, it works well.
Large text:
Small text:
For sane text sizes, though, it works well.
Large text:
Small text:
Re: help with MyGUI
Just for fun I cranked up the size to 72 (the "large" text in earlier shots was size=36).
It actually does well! The only thing that doesn't scale up is the size of the health/magicka/fatigue bars. Everything else is perfect.
(slightly downscaled to fit into the attachment resolution limits)
It actually does well! The only thing that doesn't scale up is the size of the health/magicka/fatigue bars. Everything else is perfect.
(slightly downscaled to fit into the attachment resolution limits)
- psi29a
- Posts: 5362
- Joined: 29 Sep 2011, 10:13
- Location: Belgium
- Gitlab profile: https://gitlab.com/psi29a/
- Contact:
Re: help with MyGUI
A good target should be 4K resolution... i usually have to switch to TTF to get something that looks good.
Re: help with MyGUI
All of the above shots are using the Pelagiad TTF linked in the Wiki.
Sadly I don't have a 4K monitor to test with, so the best I can do is to crank the size up to absurd levels and hope the rest of the UI scales properly.
Sadly I don't have a 4K monitor to test with, so the best I can do is to crank the size up to absurd levels and hope the rest of the UI scales properly.