Created
September 10, 2019 08:11
-
-
Save deephack1982/07b5a6c4b234e8f24b34fa03d39b782a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CGuiWidget | |
{ | |
... | |
public: | |
void Render(); | |
virtual void RenderInternal(); | |
CRect<uint64> ConvertToBounds( CRect<uint64> Frame ) | |
{ ... } | |
CRect<uint64> GetBounds() const | |
{ return ConvertToBounds(m_Frame); } | |
bool ClipsToBounds() const | |
{ return m_ClipsToBounds; } | |
private: | |
CGuiWidget* m_Parent; | |
std::list<CGuiWidget *> m_Children; | |
bool m_isHidden = false; | |
CRect<uint64> m_Frame; // Local coordinates in Parent | |
bool m_ClipsToBounds = true; | |
}; | |
void Render() | |
{ | |
CRect<uint64> Bounds = this->GetBounds(Frame); | |
if ( m_Parent && m_Parent->ClipsToBounds() && | |
m_Parent->GetBounds().Intersects( Bounds ) == false ) | |
{ | |
return; | |
} | |
if ( m_isHidden ) | |
{ | |
return; | |
} | |
RenderInternal(); | |
for (auto const& child : m_Children) | |
{ | |
child->Render(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment