diff --git a/include/eepp/ui/uicontrol.hpp b/include/eepp/ui/uicontrol.hpp index ba88cf9ce..109330c85 100644 --- a/include/eepp/ui/uicontrol.hpp +++ b/include/eepp/ui/uicontrol.hpp @@ -249,6 +249,10 @@ class EE_API UIControl { ctrl = find( id ); return ctrl; } + + bool isReverseDraw() const; + + void setReverseDraw( bool reverseDraw ); protected: typedef std::map< Uint32, std::map > UIEventsMap; friend class UIManager; diff --git a/include/eepp/ui/uihelper.hpp b/include/eepp/ui/uihelper.hpp index d7364bc1e..815b36468 100644 --- a/include/eepp/ui/uihelper.hpp +++ b/include/eepp/ui/uihelper.hpp @@ -25,6 +25,7 @@ enum UI_CONTROL_FLAGS_VALUES { UI_CTRL_FLAG_SCALED = (1<<16), UI_CTRL_FLAG_OWNED_BY_WINDOW = (1<<17), UI_CTRL_FLAG_DRAWABLE_OWNER = (1<<18), + UI_CTRL_FLAG_REVERSE_DRAW = (1<<19), UI_CTRL_FLAG_FREE_USE = (1<<31) }; diff --git a/include/eepp/ui/uiloader.hpp b/include/eepp/ui/uiloader.hpp index f045f9dbf..2ad06bb20 100644 --- a/include/eepp/ui/uiloader.hpp +++ b/include/eepp/ui/uiloader.hpp @@ -50,6 +50,10 @@ class EE_API UILoader : public UIWidget { UILoader * setAnimationSpeed( const Float& animationSpeed ); virtual void loadFromXmlNode( const pugi::xml_node& node); + + Float getArcStartAngle() const; + + UILoader * setArcStartAngle( const Float& arcStartAngle ); protected: Float mRadius; Float mOutlineThickness; diff --git a/include/eepp/window/window.hpp b/include/eepp/window/window.hpp index 6fe20f2b0..eb1f12ed5 100644 --- a/include/eepp/window/window.hpp +++ b/include/eepp/window/window.hpp @@ -78,10 +78,11 @@ class WindowSettings { class ContextSettings { public: - inline ContextSettings( bool vsync, EEGL_version version = GLv_default, bool doubleBuffering = true, Uint32 depthBufferSize = 24, Uint32 stencilBufferSize = 1 ) : + inline ContextSettings( bool vsync, EEGL_version version = GLv_default, bool doubleBuffering = true, Uint32 depthBufferSize = 24, Uint32 stencilBufferSize = 1, Uint32 multisamples = 0 ) : Version( version ), DepthBufferSize( depthBufferSize ), StencilBufferSize( stencilBufferSize ), + Multisamples( multisamples ), VSync( vsync ), DoubleBuffering( doubleBuffering ) {} @@ -90,6 +91,7 @@ class ContextSettings { Version( GLv_default ), DepthBufferSize( 24 ), StencilBufferSize( 1 ), + Multisamples( 0 ), VSync( false ), DoubleBuffering( true ) {} @@ -97,6 +99,7 @@ class ContextSettings { EEGL_version Version; Uint32 DepthBufferSize; Uint32 StencilBufferSize; + Uint32 Multisamples; bool VSync; bool DoubleBuffering; }; diff --git a/src/eepp/ui/uicontrol.cpp b/src/eepp/ui/uicontrol.cpp index b4b0f9221..47f7039da 100644 --- a/src/eepp/ui/uicontrol.cpp +++ b/src/eepp/ui/uicontrol.cpp @@ -772,14 +772,26 @@ void UIControl::setControlFlags( const Uint32& Flags ) { } void UIControl::drawChilds() { - UIControl * ChildLoop = mChild; + if ( isReverseDraw() ) { + UIControl * ChildLoop = mChildLast; - while ( NULL != ChildLoop ) { - if ( ChildLoop->mVisible ) { - ChildLoop->internalDraw(); + while ( NULL != ChildLoop ) { + if ( ChildLoop->mVisible ) { + ChildLoop->internalDraw(); + } + + ChildLoop = ChildLoop->mPrev; } + } else { + UIControl * ChildLoop = mChild; - ChildLoop = ChildLoop->mNext; + while ( NULL != ChildLoop ) { + if ( ChildLoop->mVisible ) { + ChildLoop->internalDraw(); + } + + ChildLoop = ChildLoop->mNext; + } } } @@ -1604,4 +1616,12 @@ UIControl * UIControl::getWindowContainer() { return NULL; } +bool UIControl::isReverseDraw() const { + return mControlFlags & UI_CTRL_FLAG_REVERSE_DRAW; +} + +void UIControl::setReverseDraw( bool reverseDraw ) { + writeCtrlFlag( UI_CTRL_FLAG_REVERSE_DRAW, reverseDraw ? 1 : 0 ); +} + }} diff --git a/src/eepp/ui/uigridlayout.cpp b/src/eepp/ui/uigridlayout.cpp index 9a7c4128a..eb7080733 100644 --- a/src/eepp/ui/uigridlayout.cpp +++ b/src/eepp/ui/uigridlayout.cpp @@ -124,7 +124,9 @@ void UIGridLayout::onParentSizeChange(const Vector2i & SizeChange) { } void UIGridLayout::pack() { - setInternalPosition( Vector2i( mLayoutMargin.Left, mLayoutMargin.Top ) ); + Sizei oldSize( mSize ); + + //setInternalPosition( Vector2i( mLayoutMargin.Left, mLayoutMargin.Top ) ); if ( getLayoutWidthRules() == MATCH_PARENT ) { setInternalWidth( getParent()->getSize().getWidth() - mLayoutMargin.Left - mLayoutMargin.Right ); @@ -172,6 +174,10 @@ void UIGridLayout::pack() { if ( getLayoutHeightRules() == WRAP_CONTENT ) { setInternalHeight( pos.y + ( usedLastRow ? targetSize.getHeight() : 0 ) ); } + + if ( oldSize != mSize ) { + notifyLayoutAttrChangeParent(); + } } Uint32 UIGridLayout::onMessage(const UIMessage * Msg) { @@ -231,6 +237,8 @@ void UIGridLayout::loadFromXmlNode(const pugi::xml_node & node) { setPadding( Rect( mPadding.Left, PixelDensity::toDpFromStringI( ait->as_string() ), mPadding.Right, mPadding.Bottom ) ); } else if ( "paddingbottom" == name ) { setPadding( Rect( mPadding.Left, mPadding.Top, mPadding.Right, PixelDensity::toDpFromStringI( ait->as_string() ) ) ); + } else if ( "reversedraw" == name ) { + setReverseDraw( ait->as_bool() ); } } } diff --git a/src/eepp/ui/uiloader.cpp b/src/eepp/ui/uiloader.cpp index 83099cb7d..55c144e14 100644 --- a/src/eepp/ui/uiloader.cpp +++ b/src/eepp/ui/uiloader.cpp @@ -154,6 +154,15 @@ UILoader * UILoader::setAnimationSpeed( const Float& animationSpeed ) { return this; } +Float UILoader::getArcStartAngle() const { + return mArcStartAngle; +} + +UILoader * UILoader::setArcStartAngle( const Float& arcStartAngle ) { + mArcStartAngle = arcStartAngle; + return this; +} + void UILoader::loadFromXmlNode(const pugi::xml_node & node) { UIWidget::loadFromXmlNode( node ); @@ -173,8 +182,10 @@ void UILoader::loadFromXmlNode(const pugi::xml_node & node) { setRadius( ait->as_float() ); } else if ( "outlinethickness" == name ) { setOutlineThickness( ait->as_float() ); - } else if ( "animationspeed" ) { + } else if ( "animationspeed" == name ) { setAnimationSpeed( ait->as_float() ); + } else if ( "arcstartangle" == name ) { + setArcStartAngle( ait->as_float() ); } } } diff --git a/src/eepp/ui/uithememanager.cpp b/src/eepp/ui/uithememanager.cpp index 06738adc2..a44bd8bb5 100644 --- a/src/eepp/ui/uithememanager.cpp +++ b/src/eepp/ui/uithememanager.cpp @@ -56,11 +56,13 @@ void UIThemeManager::setTheme( UITheme * Theme ) { void UIThemeManager::setDefaultTheme( UITheme * Theme ) { mThemeDefault = Theme; - UITooltipStyleConfig fontStyleConfig = mThemeDefault->getFontStyleConfig(); + if ( NULL != mThemeDefault ) { + UITooltipStyleConfig fontStyleConfig = mThemeDefault->getFontStyleConfig(); - if ( NULL == fontStyleConfig.getFont() && NULL != mFont ) { - fontStyleConfig.Font = mFont; - mThemeDefault->setFontStyleConfig( fontStyleConfig ); + if ( NULL == fontStyleConfig.getFont() && NULL != mFont ) { + fontStyleConfig.Font = mFont; + mThemeDefault->setFontStyleConfig( fontStyleConfig ); + } } } diff --git a/src/eepp/window/backend/SDL2/windowsdl2.cpp b/src/eepp/window/backend/SDL2/windowsdl2.cpp index 17b2d60b5..1e4512c99 100644 --- a/src/eepp/window/backend/SDL2/windowsdl2.cpp +++ b/src/eepp/window/backend/SDL2/windowsdl2.cpp @@ -146,6 +146,11 @@ bool WindowSDL::create( WindowSettings Settings, ContextSettings Context ) { mTmpFlags |= SDL_WINDOW_FULLSCREEN; } + if ( mWindow.ContextConfig.Multisamples > 0 ) { + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, mWindow.ContextConfig.Multisamples); + } + mSDLWindow = SDL_CreateWindow( mWindow.WindowConfig.Caption.c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, mWindow.WindowConfig.Width, mWindow.WindowConfig.Height, mTmpFlags ); if ( NULL == mSDLWindow ) { diff --git a/src/eepp/window/engine.cpp b/src/eepp/window/engine.cpp index 065b85f41..81e452fa8 100755 --- a/src/eepp/window/engine.cpp +++ b/src/eepp/window/engine.cpp @@ -294,8 +294,9 @@ ContextSettings Engine::createContextSettings( IniFile * ini, std::string iniKey bool doubleBuffering = ini->getValueB( iniKeyName, "DoubleBuffering", true ); int depthBufferSize = ini->getValueI( iniKeyName, "DepthBufferSize", 24 ); int stencilBufferSize = ini->getValueI( iniKeyName, "StencilBufferSize", 1 ); + int multisamples = ini->getValueI( iniKeyName, "Multisamples", 0 ); - return ContextSettings( VSync, GLVer, doubleBuffering, depthBufferSize, stencilBufferSize ); + return ContextSettings( VSync, GLVer, doubleBuffering, depthBufferSize, stencilBufferSize, multisamples ); } ContextSettings Engine::createContextSettings( std::string iniPath, std::string iniKeyName ) {