Page 2 of 3

Re: Textarea (Chatbox etc)

Posted: Tue Jan 24, 2012 9:26 am
by Cube_
O_O
This is really nice.....

Re: Textarea (Chatbox etc)

Posted: Sat Jan 28, 2012 12:09 pm
by Ovan
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 ;)

Re: Textarea (Chatbox etc)

Posted: Sat Jan 28, 2012 12:56 pm
by RdR
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 ;)
Using position and dimension is just a choice we made,
but using the AbsoluteRect and setRelativePosition() might be better indeed. (Especially when implementing OnEvent() )
Using a RTT is a good idea!

Re: Textarea (Chatbox etc)

Posted: Sat Jan 28, 2012 1:31 pm
by Ovan
thank, just an idea from my engine concept to optimize general gui componment but nice for other ...

Re: Textarea (Chatbox etc)

Posted: Mon Mar 05, 2012 5:38 pm
by RdR
Updated TextArea with RTT to improve the performance.
It boosted my test project from ~800 to ! 1400 FPS :D

Ovan thanks for the tip btw.

There is still a small bug when using fonts with alpha, but thats an Irrlicht issue. :(
See this topic: http://irrlicht.sourceforge.net/forum/v ... =7&t=45901

If your using an old version of this TextArea, update!

Re: Textarea (Chatbox etc)

Posted: Tue Mar 06, 2012 8:54 pm
by gerdb
looks very nice, thx

Re: Textarea (Chatbox etc)

Posted: Tue Mar 06, 2012 9:27 pm
by pepeshka
Here's wishing this forum had some kind of "thank" or "like" feature ;) cool project RdR!

Re: Textarea (Chatbox etc)

Posted: Tue Mar 06, 2012 9:29 pm
by REDDemon
I tried a workaround for get correct alpha fonts on RTT

http://irrlicht.sourceforge.net/forum/v ... =7&t=45901

This will work only for 1 layer of images. But is better than nothing for now. (so can't be used for the whole GUI). but now you can have fonts also with alpha channel using RTT :)

Re: Textarea (Chatbox etc)

Posted: Wed Mar 14, 2012 9:18 pm
by RdR
Added support for temporary lines.
Temporary lines will be removed automaticly when they are expired.

Code: Select all

 
u32 lifeTime = 5; // Lifetime of the line
Line* line = new Line(lifeTime);
 

Re: TextArea GUI Element [v1.0]

Posted: Fri May 04, 2012 1:49 pm
by RVM
Hello,

I have some error when I compile my project with this code (Irr v1.7.3):

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);
 
Did I miss something ?
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) ===|
Thanks,
RVM

Re: TextArea GUI Element [v1.0]

Posted: Fri May 04, 2012 4:19 pm
by RdR
Do you have Line.h and Line.cpp in your project?
Did you change anything in in the TextArea.h or .cpp ?
Can you build the example in the download? (main.cpp)

Re: TextArea GUI Element [v1.0]

Posted: Fri May 04, 2012 5:06 pm
by RVM
RdR wrote:Do you have Line.h and Line.cpp in your project?
Yes
RdR wrote:Did you change anything in in the TextArea.h or .cpp ?
No
RdR wrote:Can you build the example in the download? (main.cpp)
Yes and it run...
But you must change this line :

Code: Select all

TextArea* chatBox = new TextArea(Environment);
to :

Code: Select all

TextArea* chatBox = new TextArea(env,env->getRootGUIElement());
I think I have some build option that don't pass. I will see that.
Sorry for inconvenience,

RVM

Re: TextArea GUI Element [v1.0]

Posted: Sat Jul 07, 2012 12:37 am
by zerochen
hi,

in TextArea.cpp line 575 you have a memleak.
just delete this line.

Code: Select all

tempLine = new Line();

Re: TextArea GUI Element [v1.0]

Posted: Sat Jul 07, 2012 10:47 am
by RdR
zerochen wrote:hi,

in TextArea.cpp line 575 you have a memleak.
just delete this line.

Code: Select all

tempLine = new Line();
Thanks for reporting!
fixed and reuploaded it

Re: TextArea GUI Element [v1.0]

Posted: Tue Sep 11, 2012 2:35 pm
by Nemain
First of all thanks for this really nice piece of code :D

But i cant figure out why the background looks wrong (see picture)
Used this to fill my textarea

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);
    
Image