Re: Textarea (Chatbox etc)
Posted: Tue Jan 24, 2012 9:26 am
O_O
This is really nice.....
This is really nice.....
Official forum of the Irrlicht Engine
https://irrlicht.sourceforge.io/forum/
Using position and dimension is just a choice we made,Ovan wrote:first why separate position and dimension ? core::recti can be use for it (but you can use protected variable from IGUIElement ex: AbsoluteRect)
second can you think rtt are most optimized ?
-create an rtt from size and ECF_A8R8G8B8
-set an boolean to true on calculateVisibleLine
-if this boolen is true update rtt and set it to false
-render rtt texture to position...
third i think irr::core::list are most optimized between array
juste think
Code: Select all
u32 lifeTime = 5; // Lifetime of the line
Line* line = new Line(lifeTime);
Code: Select all
Text_Zone = new TextArea(GuiEnv,GuiEnv->getRootGUIElement());
Text_Zone->setDimension(irr::core::rect<irr::s32>(5,deskres.Height-65, 105,deskres.Height));
Text_Zone->setMaxLines(6);
Text_Zone->setAlignment(TextArea::LEFT);
Thanks,obj\Release\Client\GUI\TextArea.o||In function `ZN8TextArea11updateLinesEv':|
GUI\TextArea.cpp|428|undefined reference to `Line::isTemporary()'|
GUI\TextArea.cpp|428|undefined reference to `Line::isExpired()'|
GUI\TextArea.o||In function `ZN8TextArea13createBatchesEv':|
GUI\TextArea.cpp|630|undefined reference to `Line::getFont() const'|
GUI\TextArea.cpp|631|undefined reference to `Line::getFont() const'|
GUI\TextArea.cpp|637|undefined reference to `Line::getStrings() const'|
GUI\TextArea.cpp|638|undefined reference to `Line::getColors() const'|
GUI\TextArea.cpp|639|undefined reference to `Line::getImages() const'|
GUI\TextArea.o||In function `ZN8TextArea18updateVisibleLinesEb':|
\TextArea.cpp|468|undefined reference to `Line::isTemporary()'|
GUI\TextArea.cpp|468|undefined reference to `Line::isExpired()'|
GUI\TextArea.cpp|486|undefined reference to `Line::Line(unsigned int)'|
GUI\TextArea.cpp|489|undefined reference to `Line::getFont() const'|
GUI\TextArea.cpp|490|undefined reference to `Line::getFont() const'|
GUI\TextArea.cpp|491|undefined reference to `Line::setFont(irr::gui::IGUIFont*)'|
GUI\TextArea.cpp|497|undefined reference to `Line::getStrings() const'|
\GUI\TextArea.cpp|498|undefined reference to `Line::getColors() const'|
GUI\TextArea.cpp|499|undefined reference to `Line::getImages() const'|
GUI\TextArea.cpp|550|undefined reference to `Line::addImage(irr::video::ITexture*)'|
Client\GUI\TextArea.cpp|539|undefined reference to `Line::Line(unsigned int)'|
Client\GUI\TextArea.cpp|540|undefined reference to `Line::getFont() const'|
GUI\TextArea.cpp|540|undefined reference to `Line::setFont(irr::gui::IGUIFont*)'|
GUI\TextArea.cpp|555|undefined reference to `Line::addString(irr::core::string<wchar_t, irr::core::irrAllocator<wchar_t> >, irr::video::SColor)'|
GUI\TextArea.cpp|575|undefined reference to `Line::Line(unsigned int)'|
TextArea.cpp|568|undefined reference to `Line::setStrings(std::vector<irr::core::string<wchar_t, irr::core::irrAllocator<wchar_t> >, std::allocator<irr::core::string<wchar_t, irr::core::irrAllocator<wchar_t> > > >)'|
GUI\TextArea.cpp|569|undefined reference to `Line::setColors(std::vector<irr::video::SColor, std::allocator<irr::video::SColor> >)'|
GUI\TextArea.cpp|570|undefined reference to `Line::setImages(std::vector<irr::video::ITexture*, std::allocator<irr::video::ITexture*> >)'|
||=== Build finished: 25 errors, 0 warnings (0 minutes, 3 seconds) ===|
YesRdR wrote:Do you have Line.h and Line.cpp in your project?
NoRdR wrote:Did you change anything in in the TextArea.h or .cpp ?
Yes and it run...RdR wrote:Can you build the example in the download? (main.cpp)
Code: Select all
TextArea* chatBox = new TextArea(Environment);
Code: Select all
TextArea* chatBox = new TextArea(env,env->getRootGUIElement());
Code: Select all
tempLine = new Line();
Thanks for reporting!zerochen wrote:hi,
in TextArea.cpp line 575 you have a memleak.
just delete this line.
Code: Select all
tempLine = new Line();
Code: Select all
std::vector<Line*> lines;
if((*currentObject))
{
Line* line = new Line();
line->addString((*currentObject)->getName().c_str(), video::SColor(255, 255, 255, 255));
lines.push_back(line);
line = new Line();
line->addString(L"", irr::video::SColor(255, 255, 255, 255));
lines.push_back(line);
line = new Line();
line->addString((*currentObject)->getDescription().c_str(), video::SColor(255, 255, 255, 255));
lines.push_back(line);
line = new Line();
line->addString(L"", irr::video::SColor(255, 255, 255, 255));
lines.push_back(line);
line = new Line();
line->addString(doubleToString((*currentObject)->getPrice()).c_str(), video::SColor(255, 255, 255, 255));
lines.push_back(line);
objectPropBox->setLines(lines);
}
Code: Select all
// Create a new textarea
const core::dimension2d<u32> screenSize = device->getVideoDriver()->getScreenSize();
objectPropBox = new TextArea(GUIEnvironment, GUIEnvironment->getRootGUIElement(), GUI_ID_TEXT_AREA_OBJECT_PROP);
objectPropBox->setMaxLines(8);
objectPropBox->setAlignment(TextArea::LEFT);
objectPropBox->setBackgroundColor(video::SColor(175, 0, 0, 0));
objectPropBox->setPosition(irr::core::vector2di(screenSize.Width*0.7f, screenSize.Height*0.8f));
objectPropBox->setDimension(400, 150);