TextArea GUI Element [v1.0]
-
- Posts: 1010
- Joined: Mon Oct 24, 2011 10:03 pm
- Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d
Re: Textarea (Chatbox etc)
O_O
This is really nice.....
This is really nice.....
"this is not the bottleneck you are looking for"
Re: Textarea (Chatbox etc)
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
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)
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
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)
thank, just an idea from my engine concept to optimize general gui componment but nice for other ...
Re: Textarea (Chatbox etc)
Updated TextArea with RTT to improve the performance.
It boosted my test project from ~800 to ! 1400 FPS
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!
It boosted my test project from ~800 to ! 1400 FPS
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)
looks very nice, thx
Re: Textarea (Chatbox etc)
Here's wishing this forum had some kind of "thank" or "like" feature cool project RdR!
Re: Textarea (Chatbox etc)
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
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
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
Re: Textarea (Chatbox etc)
Added support for temporary lines.
Temporary lines will be removed automaticly when they are expired.
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]
Hello,
I have some error when I compile my project with this code (Irr v1.7.3):
Did I miss something ?
RVM
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);
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) ===|
RVM
//When I wrote this, only God and I understood what I was doing
//Now, God only knows
//Now, God only knows
Re: TextArea GUI Element [v1.0]
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)
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]
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)
But you must change this line :
Code: Select all
TextArea* chatBox = new TextArea(Environment);
Code: Select all
TextArea* chatBox = new TextArea(env,env->getRootGUIElement());
Sorry for inconvenience,
RVM
//When I wrote this, only God and I understood what I was doing
//Now, God only knows
//Now, God only knows
Re: TextArea GUI Element [v1.0]
hi,
in TextArea.cpp line 575 you have a memleak.
just delete this line.
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]
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();
fixed and reuploaded it
Re: TextArea GUI Element [v1.0]
First of all thanks for this really nice piece of code
But i cant figure out why the background looks wrong (see picture)
Used this to fill my textarea
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);