Support for existing OGRE fonts.

knox_12345

02-12-2008 04:19:20

Hi,

Is there anyway myGUI supports usage of default OGRE fonts, instead of it's own font manager.

The reason is that if we need to use bitmap-fonts, i.e. custom fonts that are created exclusively by hand, then it's almost impossible now.

So is there any way of letting myGUI use default OGRE fonts.

Also, does myGUI does automatic aspect ratio correction depending on the window resolution?
I mean, if we've created GUI layouts for 3:4 aspect ratio, then it shouldn't look stretched on a 16:9 aspect ratio.


Thanks

knox_12345

03-12-2008 11:59:49

Hi,

Anyone can help me here???

I want to use Ogre::Font rather than use the in-built font-manager of MyGUI.
Or else, if anyone can tell me how to use bitmap based fonts with myGUI, then I could do with that.

Is it possible?

Thanks.

Altren

03-12-2008 14:14:19

Open core_font.xml . There's ManualFont: <Font name="ManualFont" default_height="50" source="core.png">
<Code index="48" coord="0 203 50 50"/>
<Code index="49" coord="50 203 50 50"/>
<Code index="50" coord="100 203 50 50"/>
<Code index="51" coord="150 203 50 50"/>
</Font>
This is sample of bitmap font (actually it's used for MessageBox icons, but it doesn't matter).

knox_12345

04-12-2008 06:16:21

Thanks a lot. I'll look into that.

Another question, can you let me know if automatic aspect ratio correction is done on the GUI display entities.

Something like the metrics_mode relative_aspect_adjusted in OGRE overlays???

For example I create the GUI for 4:3 aspect and then it is run in aspect of 16:9. Let's say that the Window covered the whole screen in 4:3 AR.
If I run it in 16:9 ratio, then the Window should still have AR of 4:3, that means the left and right portion of the screen will not be covered by the window.

Does MyGUI handle this automatically? If not, is there any way to do it?

whizkid667

04-12-2008 09:03:13

I am also trying to use bitmap fonts. Here is what i've done

1. I commented out all font declaration in the core_font.xml file.
2. I copied the font declaration posted by 'Altren' to the core_font.xml file ,then I changed the name of this new(bitmap) font to "Default".
Now when I run any of the demo exes it throws an exception saying "could not find font Default "and the application ends.
Is this expected ? Do I have to add all the code indices to the Font declaration ? What am I missing here ? Help please.. :cry:
Thanks in Advance .

knox_12345

04-12-2008 11:35:16

I tried what Altren mentioned.
Looks like it's not working, since in the function FontManager::_load() if the attributes 'size' and 'resolution' are missing, then that particular font won't be enumerated.

I'll add those 2 attributes and try.

knox_12345

04-12-2008 11:46:36

I think a new FontManager::_load() function is required to load manual/bitmap fonts.

Cause in the current one, while reading the 'Code' attributes, only "range" and "hide" attributes are read.

Whereas, in what Altren had mentioned, it had "index" and "coord".

Any help here would be greatly appreciated.

Altren

04-12-2008 14:10:52

Oh, sorry, actually you need to have fresh code from svn to use bitmap fonts.

Altren

04-12-2008 14:23:12

Something like the metrics_mode relative_aspect_adjusted in OGRE overlays???You can use relative positions. For example for full screen widget use createWidgetReal<...>(0.,0.,1.,1., ...);
In layout editor you can find "to %" button.
Relative position is multiplied by screen width or height.

knox_12345

04-12-2008 16:08:08

Oh, sorry, actually you need to have fresh code from svn to use bitmap fonts.
Is it from the following location?
http://lawliet.net84.net/Packs/1076.rar

Or is there up-to-date SVN repository I need to get it from?
Let me know.

Thanks.

knox_12345

04-12-2008 16:16:21

Something like the metrics_mode relative_aspect_adjusted in OGRE overlays???You can use relative positions. For example for full screen widget use createWidgetReal<...>(0.,0.,1.,1., ...);
In layout editor you can find "to %" button.
Relative position is multiplied by screen width or height.


Even if I use percentage, I don't think it'll solve the problem.

For ex, if I have a Window of 1024 x 768, with left and top positions as 0, 0 and I set the percentage to 100% of height and 100% of width.
And I run it in 1920 x 1080 (wide screen full HD :D ) resolution, then the proper dimensions of the window should be 1440 x 1080.
And 240 pixels on the left vertical and 240 pixels on the right vertical will be blank.
I was talking about that kind of aspect-ratio correction.

If I use percentage, then I'll end up with a window of size 1920 x 1080.
Which is wrong, aspect-ratio wise.

Any help here would be welcome.

Altren

04-12-2008 21:18:32

Or is there up-to-date SVN repository I need to get it from?
Let me know.
http://sourceforge.net/svn/?group_id=193706

knox_12345

05-12-2008 04:18:07

Or is there up-to-date SVN repository I need to get it from?
Let me know.
http://sourceforge.net/svn/?group_id=193706


There are two folders in the repository:

1. my-gui\tags\MyGUI2.0
2. my-gui\trunk

Both have VisualStudio projects.
Which folder should I use?

Thanks

knox_12345

05-12-2008 04:26:19

Okay, figured out to use the 'trunk' folder. Saw the SVN log :lol:

knox_12345

05-12-2008 16:32:55

Something like the metrics_mode relative_aspect_adjusted in OGRE overlays???You can use relative positions. For example for full screen widget use createWidgetReal<...>(0.,0.,1.,1., ...);
In layout editor you can find "to %" button.
Relative position is multiplied by screen width or height.


Even if I use percentage, I don't think it'll solve the problem.

For ex, if I have a Window of 1024 x 768, with left and top positions as 0, 0 and I set the percentage to 100% of height and 100% of width.
And I run it in 1920 x 1080 (wide screen full HD :D ) resolution, then the proper dimensions of the window should be 1440 x 1080.
And 240 pixels on the left vertical and 240 pixels on the right vertical will be blank.
I was talking about that kind of aspect-ratio correction.

If I use percentage, then I'll end up with a window of size 1920 x 1080.
Which is wrong, aspect-ratio wise.

Any help here would be welcome.


Hey, any help can be extended here?

Altren

05-12-2008 17:46:12

Actually I don't understand your problem. If you creating widget with size 1. 1. then it will be full screen in any resolution.

RT

08-12-2008 08:18:03

Actually I don't understand your problem. If you creating widget with size 1. 1. then it will be full screen in any resolution.
That is his problem.

If he creates a full-screen asset at a 4:3 resolution and then loads the GUI at a 16:9 (widescreen) aspect ratio the asset will be stretched horizontally to fill the screen. He wants to be able to change screen resolutions while preserving the aspect ratio of his components.

I'm interested in this too, as it's something I'll have to deal with sooner or late myself.

Altren

08-12-2008 14:44:16

Just resize it manually after loading (in layout use size for 1024x786 or any other). Your task is not typical, so I think we don't need to create such functionality in core.

RT

09-12-2008 03:04:16

I don't know about it not being typical, but you're right that it can be dealt with easily enough at our end.

Rather than resizing pieces individually I'd suggest sticking everything inside a container element and sizing them relative to that. When the GUI is loaded you then check for the existence of that container element and, if it exists and the screen aspect ratio does not match, resize that instead.

The good thing is that since MyGUI is designed with user data in mind this should be very easy to implement. :-)

knox_12345

09-12-2008 03:57:55

In the version that I downloaded, combo-box selection with mouse does not seem to be working.

http://sourceforge.net/svn/?group_id=193706

The selection works for the first time, and then any selection i do with the mouse closes the drop-down box, and the selection remains unchanged.
But with the keyboard it works fine.

Help anyone?

knox_12345

09-12-2008 04:43:30

I got the latest version from SVN.
I tested the combo-box problem, I think it's resolevd in this version.
However, I ran into Visual Studio 8 compile problems.

One major error is that it's trying to use OgreMemoryManager.h, which doesn't exist in OGRE 1.6.0.

Below is the log:

>Compiling...
1>EditorState.cpp
1>myGUI\trunk\tools\layouteditor\editorstate.cpp(1) : warning C4653: compiler option 'Optimizations (one or more of /Oawstgp[y]) or debug checks (one or more of /GZ, /RTCcsu)' inconsistent with precompiled header; current command-line option ignored
1>myGUI\trunk\tools\layouteditor\editorstate.cpp(1) : error C2855: command-line option '/Gm' inconsistent with precompiled header
1>myGUI\trunk\tools\layouteditor\editorstate.cpp(1) : error C2859: myGUI\trunk\tools\layouteditor\obj\debug\vc80.pdb is not the pdb file that was used when this precompiled header was created, recreate the precompiled header.
1>myGUI\trunk\tools\layouteditor\editorstate.cpp(1) : error C2859: myGUI\trunk\tools\layouteditor\obj\debug\vc80.idb is not the idb file that was used when this precompiled header was created, recreate the precompiled header.
1>myGUI\trunk\tools\layouteditor\editorstate.cpp(121) : error C2440: '=' : cannot convert from 'MyGUI::MenuCtrlPtr' to 'MyGUI::PopupMenuPtr'
1> Cast from base to derived requires dynamic_cast or static_cast
1>myGUI\trunk\tools\layouteditor\editorstate.cpp(123) : error C2440: '=' : cannot convert from 'MyGUI::MenuCtrlPtr' to 'MyGUI::PopupMenuPtr'
1> Cast from base to derived requires dynamic_cast or static_cast
1>myGUI\trunk\tools\layouteditor\editorstate.cpp(148) : error C2039: 'eventPopupMenuAccept' : is not a member of 'MyGUI::MenuBar'
1> myGUI\trunk\myguiengine\include\mygui_menubar.h(16) : see declaration of 'MyGUI::MenuBar'
1>myGUI\trunk\tools\layouteditor\editorstate.cpp(714) : error C2039: 'eventPopupMenuAccept' : is not a member of 'MyGUI::PopupMenu'
1> myGUI\trunk\myguiengine\include\mygui_popupmenu.h(16) : see declaration of 'MyGUI::PopupMenu'
1>myGUI\trunk\tools\layouteditor\editorstate.cpp(730) : error C2440: 'initializing' : cannot convert from 'MyGUI::MenuCtrlPtr' to 'MyGUI::PopupMenuPtr'
1> Cast from base to derived requires dynamic_cast or static_cast
1>myGUI\trunk\tools\layouteditor\editorstate.cpp(731) : error C2039: 'eventPopupMenuAccept' : is not a member of 'MyGUI::PopupMenu'
1> myGUI\trunk\myguiengine\include\mygui_popupmenu.h(16) : see declaration of 'MyGUI::PopupMenu'
1>Build Time 0:00
1>Build log was saved at "file://myGUI\trunk\Tools\LayoutEditor\obj\Debug\BuildLog.htm"
1>LayoutEditor - 9 error(s), 1 warning(s)
2>------ Build started: Project: UnitTest_AttachDetach, Configuration: Debug Win32 ------
2>Compiling...
2>DemoKeeper.cpp
2>myGUI\trunk\unittests\unittest_attachdetach\demokeeper.cpp(89) : error C2027: use of undefined type 'Ogre::MemoryManager'
2> ogre\1.6.0\ogremain\include\ogreprerequisites.h(284) : see declaration of 'Ogre::MemoryManager'
2>myGUI\trunk\unittests\unittest_attachdetach\demokeeper.cpp(89) : error C3861: 'instance': identifier not found
2>myGUI\trunk\unittests\unittest_attachdetach\demokeeper.cpp(92) : error C2027: use of undefined type 'Ogre::MemoryManager'
2> ogre\1.6.0\ogremain\include\ogreprerequisites.h(284) : see declaration of 'Ogre::MemoryManager'
2>myGUI\trunk\unittests\unittest_attachdetach\demokeeper.cpp(92) : error C2228: left of '.validateAddr' must have class/struct/union
2>Build Time 0:05
2>Build log was saved at "file://myGUI\trunk\UnitTests\UnitTest_AttachDetach\obj\Debug\BuildLog.htm"
2>UnitTest_AttachDetach - 4 error(s), 0 warning(s)

my.name

09-12-2008 15:08:46

>> In the version that I downloaded, combo-box selection with mouse does not seem to be working.

fixed