added input system
This commit is contained in:
50
TSE_Core/src/elements/ShaderRegistry.hpp
Normal file
50
TSE_Core/src/elements/ShaderRegistry.hpp
Normal file
@@ -0,0 +1,50 @@
|
||||
#pragma once
|
||||
|
||||
#include <unordered_map>
|
||||
#include "interfaces/IShader.hpp"
|
||||
#include "Types.hpp"
|
||||
|
||||
namespace TSE
|
||||
{
|
||||
class ShaderRegistry
|
||||
{
|
||||
private:
|
||||
inline static std::unordered_map<string, IShader*> registeredShaders = {};
|
||||
|
||||
public:
|
||||
inline static void SetShader(string& name, IShader* shader)
|
||||
{
|
||||
registeredShaders[name] = shader;
|
||||
};
|
||||
inline static IShader* GetShader(string& name)
|
||||
{
|
||||
return registeredShaders.at(name);
|
||||
};
|
||||
inline static void RemoveShader(string& name)
|
||||
{
|
||||
registeredShaders.erase(name);
|
||||
};
|
||||
inline static int GetShaderCount()
|
||||
{
|
||||
return registeredShaders.size();
|
||||
}
|
||||
inline static IShader* GetShaderAt(int i)
|
||||
{
|
||||
auto it = registeredShaders.begin();
|
||||
for (int j = 0; j < i; j++)
|
||||
{
|
||||
it++;
|
||||
}
|
||||
return it->second;
|
||||
}
|
||||
inline static string GetNameAt(int i)
|
||||
{
|
||||
auto it = registeredShaders.begin();
|
||||
for (int j = 0; j < i; j++)
|
||||
{
|
||||
it++;
|
||||
}
|
||||
return it->first;
|
||||
}
|
||||
};
|
||||
} // namespace TSE
|
||||
Reference in New Issue
Block a user