mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-10-25 23:57:53 +03:00
Allow reverse draw on UIGridLayout ( and any UIControl ).
Allow set ArcStartAngle on UILoader. Allow configure Multisample for the OpenGL context. Fixed some minor bugs. --HG-- branch : dev
This commit is contained in:
@@ -249,6 +249,10 @@ class EE_API UIControl {
|
||||
ctrl = find<T>( id );
|
||||
return ctrl;
|
||||
}
|
||||
|
||||
bool isReverseDraw() const;
|
||||
|
||||
void setReverseDraw( bool reverseDraw );
|
||||
protected:
|
||||
typedef std::map< Uint32, std::map<Uint32, UIEventCallback> > UIEventsMap;
|
||||
friend class UIManager;
|
||||
|
||||
@@ -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)
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
@@ -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() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 ) {
|
||||
|
||||
@@ -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 ) {
|
||||
|
||||
Reference in New Issue
Block a user