Faster scroll_container

master
Jean-Patrick Guerrero 2021-02-26 21:37:58 +01:00 committed by MoNTE48
parent b5672f20f6
commit 27c0663894
3 changed files with 20 additions and 2 deletions

View File

@ -3465,9 +3465,13 @@ void GUIFormSpecMenu::drawMenu()
/* /*
Call base class Call base class
(This is where all the drawing happens.)
*/ */
gui::IGUIElement::draw(); core::list<IGUIElement*>::Iterator it = Children.begin();
for (; it != Children.end(); ++it)
if ((*it)->isNotClipped() ||
AbsoluteClippingRect.isRectCollided(
(*it)->getAbsolutePosition()))
(*it)->draw();
for (gui::IGUIElement *e : m_clickthrough_elements) for (gui::IGUIElement *e : m_clickthrough_elements)
e->setVisible(false); e->setVisible(false);

View File

@ -56,6 +56,18 @@ bool GUIScrollContainer::OnEvent(const SEvent &event)
return IGUIElement::OnEvent(event); return IGUIElement::OnEvent(event);
} }
void GUIScrollContainer::draw()
{
if (isVisible()) {
core::list<IGUIElement *>::Iterator it = Children.begin();
for (; it != Children.end(); ++it)
if ((*it)->isNotClipped() ||
AbsoluteClippingRect.isRectCollided(
(*it)->getAbsolutePosition()))
(*it)->draw();
}
}
void GUIScrollContainer::updateScrolling() void GUIScrollContainer::updateScrolling()
{ {
s32 pos = m_scrollbar->getPos(); s32 pos = m_scrollbar->getPos();

View File

@ -32,6 +32,8 @@ public:
virtual bool OnEvent(const SEvent &event) override; virtual bool OnEvent(const SEvent &event) override;
virtual void draw() override;
inline void onScrollEvent(gui::IGUIElement *caller) inline void onScrollEvent(gui::IGUIElement *caller)
{ {
if (caller == m_scrollbar) if (caller == m_scrollbar)