How to use CEGUI with SDL and OpenGL

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

wondersye
Not too shy to talk
Not too shy to talk
Posts: 21
Joined: Sun May 22, 2011 16:04

How to use CEGUI with SDL and OpenGL

Postby wondersye » Sun Jun 12, 2011 14:01

Hi,

Just to open a thread about a small HOW-TO I just added: http://www.cegui.org.uk/wiki/index.php?title=How_to_use_CEGUI_with_SDL_and_OpenGL.

Any (constructive) feedback welcome!

By the way, here are a few remarks that I gathered during this (mostly successful - a real pleasure) test:

- single-line editbox: if the number of entries is too small to require scrollbars, entries will be rendered in a drop-down area that is too tall
- radio buttons: despite having put the two radio buttons in the same group ID, when either will be clicked, the second button will be selected, and they will stay in that state whatever the user does; but grouping them in a GroupBox (only change performed) made them work as expected (maybe it is a constraint I was not aware of?)
- on my second example, the marker of the slider will not appear unless the hosting window is resized
- how one can find the full list of widgets supported by a given Look, like the Taharez one?
- Demo7 has an AlternateProgressBar widget that I could not create from my test case, apparently?

Thanks in advance for any hint,

Olivier Boudeville.

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: How to use CEGUI with SDL and OpenGL

Postby Kulik » Sun Jun 12, 2011 14:57

A great contribution, thanks a lot!

The radio buttons have to all be in the same Window according to the source code. Only siblings are checked for groupID.
You can usually browse the scheme file you are using and see all the widget mappings that are there, these are what's available. (datafiles/schemes/TaharezLook.scheme for example)

As of now I can't comment on the other issues, hopefully I will get back to it later.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: How to use CEGUI with SDL and OpenGL

Postby CrazyEddie » Mon Jun 13, 2011 07:06

wondersye wrote: - single-line editbox: if the number of entries is too small to require scrollbars, entries will be rendered in a drop-down area that is too tall

I think you mean combo box? This is normal - though perhaps undesired - behaviour; the size does not auto-adjust (add a feature request on mantis if you'd like to see this at some time in the future :))

wondersye wrote: - on my second example, the marker of the slider will not appear unless the hosting window is resized

We've had a few instance of this, I thought I'd got them all, but every now and then another case will arise. I will test the example code and see if I can reproduce this (will not be until the coming weekend though)

wondersye wrote: - how one can find the full list of widgets supported by a given Look, like the Taharez one?

As well as what Kulik said, you can also look at the property list pages, since they also list all the widget types from each scheme (http://cegui.org.uk/static/TaharezLookProperties.html http://cegui.org.uk/static/WindowsLookProperties.html http://cegui.org.uk/static/VanillaProperties.html http://cegui.org.uk/static/OgreTrayProperties.html)

wondersye wrote: - Demo7 has an AlternateProgressBar widget that I could not create from my test case, apparently?

Strange. Should work fine. Do you get an error, or does it just not appear?

CE.

wondersye
Not too shy to talk
Not too shy to talk
Posts: 21
Joined: Sun May 22, 2011 16:04

Re: How to use CEGUI with SDL and OpenGL

Postby wondersye » Tue Jun 14, 2011 11:53

Kulik wrote:The radio buttons have to all be in the same Window according to the source code. Only siblings are checked for groupID.


Indeed, it was definitively the case with the group box. But it was also the case before, as both buttons were defined in the same window, alongside with other widgets. Maybe radio buttons have to be in the same container *and* there must only them in that container?

Kulik wrote:You can usually browse the scheme file you are using and see all the widget mappings that are there, these are what's available. (datafiles/schemes/TaharezLook.scheme for example)

Works great, thanks!

wondersye
Not too shy to talk
Not too shy to talk
Posts: 21
Joined: Sun May 22, 2011 16:04

Re: How to use CEGUI with SDL and OpenGL

Postby wondersye » Tue Jun 14, 2011 12:19

CrazyEddie wrote:
wondersye wrote: - single-line editbox: if the number of entries is too small to require scrollbars, entries will be rendered in a drop-down area that is too tall

I think you mean combo box? This is normal - though perhaps undesired - behaviour; the size does not auto-adjust (add a feature request on mantis if you'd like to see this at some time in the future :))

Yes, indeed, I meant a combo box. Feature request will be added (as it is among the only visual glitches I spotted) when Launchpad login will stop freezing for me!

CrazyEddie wrote:
wondersye wrote: - on my second example, the marker of the slider will not appear unless the hosting window is resized

We've had a few instance of this, I thought I'd got them all, but every now and then another case will arise. I will test the example code and see if I can reproduce this (will not be until the coming weekend though)

Thanks!

CrazyEddie wrote:
wondersye wrote: - Demo7 has an AlternateProgressBar widget that I could not create from my test case, apparently?

Strange. Should work fine. Do you get an error, or does it just not appear?
CE.


Actually I could not see this class in http://www.cegui.org.uk/docs/current/annotated.html (same thing for "TaharezLook/VUMeter") and an attempt to compile:

Code: Select all

  AlternateProgressBar & alternateProgressBar = * static_cast<AlternateProgressBar*>(
       winManager.createWindow( "TaharezLook/AlternateProgressBar",
        "MyAlternateprogressbar" ) ) ;

yields:

Code: Select all

CEGUI-SDL-all-widgets.cc: In function ‘void create_advanced_widgets_frame(CEGUI::WindowManager&, CEGUI::Window&)’:                             
CEGUI-SDL-all-widgets.cc:586:3: error: ‘AlternateProgressBar’ was not declared in this scope                                                   


Whereas the other widgets are ok ; ex: a few lines before, I have:

Code: Select all

 ProgressBar & progressBar = * static_cast<ProgressBar*>(
   winManager.createWindow( "TaharezLook/ProgressBar", "MyProgressBar" ) ) ;

and it compiles ok.

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: How to use CEGUI with SDL and OpenGL

Postby Kulik » Tue Jun 14, 2011 12:42

The important thing to note is that widget classes in C++ coupled with widget renderer and looknfeel are mapped to the target type.

For example static text also doesn't exist in C++ as you don't need any native class for it, CEGUI::Window suffices and looknfeel suffices. I think AlternateProgressBar is just a differently skinned ProgressBar.

wondersye
Not too shy to talk
Not too shy to talk
Posts: 21
Joined: Sun May 22, 2011 16:04

Re: How to use CEGUI with SDL and OpenGL

Postby wondersye » Tue Jun 14, 2011 14:49

Kulik wrote:The important thing to note is that widget classes in C++ coupled with widget renderer and looknfeel are mapped to the target type.

For example static text also doesn't exist in C++ as you don't need any native class for it, CEGUI::Window suffices and looknfeel suffices. I think AlternateProgressBar is just a differently skinned ProgressBar.


Ah ok, I see, I thought there was a closer, 1-to-1, relationship between XML data and actual code; how could I create programmatically such a skinned progressbar then?

BTW, just created a feature request for the aforementioned auto-adjustment of the height of a drop-down list (for a combo box) : http://www.cegui.org.uk/mantis/view.php?id=460

wondersye
Not too shy to talk
Not too shy to talk
Posts: 21
Joined: Sun May 22, 2011 16:04

Re: How to use CEGUI with SDL and OpenGL

Postby wondersye » Tue Jun 14, 2011 15:30

I suppose I understand better now, looking at TaharezLook.scheme:

Code: Select all

[..]
   <FalagardMapping WindowType="TaharezLook/AlternateProgressBar" TargetType="CEGUI/ProgressBar" Renderer="Falagard/ProgressBar" LookNFeel="TaharezLook/AltProgressBar" />
   <FalagardMapping WindowType="TaharezLook/ProgressBar"          TargetType="CEGUI/ProgressBar" Renderer="Falagard/ProgressBar" LookNFeel="TaharezLook/ProgressBar" />
[..]


1. if I want to know all classes that I can create in the context of a scheme, I have to look at TargetType attributes
2. if I want to know all widgets I can rely on in the context of a scheme, I have to look at WindowType attributes

For the first point, we have then 30 classes:

Code: Select all

grep TargetType ./share/CEGUI/schemes/TaharezLook.scheme|sed 's|.*TargetType="||1' | sed 's|".*||1'|sort|uniq 



CEGUI/Checkbox
CEGUI/Combobox
CEGUI/ComboDropList
CEGUI/Editbox
CEGUI/FrameWindow
CEGUI/GroupBox
CEGUI/ItemEntry
CEGUI/ItemListbox
CEGUI/Listbox
CEGUI/ListHeader
CEGUI/ListHeaderSegment
CEGUI/Menubar
CEGUI/MenuItem
CEGUI/MultiColumnList
CEGUI/MultiLineEditbox
CEGUI/PopupMenu
CEGUI/ProgressBar
CEGUI/PushButton
CEGUI/RadioButton
CEGUI/ScrollablePane
CEGUI/Scrollbar
CEGUI/Slider
CEGUI/Spinner
CEGUI/TabButton
CEGUI/TabControl
CEGUI/Thumb
CEGUI/Titlebar
CEGUI/Tooltip
CEGUI/Tree
DefaultWindow


For the second point, we have 43 widgets:

Code: Select all

grep WindowType ./share/CEGUI/schemes/TaharezLook.scheme|sed 's|.*WindowType="||1' | sed 's|".*||1'|sort|uniq 



TaharezLook/AlternateProgressBar
TaharezLook/Button
TaharezLook/Checkbox
TaharezLook/Combobox
TaharezLook/ComboDropList
TaharezLook/ComboEditbox
TaharezLook/Editbox
TaharezLook/FrameWindow
TaharezLook/GroupBox
TaharezLook/HorizontalScrollbar
TaharezLook/HorizontalScrollbarThumb
TaharezLook/ImageButton
TaharezLook/ItemListbox
TaharezLook/LargeVerticalScrollbar
TaharezLook/LargeVerticalScrollbarThumb
TaharezLook/Listbox
TaharezLook/ListboxItem
TaharezLook/ListHeader
TaharezLook/ListHeaderSegment
TaharezLook/Menubar
TaharezLook/MenuItem
TaharezLook/MultiColumnList
TaharezLook/MultiLineEditbox
TaharezLook/PopupMenu
TaharezLook/ProgressBar
TaharezLook/RadioButton
TaharezLook/ScrollablePane
TaharezLook/Slider
TaharezLook/SliderThumb
TaharezLook/Spinner
TaharezLook/StaticImage
TaharezLook/StaticText
TaharezLook/SystemButton
TaharezLook/TabButton
TaharezLook/TabButtonPane
TaharezLook/TabContentPane
TaharezLook/TabControl
TaharezLook/Titlebar
TaharezLook/Tooltip
TaharezLook/Tree
TaharezLook/VerticalScrollbar
TaharezLook/VerticalScrollbarThumb
TaharezLook/VUMeter


(last point will thus to know how widgets like AlternateProgressBar that do not have a counterpart C++ class can nevertheless be created from code)


Return to “Help”

Who is online

Users browsing this forum: No registered users and 3 guests