mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-11 14:43:34 +00:00
adding clear color in mlx_clear_window
This commit is contained in:
@@ -27,7 +27,7 @@ namespace mlx
|
||||
inline void SetFPSCap(std::uint32_t fps) noexcept;
|
||||
|
||||
inline Handle NewGraphicsSuport(std::size_t w, std::size_t h, const char* title, bool is_resizable);
|
||||
inline void ClearGraphicsSupport(Handle win);
|
||||
inline void ClearGraphicsSupport(Handle win, int color);
|
||||
inline void DestroyGraphicsSupport(Handle win);
|
||||
inline void SetGraphicsSupportPosition(Handle win, int x, int y);
|
||||
|
||||
|
||||
@@ -101,11 +101,11 @@ namespace mlx
|
||||
return static_cast<void*>(&m_graphics.back()->GetID());
|
||||
}
|
||||
|
||||
void Application::ClearGraphicsSupport(Handle win)
|
||||
void Application::ClearGraphicsSupport(Handle win, int color)
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
CHECK_WINDOW_PTR(win);
|
||||
m_graphics[*static_cast<int*>(win)]->ResetRenderData();
|
||||
m_graphics[*static_cast<int*>(win)]->ResetRenderData(color);
|
||||
}
|
||||
|
||||
void Application::DestroyGraphicsSupport(Handle win)
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace mlx
|
||||
|
||||
void Render() noexcept;
|
||||
|
||||
inline void ResetRenderData() noexcept;
|
||||
inline void ResetRenderData(int color) 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);
|
||||
|
||||
@@ -3,10 +3,16 @@
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
void GraphicsSupport::ResetRenderData() noexcept
|
||||
void GraphicsSupport::ResetRenderData(int color) noexcept
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
p_scene->ResetScene();
|
||||
Vec4f vec_color = {
|
||||
static_cast<float>((color & 0x000000FF)) / 255.0f,
|
||||
static_cast<float>((color & 0x0000FF00) >> 8) / 255.0f,
|
||||
static_cast<float>((color & 0x00FF0000) >> 16) / 255.0f,
|
||||
static_cast<float>((color & 0xFF000000) >> 24) / 255.0f
|
||||
};
|
||||
p_scene->ResetScene(std::move(vec_color));
|
||||
m_put_pixel_manager.ResetRenderData();
|
||||
m_draw_layer = 0;
|
||||
m_pixelput_called = false;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <Graphics/Sprite.h>
|
||||
#include <Graphics/Drawable.h>
|
||||
#include <Renderer/ViewerData.h>
|
||||
#include <Maths/Vec4.h>
|
||||
|
||||
namespace mlx
|
||||
{
|
||||
@@ -29,7 +30,8 @@ namespace mlx
|
||||
void BringToFront(NonOwningPtr<Drawable> drawable);
|
||||
void BringToDrawLayer(NonOwningPtr<Drawable> drawable, std::uint64_t draw_layer);
|
||||
|
||||
inline void ResetScene() { m_drawables.clear(); }
|
||||
inline void ResetScene(Vec4f clear) { m_drawables.clear(); m_clear_color = std::move(clear); }
|
||||
inline const Vec4f& GetClearColor() const noexcept { return m_clear_color; }
|
||||
|
||||
[[nodiscard]] MLX_FORCEINLINE const std::vector<std::shared_ptr<Drawable>>& GetDrawables() const noexcept { return m_drawables; }
|
||||
[[nodiscard]] MLX_FORCEINLINE ViewerData& GetViewerData() noexcept { return m_viewer_data; }
|
||||
@@ -40,6 +42,7 @@ namespace mlx
|
||||
std::vector<std::shared_ptr<Drawable>> m_drawables;
|
||||
ViewerData m_viewer_data;
|
||||
std::shared_ptr<Font> p_bound_font;
|
||||
Vec4f m_clear_color = { 0.0f, 0.0f, 0.0f, 1.0f };
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace mlx
|
||||
RenderPasses() = default;
|
||||
|
||||
void Init(class Renderer& renderer);
|
||||
void Pass(class Scene& scene, class Renderer& renderer);
|
||||
void Pass(class Scene& scene, class Renderer& renderer, const Vec4f& clear_color);
|
||||
void Destroy();
|
||||
|
||||
~RenderPasses() = default;
|
||||
|
||||
Reference in New Issue
Block a user