Commit 718c2369 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[CHANGE] - WMHud now uses new properties

parent e5df103a
......@@ -61,7 +61,11 @@ void WMHud::connectors()
void WMHud::properties()
{
( m_properties->addBool( "active", true, true ) )->connect( boost::bind( &WMHud::slotPropertyChanged, this, _1 ) );
// m_active get initialized in WModule and is available for all modules.
// simply register our activate function
// It should get triggered whever m_active changes
m_active->getCondition()->subscribeSignal( boost::bind( &WMHud::activate, this ) );
}
void WMHud::moduleMain()
......@@ -177,7 +181,7 @@ void WMHud::init()
m_rootNode->setUserData( this );
m_rootNode->setUpdateCallback( new HUDNodeCallback );
if ( m_properties->getValue<bool>( "active" ) )
if ( m_active->get() )
{
m_rootNode->setNodeMask( 0xFFFFFFFF );
}
......@@ -212,17 +216,15 @@ void WMHud::update()
lock.unlock();
}
void WMHud::slotPropertyChanged( std::string propertyName )
void WMHud::activate()
{
if ( propertyName == "active" )
if ( m_active->get() )
{
if ( m_properties->getValue<bool>( "active" ) )
{
m_rootNode->setNodeMask( 0xFFFFFFFF );
}
else
{
m_rootNode->setNodeMask( 0x0 );
}
m_rootNode->setNodeMask( 0xFFFFFFFF );
}
else
{
m_rootNode->setNodeMask( 0x0 );
}
}
......@@ -135,11 +135,10 @@ private:
void update();
/**
* Gets signaled from the properties object when something was changed
*
* \param propertyName the name of the property that has changed
* Gets signaled from the properties object when something was changed. Now, only m_active is used. This method therefore simply
* activates/deactivates the HUD.
*/
void slotPropertyChanged( std::string propertyName );
void activate();
/**
* Node callback to handle updates properly
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment