MCPcopy Create free account
hub / github.com/SFML/SFML / update

Method update

examples/shader/Shader.cpp:225–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

223{
224public:
225 void update(float /* time */, float x, float y) override
226 {
227 // Reset our transformation matrix
228 m_transform = sf::Transform::Identity;
229
230 // Move to the center of the window
231 m_transform.translate({400.f, 300.f});
232
233 // Rotate everything based on cursor position
234 m_transform.rotate(sf::degrees(x * 360.f));
235
236 // Adjust billboard size to scale between 25 and 75
237 const float size = 25 + std::abs(y) * 50;
238
239 // Update the shader parameter
240 m_shader.setUniform("size", sf::Vector2f{size, size});
241 }
242
243 void draw(sf::RenderTarget& target, sf::RenderStates states) const override
244 {

Callers

nothing calls this directly

Calls 2

setUniformMethod · 0.80
rotateMethod · 0.45

Tested by

no test coverage detected