<!-- Wanted to avoid copying .css to each folder, so copied default .css from doxyen in here, kicked out most stuff we don't need for examples and modified some a little bit.
Target was having a single html in each example folder which is created from the main.cpp files and needs no files besides some images below media folder.
<p>This tutorial show how to create a more complex application with the engine. We construct a simple mesh viewer using the user interface API and the scene management of Irrlicht. The tutorial show how to create and use Buttons, Windows, Toolbars, Menus, ComboBoxes, Tabcontrols, Editboxes, Images, MessageBoxes, SkyBoxes, and how to parse XML files with the integrated XML reader of the engine.</p>
<p>We start like in most other tutorials: Include all necessary header files, add a comment to let the engine be linked with the right .lib file in Visual Studio, and declare some global variables. We also add two 'using namespace' statements, so we do not need to write the whole names of all classes. In this tutorial, we use a lot stuff from the gui namespace. </p><divclass="fragment"><divclass="line"><spanclass="preprocessor">#include <irrlicht.h></span></div><divclass="line"><spanclass="preprocessor">#include "driverChoice.h"</span></div><divclass="line"></div><divclass="line"><spanclass="keyword">using namespace </span>irr;</div><divclass="line"><spanclass="keyword">using namespace </span>gui;</div><divclass="line"></div><divclass="line"><spanclass="preprocessor">#ifdef _MSC_VER</span></div><divclass="line"><spanclass="preprocessor">#pragma comment(lib, "Irrlicht.lib")</span></div><divclass="line"><spanclass="preprocessor">#endif</span></div></div><!-- fragment --><p> Some global variables used later on </p><divclass="fragment"><divclass="line">IrrlichtDevice *Device = 0;</div><divclass="line">core::stringc StartUpModelFile;</div><divclass="line">core::stringw MessageText;</div><divclass="line">core::stringw Caption;</div><divclass="line">scene::ISceneNode* Model = 0;</div><divclass="line">scene::ISceneNode* SkyBox = 0;</div><divclass="line"><spanclass="keywordtype">bool</span> Octree=<spanclass="keyword">false</span>;</div><divclass="line"><spanclass="keywordtype">bool</span> UseLight=<spanclass="keyword">false</span>;</div><divclass="line"></div><divclass="line">scene::ICameraSceneNode* Camera[2] = {0, 0};</div><divclass="line"></div><divclass="line"><spanclass="comment">// Values used to identify individual GUI elements</span></div><divclass="line"><spanclass="keyword">enum</span></div><divclass="line">{</div><divclass="line"> GUI_ID_DIALOG_ROOT_WINDOW = 0x10000,</div><divclass="line"></div><divclass="line"> GUI_ID_X_SCALE,</div><divclass="line"> GUI_ID_Y_SCALE,</div><divclass="line"> GUI_ID_Z_SCALE,</div><divclass="line"></div><divclass="line"> GUI_ID_OPEN_MODEL,</div><divclass="line"> GUI_ID_SET_MODEL_ARCHIVE,</div><divclass="line"> GUI_ID_LOAD_AS_OCTREE,</div><divclass="line"></div><divclass="line"> GUI_ID_SKY_BOX_VISIBLE,</div><divclass="line"> GUI_ID_TOGGLE_DEBUG_INFO,</div><divclass="line"></div><divclass="line"> GUI_ID_DEBUG_OFF,</div><divclass="line"> GUI_ID_DEBUG_BOUNDING_BOX,</div><divclass="line"> GUI_ID_DEBUG_NORMALS,</div><divclass="line"> GUI_ID_DEBUG_SKELETON,</div><divclass="line"> GUI_ID_DEBUG_WIRE_OVERLAY,</div><divclass="line"> GUI_ID_DEBUG_HALF_TRANSPARENT,</div><divclass="line"> GUI_ID_DEBUG_BUFFERS_BOUNDING_BOXES,</div><divclass="line"> GUI_ID_DEBUG_ALL,</div><divclass="line"></div><divclass="line"> GUI_ID_MODEL_MATERIAL_SOLID,</div><divclass="line"> GUI_ID_MODEL_MATERIAL_TRANSPARENT,</div><divclass="line"> GUI_ID_MODEL_MATERIAL_REFLECTION,</div><divclass="line"></div><divclass="line"> GUI_ID_CAMERA_MAYA,</div><divclass="line"> GUI_ID_CAMERA_FIRST_PERSON,</div><divclass="line"></div><divclass="line"> GUI_ID_POSITION_TEXT,</div><divclass="line"></div><divclass="line"> GUI_ID_ABOUT,</div><divclass="line"> GUI_ID_QUIT,</div><divclass="line"></div><divclass="line"> GUI_ID_TEXTUREFILTER,</div><divclass="line"> GUI_ID_SKIN_TRANSPARENCY,</div><divclass="line"> GUI_ID_SKIN_ANIMATION_FPS,</div><divclass="line"></div><divclass="line"> GUI_ID_BUTTON_SET_SCALE,</div><divclass="line"> GUI_ID_BUTTON_SCALE_MUL10,</div><divclass="line"> GUI_ID_BUTTON_SCALE_DIV10,</div><divclass="line"> GUI_ID_BUTTON_OPEN_MODEL,</div><divclass="line"> GUI_ID_BUTTON_SHOW_ABOUT,</div><divclass="line"> GUI_ID_BUTTON_SHOW_TOOLBOX,</div><divclass="line"> GUI_ID_BUTTON_SELECT_ARCHIVE,</div><divclass="line"></div><divclass="line"> GUI_ID_ANIMATION_INFO,</div><divclass="line"></div><divclass="line"><spanclass=
</config></pre><p>We need the data stored in there to be written into the global variables StartUpModelFile, MessageText and Caption. This is now done using the Irrlicht Engine integrated XML parser: </p><divclass="fragment"><divclass="line"><spanclass="comment">// read configuration from xml file</span></div><divclass="line"></div><divclass="line">io::IXMLReader* xml = Device->getFileSystem()->createXMLReader( L<spanclass="stringliteral">"config.xml"</span>);</div><divclass="line"></div><divclass="line"><spanclass="keywordflow">while</span>(xml && xml->read())</div><divclass="line">{</div><divclass="line"><spanclass="keywordflow">switch</span>(xml->getNodeType())</div><divclass="line"> {</div><divclass="line"><spanclass="keywordflow">case</span> io::EXN_TEXT:</div><divclass="line"><spanclass="comment">// in this xml file, the only text which occurs is the</span></div><divclass="line"><spanclass="comment">// messageText</span></div><divclass="line"> MessageText = xml->getNodeData();</div><divclass="line"><spanclass="keywordflow">break</span>;</div><divclass="line"><spanclass="keywordflow">case</span> io::EXN_ELEMENT:</div><divclass="line"> {</div><divclass="line"><spanclass="keywordflow">if</span> (core::stringw(<spanclass="stringliteral">"startUpModel"</span>) == xml->getNodeName())</div><divclass="line"> StartUpModelFile = xml->getAttributeValue(L<spanclass="stringliteral">"file"</span>);</div><divclass="line"><spanclass="keywordflow">else</span></div><divclass="line"><spanclass="keywordflow">if</span> (core::stringw(<spanclass="stringliteral">"messageText"</span>) == xml->getNodeName())</div><divclass="line"> Caption = xml->getAttributeValue(L<spanclass="stringliteral">"caption"</span>);</div><divclass="line"> }</div><divclass="line"><spanclass="keywordflow">break</span>;</div><divclass="line"><spanclass="keywordflow">default</span>:</div><divclass="line"><spanclass="keywordflow">break</span>;</div><divclass="line"> }</div><divclass="line">}</div><divclass="line"></div><divclass="line"><spanclass="keywordflow">if</span> (xml)</div><divclass="line"> xml->drop(); <spanclass="comment">// don't forget to delete the xml reader</span></div><divclass="line"></div><divclass="line"><spanclass="keywordflow">if</span> (argc > 1)</div><divclass="line"> StartUpModelFile = argv[1];</div></div><!-- fragment --><p> That wasn't difficult. Now we'll set a nicer font and create the Menu. It is possible to create submenus for every menu item. The call menu->addItem(L"File", -1, true, true); for example adds a new menu Item with the name "File" and the id -1. The following parameter says that the menu item should be enabled, and the last one says, that there should be a submenu. The submenu can now be accessed with menu->getSubMenu(0), because the "File" entry is the menu item with index 0. </p><divclass="fragment"><divclass="line"><spanclass="comment">// set a nicer font</span></div><divclass="line"></div><divclass="line">IGUISkin* skin = env->getSkin();</div><divclass="line">IGUIFont* font = env->getFont(<spanclass="stringliteral">"fonthaettenschweiler.bmp"</span>);</div><divclass="line"><spanclass="keywordflow">if</span> (font)</div><divclass="line"> skin->setFont(font);</div><divclass="line"></div><divclass="line"><spanclass="comment">// create menu</span></div><divclass="line">gui::IGUIContextMenu* menu = env->addMenu();</div><divclass="line">menu->addItem(L<spanclass="stringliteral">"File"</span>, -1, <spanclass="keyword">true</span>, <spanclass="keyword">true</span>);</div><divclass="line">menu->addItem(L<spanclass="stringliteral">"View"</span>, -1, <spanclass="keyword">true</span>, <spanclass="keyword">true</span>);</div><divclass="line">menu