This commit is contained in:
2024-10-19 00:43:39 +02:00
parent d0a74e79c5
commit 386d9abe4b
19 changed files with 109 additions and 174 deletions

View File

@@ -44,11 +44,11 @@ namespace mlx
std::shared_ptr<Window> p_window;
std::unique_ptr<Scene> p_scene;
std::uint64_t m_current_depth = 0;
int m_id;
bool m_has_window;
bool m_insert_new_pixel_put_texture = false;
};
}

View File

@@ -1,6 +1,5 @@
#pragma once
#include <Core/Graphics.h>
#include <iostream>
namespace mlx
{
@@ -9,20 +8,19 @@ namespace mlx
MLX_PROFILE_FUNCTION();
p_scene->ResetSprites();
m_put_pixel_manager.ResetRenderData();
m_current_depth = 0;
m_insert_new_pixel_put_texture = true;
}
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_current_depth, color);
NonOwningPtr<Texture> texture = m_put_pixel_manager.DrawPixel(x, y, m_insert_new_pixel_put_texture, color);
if(texture)
{
Sprite& new_sprite = p_scene->CreateSprite(texture);
new_sprite.SetPosition(Vec3f{ 0.0f, 0.0f, static_cast<float>(m_current_depth) });
new_sprite.SetPosition(Vec2f{ 0.0f, 0.0f });
}
*/
m_insert_new_pixel_put_texture = false;
}
void GraphicsSupport::StringPut(int x, int y, std::uint32_t color, std::string str)
@@ -41,11 +39,11 @@ namespace mlx
if(!sprite)
{
Sprite& new_sprite = p_scene->CreateSprite(texture);
new_sprite.SetPosition(Vec3f{ static_cast<float>(x), static_cast<float>(y), static_cast<float>(m_current_depth) });
m_current_depth++;
new_sprite.SetPosition(Vec2f{ static_cast<float>(x), static_cast<float>(y) });
m_insert_new_pixel_put_texture = true;
}
else
sprite->SetPosition(Vec3f{ static_cast<float>(x), static_cast<float>(y), static_cast<float>(m_current_depth) });
p_scene->BringToFront(std::move(sprite));
}
void GraphicsSupport::LoadFont(const std::filesystem::path& filepath, float scale)