confused at scheme files

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

billconan
Just popping in
Just popping in
Posts: 12
Joined: Wed May 17, 2006 14:11

confused at scheme files

Postby billconan » Wed May 17, 2006 14:41

hello guys, i'm new to cegui.

i've some questions about scheme files.

(1) why do scheme files exist, since there are looknfeel, imageset and font files already to indicate the appearance of the user interface.

(2) i've opened a scheme files in the sample enclosed in the cegui sdk, however i can only find a set of names without the filename of other resources files like the looknfeel files. so how does the cegui find the looknfeel of the components?

here is the source code:

Code: Select all

CEGUI::SchemeManager::getSingleton().loadScheme("../datafiles/schemes/TaharezLookWidgets.scheme");
CEGUI::Imageset* taharezImages = CEGUI::ImagesetManager::getSingleton().createImageset("../datafiles/imagesets/TaharezLook.imageset");
CEGUI::FontManager::getSingleton().createFont("../datafiles/fonts/Commonwealth-10.font");
CEGUI::System::getSingleton().setDefaultFont("Commonwealth-10");
CEGUI::System::getSingleton().setDefaultMouseCursor("TaharezLook", "MouseArrow");
CEGUI::WindowManager& winMgr = CEGUI::WindowManager::getSingleton();
CEGUI::DefaultWindow* root = (CEGUI::DefaultWindow*)winMgr.createWindow("DefaultWindow", "Root");
CEGUI::System::getSingleton().setGUISheet(root);
CEGUI::FrameWindow* wnd = (CEGUI::FrameWindow*)winMgr.createWindow("TaharezLook/FrameWindow", "Demo Window");
  root->addChildWindow(wnd);
  wnd->setPosition(CEGUI::Point(0.35f, 0.25f));
  wnd->setSize(CEGUI::Size(0.25f, 0.25f));
  wnd->setMaximumSize(CEGUI::Size(1.0f, 1.0f));
  wnd->setMinimumSize(CEGUI::Size(0.1f, 0.1f));
  wnd->setText("Hello World!");

  CEGUI::PushButton* btn = static_cast<CEGUI::PushButton*>(winMgr.createWindow("TaharezLook/Button", "QuitButton"));
    root->addChildWindow(btn);
    btn->setText("Quit!");
    btn->setPosition(CEGUI::Point(0.0f, 0.1f));
    btn->setSize(CEGUI::Size(0.1f, 0.036f));
    btn->setAlwaysOnTop(true);


in this code, i do not specify the looknfeel but a scheme file, and in the scheme file, there is no path that indicates the looknfeel. the scheme file is like this:

Code: Select all

<?xml version="1.0" ?>
<GUIScheme Name="TaharezLookWidgets">
   <WindowSet Filename="CEGUITaharezLook">
      <WindowFactory Name="TaharezLook/AlternateProgressBar" />
      <WindowFactory Name="TaharezLook/Button" />
      <WindowFactory Name="TaharezLook/Checkbox" />
      <WindowFactory Name="TaharezLook/CloseButton" />
      <WindowFactory Name="TaharezLook/Combobox" />
      <WindowFactory Name="TaharezLook/ComboDropList" />
      <WindowFactory Name="TaharezLook/ComboEditbox" />
      <WindowFactory Name="TaharezLook/Editbox" />
      <WindowFactory Name="TaharezLook/FrameWindow" />
      <WindowFactory Name="TaharezLook/LargeVerticalScrollbar" />
      <WindowFactory Name="TaharezLook/LargeVerticalScrollbarThumb" />
      <WindowFactory Name="TaharezLook/Listbox" />
      <WindowFactory Name="TaharezLook/ListHeader" />
      <WindowFactory Name="TaharezLook/ListHeaderSegment" />
      <WindowFactory Name="TaharezLook/HorizontalScrollbar" />
      <WindowFactory Name="TaharezLook/HorizontalScrollbarThumb" />
      <WindowFactory Name="TaharezLook/MultiColumnList" />
      <WindowFactory Name="TaharezLook/MultiLineEditbox" />
      <WindowFactory Name="TaharezLook/ProgressBar" />
      <WindowFactory Name="TaharezLook/RadioButton" />
      <WindowFactory Name="TaharezLook/ScrollablePane" />
      <WindowFactory Name="TaharezLook/Slider" />
      <WindowFactory Name="TaharezLook/SliderThumb" />
      <WindowFactory Name="TaharezLook/Spinner" />
      <WindowFactory Name="TaharezLook/StaticImage" />
      <WindowFactory Name="TaharezLook/StaticText" />
      <WindowFactory Name="TaharezLook/TabButton" />
      <WindowFactory Name="TaharezLook/TabControl" />
      <WindowFactory Name="TaharezLook/TabPane" />
      <WindowFactory Name="TaharezLook/Titlebar" />
                <WindowFactory Name="TaharezLook/Tooltip" />
      <WindowFactory Name="TaharezLook/VerticalScrollbar" />
      <WindowFactory Name="TaharezLook/VerticalScrollbarThumb" />
      <WindowFactory Name="TaharezLook/VUMeter" />
   </WindowSet>
</GUIScheme>


and i delete the looknfeel files in the looknfeel folder, still my program can run perfectly. so why?

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Postby lindquist » Wed May 17, 2006 16:49

That scheme uses the pre-falagard TaharezLook skin.
Take a look at TaharezLookSkin.scheme

User avatar
spannerman
Home away from home
Home away from home
Posts: 330
Joined: Wed Jan 12, 2005 12:06

Postby spannerman » Wed May 17, 2006 20:52

I agree that it is a bit confusing at first, especially if you still have pre-Falagard files floating around in the mix, but once you get the hang of it all you'll find its pretty clever stuff, and quite necessary for the level of customization achievable.

If your still confused by what you need with regard to all the different xml config files, take a look at an existing app that uses Cegui like the Particle Editor. In the \data\CEGUI_datafiles directory its got a scheme, imageset and looknfeel file for both TaharezLook and custom imagery for the editor itself. Looking in them should give a good idea of whats needed and how custom widgets are created.

For more on how it all hangs together, take a look around the Cegui wiki, theres loads of good pointers and tutorials on there.

Hope that helps :)

billconan
Just popping in
Just popping in
Posts: 12
Joined: Wed May 17, 2006 14:11

Postby billconan » Thu May 18, 2006 15:23

thanks guys,
i know there is a looknfeel file, but the application can run perfectly even i delete the looknfeel file and the scheme does not link to the looknfeel file.

i noticed that you've mentioned pre-falagard TaharezLook skin. does "pre-falagard TaharezLook skin" mean that the taharezlook skin is combined into the cegui and if i do not specify the skin the taharezlook will become default skin?

User avatar
spannerman
Home away from home
Home away from home
Posts: 330
Joined: Wed Jan 12, 2005 12:06

Postby spannerman » Thu May 18, 2006 23:54

Im not sure exactly what is happening in your instance, because I cant see the contents of all of your config files, what version of CEGUI you are using etc.

The older version of Cegui (pre-Falagard) used to have a compiled DLL for each type of looknfeel. So Taharezlook had a dll that you would stick with your binaries, and it was most probably in here where the stuff was defined that is now done in the looknfeel file.
The new way of doing things is with the Falagard system, though I think the old way may still be supported for backwards compatibility. It looks to me like you are using the 'old' way, because in your scheme file contents you posted, you have this line:

Code: Select all

<WindowSet Filename="CEGUITaharezLook">


This is telling the system to load the Tahrezlook dll, and not the new Falagard dll. From the wiki page I posted a link to:

A 'Window Set' basically specifies the name of a loadable module (.dll / .so, etc), and a set of widgets contained within that modules that you wish to register with the system."

Anyway, in your bin you should have CEGUIBase.dll and CEGUIFalagardBase.dll. I recommend deleting your CEGUITaharezLook dll's and start fresh with falagard only (need to have it compiled). Using the Falagard system you can completely define the gui's look and feel via these xml config files.

Typically from code you could just load the scheme file, and you could have all the supporting files linked from within there...I find this the easiest and cleanest way of doing it. So in your initialisation code you would have this line:

Code: Select all

SchemeManager::getSingleton().loadScheme("TaharezLook.scheme");


TaharezLook.scheme looks something like this:

Code: Select all

<?xml version="1.0" ?>
   <GUIScheme Name="TaharezLookSkin">
   <Imageset Name="TaharezLook" Filename="../imagesets/TaharezLook.imageset" />
   <LookNFeel Filename="../looknfeel/TaharezLook.looknfeel" />
   <WindowSet Filename="CEGUIFalagardBase" />
   <FalagardMapping WindowType="TaharezLook/AlternateProgressBar" TargetType="Falagard/ProgressBar" LookNFeel="TaharezLook/AltProgressBar" />
   <FalagardMapping WindowType="TaharezLook/Button" TargetType="Falagard/Button" LookNFeel="TaharezLook/Button" />
   <FalagardMapping WindowType="TaharezLook/Checkbox" TargetType="Falagard/Checkbox" LookNFeel="TaharezLook/Checkbox" />
   ... etc. etc.
</GUIScheme>


Most of the lines in the scheme file are setting up a mapping for all the widgets. But notice that the imageset and looknfeel file names are specified in here.

TaharezLook.imageset:

Code: Select all

<?xml version="1.0" ?>
<Imageset Name="TaharezLook" Imagefile="TaharezLook.tga" NativeHorzRes="800" NativeVertRes="600" AutoScaled="true">
   <Image Name="ClientBrush" XPos="2" YPos="2" Width="64" Height="64" />
   <Image Name="WindowLeftEdge" XPos="6" YPos="95" Width="1" Height="22" XOffset="4" />
   <Image Name="WindowRightEdge" XPos="34" YPos="95" Width="1" Height="22" XOffset="-5" />
   <Image Name="WindowTopEdge" XPos="9" YPos="68" Width="23" Height="1" />
   <Image Name="WindowBottomEdge" XPos="9" YPos="143" Width="23" Height="1" />
   <Image Name="WindowTopLeft" XPos="2" YPos="68" Width="5" Height="24" />
   <Image Name="WindowTopRight" XPos="34" YPos="68" Width="5" Height="24" />
   <Image Name="WindowBottomLeft" XPos="2" YPos="120" Width="5" Height="24" />
   <Image Name="WindowBottomRight" XPos="34" YPos="120" Width="5" Height="24" />
   <Image Name="ButtonLeftNormal" XPos="68" YPos="20" Width="12" Height="16" />
   <Image Name="ButtonMiddleNormal" XPos="82" YPos="20" Width="12" Height="16" />
   <Image Name="ButtonRightNormal" XPos="96" YPos="20" Width="12" Height="16" />
   <Image Name="ButtonLeftPushed" XPos="68" YPos="38" Width="12" Height="16" />
   <Image Name="ButtonMiddlePushed" XPos="82" YPos="38" Width="12" Height="16" />
   <Image Name="ButtonRightPushed" XPos="96" YPos="38" Width="12" Height="16" />
   <Image Name="ButtonLeftHighlight" XPos="68" YPos="56" Width="12" Height="16" />
   <Image Name="ButtonMiddleHighlight" XPos="82" YPos="56" Width="12" Height="16" />
   <Image Name="ButtonRightHighlight" XPos="96" YPos="56" Width="12" Height="16" />
   <Image Name="CheckboxNormal" XPos="110" YPos="2" Width="12" Height="12" />
   <Image Name="CheckboxHover" XPos="110" YPos="30" Width="12" Height="12" />
   <Image Name="CheckboxMark" XPos="110" YPos="16" Width="12" Height="12" />
   <Image Name="RadioButtonNormal" XPos="124" YPos="2" Width="12" Height="12" />
   <Image Name="RadioButtonHover" XPos="124" YPos="30" Width="12" Height="12" />
   <Image Name="RadioButtonMark" XPos="124" YPos="16" Width="12" Height="12" />
   ... etc. etc.
</Imageset>


TaharezLook.looknfeel:

Code: Select all

<?xml version="1.0" ?>
<Falagard>
    <!--
    ***************************************************
        TaharezLook/Button
    ***************************************************
    -->
    <WidgetLook name="TaharezLook/Button">
        <PropertyDefinition name="VertLabelFormatting" initialValue="CentreAligned" />
        <PropertyDefinition name="HorzLabelFormatting" initialValue="CentreAligned" />
        <ImagerySection name="label">
            <TextComponent>
                <Area>
                    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
                    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
                    <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
                    <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
                </Area>
                <VertFormatProperty name="VertLabelFormatting" />
                <HorzFormatProperty name="HorzLabelFormatting" />
            </TextComponent>
        </ImagerySection>
   ... etc. etc.          
</Falagard>       


Have a good read of this tutorial page here on the wiki, it is all described in detail.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 4 guests