You can directly use the code to create an overlay. It is not displayed on the interface until the overlay is created. Later, you find that you have not set the size correctly... Fainted
There are three controls on overlay. Today, I tried to run the Panel and textarea Based on the online example. The boardpanel will be used later, so I can directly paste the code.
Note: the code in the article can be directly added to the ogre samplebrowser CPP file and changed to run. The brow in samplebrowser CPP can be used. go comments and replace them with some of my earliest code to become code.
Note that you can change the cfg file path to the correct path, and then insert the following code into the middle to run.
Ogre: overlaymanager & om = ogre: overlaymanager: getsingleton ();
Ogre: overlay * OL = om. Create ("test ");
Ogre: overlaycontainer * testpanel = (Ogre: overlaycontainer *) om. createoverlayelement ("Panel", "testpanel ");
Testpanel-> setposition (0, 0 );
Testpanel-> setdimensions (100,100 );
// Testpanel-> setmaterialname ("basewhite ");
// Create a text area
Ogre: textareaoverlayelement * textarea = static_cast <ogre: textareaoverlayelement *> (
Om. createoverlayelement ("textarea", "textareaname "));
Textarea-> setmetricsmode (Ogre: gmm_pixels );
Textarea-> setposition (0, 0 );
Textarea-> setdimensions (40, 40 );
Textarea-> setcaption ("Hello, world! ");
Textarea-> setcharheight (16 );
Textarea-> setfontname ("starwars2 ");//
Textarea-> setcolour (Ogre: colourvalue (0.6, 0.7, 0.8 ));
// Textarea-> setcolourbottom (Ogre: colourvalue (0.3, 0.5, 0.3 ));
// Textarea-> setcolourtop (Ogre: colourvalue (0.5, 0.7, 0.5 ));
// Add the text area to the Panel
Testpanel-> addchild (textarea );
// Create a text area 2
Ogre: textareaoverlayelement * textarea2 = static_cast <ogre: textareaoverlayelement *> (
Om. createoverlayelement ("textarea", "textareaname2 "));
Textarea2-> setmetricsmode (Ogre: gmm_pixels );
Textarea2-> setposition (40, 40 );
Textarea2-> setdimensions (40, 40 );
Textarea2-> setcaption ("Hello, world! ");
Textarea2-> setcharheight (16 );
Textarea2-> setfontname ("starwars ");//
Textarea2-> setcolour (Ogre: colourvalue (0.6, 0.7, 0.8 ));
// Textarea-> setcolourbottom (Ogre: colourvalue (0.3, 0.5, 0.3 ));
// Textarea-> setcolourtop (Ogre: colourvalue (0.5, 0.7, 0.5 ));
Testpanel-> addchild (textarea2 );
Ol-> add2d (testpanel );
Ol-> setzorder (10 );
Ol-> show ();