50 lines
		
	
	
	
		
			799 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			50 lines
		
	
	
	
		
			799 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| namespace lt {
 | |
| 
 | |
| class SharedContext;
 | |
| class WindowResizedEvent;
 | |
| 
 | |
| enum class GraphicsAPI
 | |
| {
 | |
| 	Default = 0,
 | |
| 	OpenGL,
 | |
| 	DirectX,
 | |
| 	Vulkan,
 | |
| 	Metal
 | |
| };
 | |
| 
 | |
| class GraphicsContext
 | |
| {
 | |
| public:
 | |
| 	static auto create(GraphicsAPI api) -> Scope<GraphicsContext>;
 | |
| 	GraphicsContext(const GraphicsContext &) = delete;
 | |
| 
 | |
| 	GraphicsContext &operator=(const GraphicsContext &) = delete;
 | |
| 
 | |
| 	virtual ~GraphicsContext();
 | |
| 
 | |
| 	virtual void log_debug_data() = 0;
 | |
| 
 | |
| 	static GraphicsAPI get_graphics_api()
 | |
| 	{
 | |
| 		return s_context->m_graphics_api;
 | |
| 	}
 | |
| 
 | |
| 	static Ref<SharedContext> get_shared_context()
 | |
| 	{
 | |
| 		return s_context->m_shared_context;
 | |
| 	}
 | |
| 
 | |
| protected:
 | |
| 	GraphicsContext() = default;
 | |
| 
 | |
| 	GraphicsAPI m_graphics_api;
 | |
| 
 | |
| 	Ref<SharedContext> m_shared_context = nullptr;
 | |
| 
 | |
| private:
 | |
| 	static GraphicsContext *s_context;
 | |
| };
 | |
| 
 | |
| } // namespace lt
 |