Skip to content

Commit

Permalink
Made SFGUI use the new SFML function (setFillColor, getFillColor, set…
Browse files Browse the repository at this point in the history
…Uniform) so the deprecation warnings go away.
  • Loading branch information
eXpl0it3r authored and TankOs committed Jan 13, 2017
1 parent 9a9bcb9 commit add850e
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion examples/CustomWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class MyCustomWidget : public sfg::Widget {
sf::Text text( GetLabel(), *font, font_size );

// Set the text color to white.
text.setColor( sf::Color::White );
text.setFillColor( sf::Color::White );

// Randomize the applied offset a bit
auto x_offset = ( GetState() == State::ACTIVE ) ? static_cast<float>( m_distribution( m_generator ) ) : 0.f;
Expand Down
2 changes: 1 addition & 1 deletion src/SFGUI/Canvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ void Canvas::SetupShader() {
m_vertex_location = GetAttributeLocation( *m_shader, "vertex" );
m_texture_coordinate_location = GetAttributeLocation( *m_shader, "texture_coordinate" );

m_shader->setParameter( "texture0", m_render_texture->getTexture() );
m_shader->setUniform( "texture0", m_render_texture->getTexture() );
}

}
2 changes: 1 addition & 1 deletion src/SFGUI/Engines/BREW/Button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ std::unique_ptr<RenderQueue> BREW::CreateButtonDrawable( std::shared_ptr<const B
);
}

text.setColor( color );
text.setFillColor( color );
queue->Add( Renderer::Get().CreateText( text ) );
}

Expand Down
2 changes: 1 addition & 1 deletion src/SFGUI/Engines/BREW/CheckButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ std::unique_ptr<RenderQueue> BREW::CreateCheckButtonDrawable( std::shared_ptr<co
box_size + spacing,
check->GetAllocation().height / 2.f - metrics.y / 2.f
);
text.setColor( color );
text.setFillColor( color );
queue->Add( Renderer::Get().CreateText( text ) );
}

Expand Down
4 changes: 2 additions & 2 deletions src/SFGUI/Engines/BREW/ComboBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ std::unique_ptr<RenderQueue> BREW::CreateComboBoxDrawable( std::shared_ptr<const

sf::Text text( combo_box->GetItem( item_index ), *font, font_size );
text.setPosition( item_position.x + padding, item_position.y + padding );
text.setColor( color );
text.setFillColor( color );
queue->Add( Renderer::Get().CreateText( text ) );

item_position.y += item_size.y;
Expand All @@ -100,7 +100,7 @@ std::unique_ptr<RenderQueue> BREW::CreateComboBoxDrawable( std::shared_ptr<const
border_width + padding,
combo_box->GetAllocation().height / 2.f - line_height / 2.f
);
text.setColor( color );
text.setFillColor( color );
queue->Add( Renderer::Get().CreateText( text ) );
}

Expand Down
2 changes: 1 addition & 1 deletion src/SFGUI/Engines/BREW/Entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ std::unique_ptr<RenderQueue> BREW::CreateEntryDrawable( std::shared_ptr<const En

auto line_height = GetFontLineHeight( *font, font_size );
sf::Text vis_label( entry->GetVisibleText(), *font, font_size );
vis_label.setColor( text_color );
vis_label.setFillColor( text_color );
vis_label.setPosition( text_padding, entry->GetAllocation().height / 2.f - line_height / 2.f );

queue->Add( Renderer::Get().CreateText( vis_label ) );
Expand Down
2 changes: 1 addition & 1 deletion src/SFGUI/Engines/BREW/Frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ std::unique_ptr<RenderQueue> BREW::CreateFrameDrawable( std::shared_ptr<const Fr

sf::Text text( frame->GetLabel(), *font, font_size );
text.setPosition( label_start_x + label_padding, border_width / 2.f );
text.setColor( color );
text.setFillColor( color );
queue->Add( Renderer::Get().CreateText( text ) );
}

Expand Down
2 changes: 1 addition & 1 deletion src/SFGUI/Engines/BREW/Label.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ std::unique_ptr<RenderQueue> BREW::CreateLabelDrawable( std::shared_ptr<const La
std::unique_ptr<RenderQueue> queue( new RenderQueue );

sf::Text vis_label( label->GetWrappedText(), *font, font_size );
vis_label.setColor( font_color );
vis_label.setFillColor( font_color );

if( !label->GetLineWrap() ) {
// Calculate alignment when word wrap is disabled.
Expand Down
2 changes: 1 addition & 1 deletion src/SFGUI/Engines/BREW/SpinButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ std::unique_ptr<RenderQueue> BREW::CreateSpinButtonDrawable( std::shared_ptr<con

auto line_height = GetFontLineHeight( *font, font_size );
sf::Text vis_label( spinbutton->GetVisibleText(), *font, font_size );
vis_label.setColor( text_color );
vis_label.setFillColor( text_color );
vis_label.setPosition( text_padding, spinbutton->GetAllocation().height / 2.f - line_height / 2.f );

queue->Add( Renderer::Get().CreateText( vis_label ) );
Expand Down
2 changes: 1 addition & 1 deletion src/SFGUI/Engines/BREW/ToggleButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ std::unique_ptr<RenderQueue> BREW::CreateToggleButtonDrawable( std::shared_ptr<c
button->GetAllocation().height / 2.f - metrics.y / 2.f + offset
);

text.setColor( color );
text.setFillColor( color );
queue->Add( Renderer::Get().CreateText( text ) );
}

Expand Down
2 changes: 1 addition & 1 deletion src/SFGUI/Engines/BREW/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ std::unique_ptr<RenderQueue> BREW::CreateWindowDrawable( std::shared_ptr<const W
);

title_text.setPosition( title_position );
title_text.setColor( title_text_color );
title_text.setFillColor( title_text_color );

queue->Add( Renderer::Get().CreateText( title_text ) );
}
Expand Down
2 changes: 1 addition & 1 deletion src/SFGUI/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ RendererViewport::Ptr Renderer::CreateViewport() {
Primitive::Ptr Renderer::CreateText( const sf::Text& text ) {
const auto& font = *text.getFont();
auto character_size = text.getCharacterSize();
auto color = text.getColor();
auto color = text.getFillColor();

auto atlas_offset = LoadFont( font, character_size );

Expand Down
8 changes: 4 additions & 4 deletions src/SFGUI/Renderers/NonLegacyRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ void NonLegacyRenderer::DisplayImpl() const {
if( m_window_size.x && m_window_size.y ) {
const_cast<NonLegacyRenderer*>( this )->Invalidate( INVALIDATE_VERTEX | INVALIDATE_TEXTURE );

m_shader.setParameter( "viewport_parameters", 2.f / static_cast<float>( m_window_size.x ), -2.f / static_cast<float>( m_window_size.y ) );
m_shader.setUniform( "viewport_parameters", sf::Glsl::Vec2( 2.f / static_cast<float>( m_window_size.x ), -2.f / static_cast<float>( m_window_size.y ) ) );

const_cast<NonLegacyRenderer*>( this )->SetupFBO( m_window_size.x, m_window_size.y );
}
Expand Down Expand Up @@ -354,7 +354,7 @@ void NonLegacyRenderer::DisplayImpl() const {
CheckGLError( glClear( GL_COLOR_BUFFER_BIT ) );
}

m_shader.setParameter( "texture0", *( m_texture_atlas[0] ) );
m_shader.setUniform( "texture0", *( m_texture_atlas[0] ) );
sf::Shader::bind( &m_shader );

CheckGLError( GLEXT_glBindVertexArray( m_vao ) );
Expand Down Expand Up @@ -401,7 +401,7 @@ void NonLegacyRenderer::DisplayImpl() const {
if( batch.atlas_page != current_atlas_page ) {
current_atlas_page = batch.atlas_page;

m_shader.setParameter( "texture0", *( m_texture_atlas[static_cast<std::size_t>( current_atlas_page )] ) );
m_shader.setUniform( "texture0", *( m_texture_atlas[static_cast<std::size_t>( current_atlas_page )] ) );
}

CheckGLError( glDrawRangeElements(
Expand Down Expand Up @@ -772,7 +772,7 @@ void NonLegacyRenderer::SetupFBO( int width, int height ) {
m_fbo_vertex_location = GetAttributeLocation( m_fbo_shader, "vertex" );
m_fbo_texture_coordinate_location = GetAttributeLocation( m_fbo_shader, "texture_coordinate" );

m_fbo_shader.setParameter( "texture0", m_frame_buffer_texture );
m_fbo_shader.setUniform( "texture0", m_frame_buffer_texture );

CheckGLError( GLEXT_glGenBuffers( 1, &m_fbo_vbo ) );
CheckGLError( GLEXT_glBindBuffer( GLEXT_GL_ARRAY_BUFFER, m_fbo_vbo ) );
Expand Down

0 comments on commit add850e

Please sign in to comment.