mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 01:30:05 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			57 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			57 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #include <scwx/qt/gl/gl_context.hpp>
 | |
| #include <scwx/qt/util/font.hpp>
 | |
| 
 | |
| #include <memory>
 | |
| 
 | |
| #include <boost/gil.hpp>
 | |
| #include <glm/glm.hpp>
 | |
| 
 | |
| namespace scwx
 | |
| {
 | |
| namespace qt
 | |
| {
 | |
| namespace gl
 | |
| {
 | |
| 
 | |
| enum class TextAlign
 | |
| {
 | |
|    Left,
 | |
|    Center,
 | |
|    Right
 | |
| };
 | |
| 
 | |
| class TextShaderImpl;
 | |
| 
 | |
| class TextShader
 | |
| {
 | |
| public:
 | |
|    explicit TextShader(std::shared_ptr<GlContext> context);
 | |
|    ~TextShader();
 | |
| 
 | |
|    TextShader(const TextShader&)            = delete;
 | |
|    TextShader& operator=(const TextShader&) = delete;
 | |
| 
 | |
|    TextShader(TextShader&&) noexcept;
 | |
|    TextShader& operator=(TextShader&&) noexcept;
 | |
| 
 | |
|    bool Initialize();
 | |
|    void RenderText(const std::string&               text,
 | |
|                    float                            x,
 | |
|                    float                            y,
 | |
|                    float                            scale,
 | |
|                    const glm::mat4&                 projection,
 | |
|                    const boost::gil::rgba8_pixel_t& color,
 | |
|                    std::shared_ptr<util::Font>      font,
 | |
|                    GLuint                           textureId,
 | |
|                    TextAlign                        align = TextAlign::Left);
 | |
|    void SetProjection(const glm::mat4& projection);
 | |
| 
 | |
| private:
 | |
|    std::unique_ptr<TextShaderImpl> p;
 | |
| };
 | |
| 
 | |
| } // namespace gl
 | |
| } // namespace qt
 | |
| } // namespace scwx
 | 
