/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* Graphics.h :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/04/02 14:49:49 by maldavid #+# #+# */ /* Updated: 2024/03/27 21:16:11 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef __MLX_GRAPHICS__ #define __MLX_GRAPHICS__ #include #include #include #include #include #include #include #include namespace mlx { class GraphicsSupport : public NonCopyable { public: GraphicsSupport(std::size_t w, std::size_t h, NonOwningPtr render_target, int id); GraphicsSupport(std::size_t w, std::size_t h, std::string title, int id); inline int& GetID() noexcept; inline std::shared_ptr GetWindow(); void Render() noexcept; inline void ClearRenderData() noexcept; inline void PixelPut(int x, int y, std::uint32_t color) noexcept; inline void StringPut(int x, int y, std::uint32_t color, std::string str); inline void TexturePut(NonOwningPtr texture, int x, int y); inline void LoadFont(const std::filesystem::path& filepath, float scale); inline void TryEraseTextureFromManager(NonOwningPtr texture) noexcept; inline bool HasWindow() const noexcept { return _has_window; } inline Renderer& GetRenderer() { return *_renderer; } ~GraphicsSupport(); private: PixelPutPipeline m_pixel_put_pipeline; std::vector> m_drawlist; TextManager m_text_manager; TextureManager m_texture_manager; glm::mat4 m_proj = glm::mat4(1.0); std::shared_ptr p_window; std::unique_ptr p_renderer; std::size_t m_width = 0; std::size_t m_height = 0; int m_id; bool m_has_window; }; } #include #endif