fixing put pixel, adding scene change checker

This commit is contained in:
2024-10-21 01:48:01 +02:00
parent 4f755f8a6f
commit 0304834008
28 changed files with 302 additions and 201 deletions

View File

@@ -19,7 +19,6 @@ namespace mlx
enum class Event
{
DescriptorPoolResetEventCode = 55,
ResizeEventCode = 56,
FrameBeginEventCode = 57,
FatalErrorEventCode = 168,

View File

@@ -44,6 +44,8 @@ namespace mlx
std::shared_ptr<Window> p_window;
std::unique_ptr<Scene> p_scene;
std::uint64_t m_draw_layer = 0;
int m_id;
bool m_has_window;

View File

@@ -9,6 +9,7 @@ namespace mlx
p_scene->ResetSprites();
m_put_pixel_manager.ResetRenderData();
m_insert_new_pixel_put_texture = true;
m_draw_layer = 0;
}
void GraphicsSupport::PixelPut(int x, int y, std::uint32_t color) noexcept
@@ -19,6 +20,7 @@ namespace mlx
{
Sprite& new_sprite = p_scene->CreateSprite(texture);
new_sprite.SetPosition(Vec2f{ 0.0f, 0.0f });
m_draw_layer++;
}
m_insert_new_pixel_put_texture = false;
}
@@ -42,8 +44,12 @@ namespace mlx
new_sprite.SetPosition(Vec2f{ static_cast<float>(x), static_cast<float>(y) });
m_insert_new_pixel_put_texture = true;
}
else
else if(!p_scene->IsTextureAtGivenDrawLayer(texture, m_draw_layer))
{
p_scene->BringToFront(std::move(sprite));
m_insert_new_pixel_put_texture = true;
}
m_draw_layer++;
}
void GraphicsSupport::LoadFont(const std::filesystem::path& filepath, float scale)