MCPcopy Create free account
hub / github.com/TankOs/SFGUI / Run

Method Run

examples/Test.cpp:150–610  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148}
149
150void SampleApp::Run() {
151 //m_window.SetFramerateLimit( 60 );
152 //m_window.EnableVerticalSync( true );
153 (void)m_window.setActive( true );
154
155 std::string renderer_string;
156
157 // Tune Renderer
158 if( m_sfgui.GetRenderer().GetName() == "Non-Legacy Renderer" ) {
159 static_cast<sfg::NonLegacyRenderer*>( &m_sfgui.GetRenderer() )->TuneUseFBO( true );
160 static_cast<sfg::NonLegacyRenderer*>( &m_sfgui.GetRenderer() )->TuneCull( true );
161
162 renderer_string = "NLR";
163 }
164 if( m_sfgui.GetRenderer().GetName() == "Vertex Buffer Renderer" ) {
165 static_cast<sfg::VertexBufferRenderer*>( &m_sfgui.GetRenderer() )->TuneUseFBO( true );
166 static_cast<sfg::VertexBufferRenderer*>( &m_sfgui.GetRenderer() )->TuneAlphaThreshold( .2f );
167 static_cast<sfg::VertexBufferRenderer*>( &m_sfgui.GetRenderer() )->TuneCull( true );
168
169 renderer_string = "VBR";
170 }
171 else if( m_sfgui.GetRenderer().GetName() == "Vertex Array Renderer" ) {
172 static_cast<sfg::VertexArrayRenderer*>( &m_sfgui.GetRenderer() )->TuneAlphaThreshold( .2f );
173 static_cast<sfg::VertexArrayRenderer*>( &m_sfgui.GetRenderer() )->TuneCull( true );
174
175 renderer_string = "VAR";
176 }
177
178 // Play around with resource manager.
179 std::shared_ptr<sf::Font> my_font = std::make_shared<sf::Font>( "data/linden_hill.otf" );
180 m_desktop.GetEngine().GetResourceManager().AddFont( "custom_font", my_font );
181
182 // Set properties.
183 // Multiple properties can be set at once to save calls.
184
185 // m_desktop.SetProperty( "Button#close:Normal", "Color", sf::Color::Yellow );
186 // #close is sufficient since there is only 1 widget with this id
187 // m_desktop.SetProperty( "#close", "FontName", "data/linden_hill.otf" );
188 // m_desktop.SetProperty( "#close", "FontSize", 15.f );
189
190 // We will batch the above properties into this call.
191 m_desktop.SetProperties(
192 "Window#second_window > Box > Label {"
193 " FontName: custom_font;"
194 " FontSize: 18;"
195 "}"
196 "Button#close:Normal {"
197 " Color: #FFFF00FF;"
198 "}"
199 "#close {"
200 " FontName: data/linden_hill.otf;"
201 " FontSize: 15;"
202 "}"
203 );
204
205 // Create widgets.
206 m_wndmain = sfg::Window::Create( sfg::Window::Style::TITLEBAR | sfg::Window::Style::BACKGROUND | sfg::Window::Style::RESIZE | sfg::Window::Style::CLOSE );
207 m_wndmain->SetTitle( L"Example application" );

Callers 1

mainFunction · 0.80

Calls 15

beginFunction · 0.85
endFunction · 0.85
AddFontMethod · 0.80
SetTitleMethod · 0.80
SetIdMethod · 0.80
SetRequisitionMethod · 0.80
AppendTextMethod · 0.80
HideTextMethod · 0.80
SetSpacingMethod · 0.80
PackMethod · 0.80
SetMaximumLengthMethod · 0.80
AttachMethod · 0.80

Tested by

no test coverage detected