diff --git a/source/lib/ffglquickstart/FFGLParamText.cpp b/source/lib/ffglquickstart/FFGLParamText.cpp index 2b2aa27..eac28a8 100644 --- a/source/lib/ffglquickstart/FFGLParamText.cpp +++ b/source/lib/ffglquickstart/FFGLParamText.cpp @@ -2,11 +2,11 @@ namespace ffglqs { -std::shared_ptr< ParamText > ParamText::create( std::string name ) +std::shared_ptr< ParamText > ParamText::Create( std::string name ) { - return create( std::move( name ), "" ); + return Create( std::move( name ), "" ); } -std::shared_ptr< ParamText > ParamText::create( std::string name, std::string text ) +std::shared_ptr< ParamText > ParamText::Create( std::string name, std::string text ) { return std::make_shared< ParamText >( std::move( name ), text ); } diff --git a/source/lib/ffglquickstart/FFGLParamText.h b/source/lib/ffglquickstart/FFGLParamText.h index 72c6075..622d483 100644 --- a/source/lib/ffglquickstart/FFGLParamText.h +++ b/source/lib/ffglquickstart/FFGLParamText.h @@ -6,8 +6,8 @@ namespace ffglqs class ParamText : public Param { public: - static std::shared_ptr< ParamText > create( std::string name ); - static std::shared_ptr< ParamText > create( std::string name, std::string text ); + static std::shared_ptr< ParamText > Create( std::string name ); + static std::shared_ptr< ParamText > Create( std::string name, std::string text ); ParamText( std::string name ); ParamText( std::string name, std::string text ); diff --git a/source/lib/ffglquickstart/FFGLPlugin.cpp b/source/lib/ffglquickstart/FFGLPlugin.cpp index 68c5cb4..4d57dbc 100644 --- a/source/lib/ffglquickstart/FFGLPlugin.cpp +++ b/source/lib/ffglquickstart/FFGLPlugin.cpp @@ -89,7 +89,7 @@ std::string Plugin::CreateFragmentShader( std::string base ) { fragmentShaderCode += "uniform bool " + params[ i ]->GetName() + ";\n"; } - else if( params[ i ]->GetType() != FF_TYPE_BUFFER ) + else if( params[ i ]->GetType() != FF_TYPE_BUFFER && params[ i ]->GetType() != FF_TYPE_TEXT ) { fragmentShaderCode += "uniform float " + params[ i ]->GetName() + ";\n"; } @@ -157,7 +157,7 @@ void Plugin::SendParams( FFGLShader& shader ) { shader.Set( params[ i ]->GetName().c_str(), (bool)params[ i ]->GetValue() ); } - else if( params[ i ]->GetType() != FF_TYPE_BUFFER ) + else if( params[ i ]->GetType() != FF_TYPE_BUFFER && params[ i ]->GetType() != FF_TYPE_TEXT ) { shader.Set( params[ i ]->GetName().c_str(), params[ i ]->GetValue() ); } @@ -303,6 +303,13 @@ void Plugin::AddParam( std::shared_ptr< ParamFFT > param ) params.push_back( param ); } +void Plugin::AddParam( std::shared_ptr< ParamText > param ) +{ + unsigned int new_index = (unsigned int)params.size(); + SetParamInfo( new_index, param->GetName().c_str(), param->GetType(), param->text.c_str() ); + params.push_back( param ); +} + void Plugin::AddHueColorParam( std::string name ) { AddParam( Param::Create( name, FF_TYPE_HUE, 0. ) ); diff --git a/source/lib/ffglquickstart/FFGLPlugin.h b/source/lib/ffglquickstart/FFGLPlugin.h index d1edfaa..3a67d94 100644 --- a/source/lib/ffglquickstart/FFGLPlugin.h +++ b/source/lib/ffglquickstart/FFGLPlugin.h @@ -164,6 +164,9 @@ class Plugin : public CFFGLPlugin /// This function allows to create a Hue color param, for exemple in Resolume this will display a /// color picker, which is very handy to choose your color. /// \param name The name of the parameter to add + void AddParam( std::shared_ptr< ParamText > param ); + /// This function handles the special case where the parameter is a ParamText + /// \param param The name of the parameter to add void AddHueColorParam( std::string name ); /// This function allows to create a RGB color param, in Resolume it is displayed as three sliders for /// each Red, Green and Blue.