NasNas
An intuitive and beginner friendly 2D game framework for C++
ShaderHolder.hpp
1 
5 #pragma once
6 
7 #include <SFML/Graphics/Shader.hpp>
8 
9 namespace ns {
10 
11  class ShaderHolder {
12  public:
18  void setShader(sf::Shader* shader);
19 
24  auto getShader() const -> sf::Shader*;
25 
29  void toggleShader();
30 
36  void clearShader();
37 
38  private:
39  sf::Shader* m_shader = nullptr;
40  sf::Shader* m_saved_shared = nullptr;
41  };
42 
43 }
void setShader(sf::Shader *shader)
Set the shader to be applied when rendering.
auto getShader() const -> sf::Shader *
Get the current Shader.
void clearShader()
Remove the shader.
void toggleShader()
Toggle shader.