27 lines
		
	
	
	
		
			601 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
	
		
			601 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| #include <cstdint>
 | |
| #include <vector>
 | |
| #include <string>
 | |
| #include <SFML/Graphics.hpp>
 | |
| #include <unordered_map>
 | |
| #include <memory>
 | |
| #include <nlohmann/json.hpp>
 | |
| 
 | |
| namespace shaders {
 | |
|   struct Record {
 | |
|     std::string name;
 | |
|     std::string file_name;
 | |
|     std::shared_ptr<sf::Shader> ptr = nullptr;
 | |
|   };
 | |
| 
 | |
|   struct ShaderManager {
 | |
|     std::unordered_map<std::string, Record> shaders;
 | |
|   };
 | |
| 
 | |
|   std::shared_ptr<sf::Shader> get(const std::string& name);
 | |
|   void init();
 | |
|   bool load_shader(std::string& name, nlohmann::json& settings);
 | |
|   bool updated(int my_version);
 | |
|   int reload();
 | |
|   int version();
 | |
| }
 | 
