This commit is contained in:
Kbz-8
2024-10-21 19:45:33 +02:00
parent c7484b771f
commit 8f757cab08
22 changed files with 121 additions and 68 deletions

View File

@@ -49,8 +49,6 @@ namespace mlx
int m_id;
bool m_has_window;
bool m_insert_new_pixel_put_texture = false;
};
}

View File

@@ -8,21 +8,18 @@ namespace mlx
MLX_PROFILE_FUNCTION();
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
{
MLX_PROFILE_FUNCTION();
NonOwningPtr<Texture> texture = m_put_pixel_manager.DrawPixel(x, y, m_insert_new_pixel_put_texture, color);
NonOwningPtr<Texture> texture = m_put_pixel_manager.DrawPixel(x, y, m_draw_layer, color);
if(texture)
{
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;
}
void GraphicsSupport::StringPut(int x, int y, std::uint32_t color, std::string str)
@@ -42,14 +39,10 @@ namespace mlx
{
Sprite& new_sprite = p_scene->CreateSprite(texture);
new_sprite.SetPosition(Vec2f{ static_cast<float>(x), static_cast<float>(y) });
m_insert_new_pixel_put_texture = true;
m_draw_layer++;
}
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)

View File

@@ -20,7 +20,7 @@ namespace mlx
private:
static MemManager* s_instance;
inline static std::list<void*> s_blocks;
inline static std::vector<void*> s_blocks;
};
}