When creating a new GUI set the base color to white.

This commit is contained in:
dfighter1985 2014-10-13 17:47:42 +02:00
parent b8d16d8b9b
commit 284de64589
5 changed files with 93 additions and 14 deletions

View file

@ -28,6 +28,7 @@
#include "nel/gui/proc.h" #include "nel/gui/proc.h"
#include "nel/gui/widget_manager.h" #include "nel/gui/widget_manager.h"
#include "nel/gui/link_data.h" #include "nel/gui/link_data.h"
#include "nel/gui/variable_data.h"
namespace NLGUI namespace NLGUI
{ {
@ -100,20 +101,6 @@ namespace NLGUI
virtual void setupOptions() = 0; virtual void setupOptions() = 0;
}; };
struct VariableData
{
std::string entry;
std::string type;
std::string value;
uint32 size;
VariableData()
{
size = 0;
}
};
CInterfaceParser(); CInterfaceParser();
virtual ~CInterfaceParser(); virtual ~CInterfaceParser();
@ -386,6 +373,7 @@ namespace NLGUI
void setEditorMode( bool b ){ editorMode = b; } void setEditorMode( bool b ){ editorMode = b; }
void setVariable( const VariableData &v );
bool serializeVariables( xmlNodePtr parentNode ) const; bool serializeVariables( xmlNodePtr parentNode ) const;
bool serializeProcs( xmlNodePtr parentNode ) const; bool serializeProcs( xmlNodePtr parentNode ) const;
bool serializePointerSettings( xmlNodePtr parentNode ) const; bool serializePointerSettings( xmlNodePtr parentNode ) const;

View file

@ -23,6 +23,7 @@
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#include "nel/gui/proc.h" #include "nel/gui/proc.h"
#include "nel/gui/link_data.h" #include "nel/gui/link_data.h"
#include "nel/gui/variable_data.h"
namespace NLGUI namespace NLGUI
{ {
@ -83,6 +84,7 @@ namespace NLGUI
virtual void removeLinkData( uint32 id ) = 0; virtual void removeLinkData( uint32 id ) = 0;
virtual bool getLinkData( uint32 id, SLinkData &linkData ) = 0; virtual bool getLinkData( uint32 id, SLinkData &linkData ) = 0;
virtual void updateLinkData( uint32 id, const SLinkData &linkData ) = 0; virtual void updateLinkData( uint32 id, const SLinkData &linkData ) = 0;
virtual void setVariable( const VariableData &v ) = 0;
virtual bool serializeVariables( xmlNodePtr parentNode ) const = 0; virtual bool serializeVariables( xmlNodePtr parentNode ) const = 0;
virtual bool serializeProcs( xmlNodePtr parentNode ) const = 0; virtual bool serializeProcs( xmlNodePtr parentNode ) const = 0;
virtual bool serializePointerSettings( xmlNodePtr parentNode ) const = 0; virtual bool serializePointerSettings( xmlNodePtr parentNode ) const = 0;

View file

@ -0,0 +1,41 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef VARIABLE_DATA_H
#define VARIABLE_DATA_H
#include "nel/misc/types_nl.h"
namespace NLGUI
{
struct VariableData
{
std::string entry;
std::string type;
std::string value;
uint32 size;
VariableData()
{
size = 0;
}
};
}
#endif

View file

@ -2951,6 +2951,34 @@ namespace NLGUI
itr->second = linkData; itr->second = linkData;
} }
void CInterfaceParser::setVariable( const VariableData &v )
{
CInterfaceProperty prop;
const std::string &type = v.type;
const std::string &value = v.value;
const std::string &entry = v.entry;
if( type == "sint64" )
prop.readSInt64( value.c_str(), entry );
else
if( type == "sint32" )
prop.readSInt32( value.c_str(), entry );
else
if( type == "float" || type == "double" )
prop.readDouble( value.c_str(), entry );
else
if( type == "bool" )
prop.readBool( value.c_str(), entry );
else
if( type == "rgba" )
prop.readRGBA( value.c_str(), entry );
else
if( type == "hotspot" )
prop.readHotSpot( value.c_str(), entry );
variableCache[ entry ] = v;
}
bool CInterfaceParser::serializeVariables( xmlNodePtr parentNode ) const bool CInterfaceParser::serializeVariables( xmlNodePtr parentNode ) const
{ {

View file

@ -3645,6 +3645,26 @@ namespace NLGUI
_Pointer = new CViewPointer( CViewBase::TCtorParam() ); _Pointer = new CViewPointer( CViewBase::TCtorParam() );
IParser *parser = getParser();
// Set base color to white
VariableData v;
v.type = "sint32";
v.value = "255";
v.entry = "UI:SAVE:COLOR:R";
parser->setVariable( v );
v.entry = "UI:SAVE:COLOR:G";
parser->setVariable( v );
v.entry = "UI:SAVE:COLOR:B";
parser->setVariable( v );
v.entry = "UI:SAVE:COLOR:A";
parser->setVariable( v );
return true; return true;
} }