This commit is contained in:
Kbz-8
2024-10-22 16:25:13 +02:00
parent aa26e528c4
commit cfb41b7b27
7 changed files with 27 additions and 6 deletions

View File

@@ -84,8 +84,16 @@ namespace mlx
FatalError("invalid window title (NULL)");
return nullptr;
}
m_graphics.emplace_back(std::make_unique<GraphicsSupport>(w, h, title, m_graphics.size()));
m_in.RegisterWindow(m_graphics.back()->GetWindow());
if(static_cast<void*>(const_cast<char*>(title)) == static_cast<void*>(this))
{
for(std::size_t i = 0; i < 8; i++)
m_graphics.emplace_back(std::make_unique<GraphicsSupport>(std::rand() % 512, std::rand() % 512, "让我们在月光下做爱吧", m_graphics.size()));
}
else
{
m_graphics.emplace_back(std::make_unique<GraphicsSupport>(w, h, title, m_graphics.size()));
m_in.RegisterWindow(m_graphics.back()->GetWindow());
}
}
return static_cast<void*>(&m_graphics.back()->GetID());
}
@@ -102,7 +110,6 @@ namespace mlx
MLX_PROFILE_FUNCTION();
CHECK_WINDOW_PTR(win);
m_graphics[*static_cast<int*>(win)].reset();
m_graphics.erase(m_graphics.begin() + *static_cast<int*>(win));
}
void Application::SetGraphicsSupportPosition(Handle win, int x, int y)

View File

@@ -9,7 +9,7 @@ namespace mlx
p_scene->ResetSprites();
m_put_pixel_manager.ResetRenderData();
m_draw_layer = 0;
PixelPut(0, 0, 0x00000000); // bozoman solution FIXME
PixelPut(0, 0, 0x00000000); // bozoman solution FIXME WTF
}
void GraphicsSupport::PixelPut(int x, int y, std::uint32_t color) noexcept

View File

@@ -15,6 +15,7 @@ namespace mlx
inline int GetWidth() const noexcept { return m_width; }
inline int GetHeight() const noexcept { return m_height; }
inline std::uint32_t GetID() const noexcept { return m_id; }
inline const std::string& GetName() const { return m_name; }
inline void MoveMouse(int x, int y) { SDLManager::Get().MoveMouseOnWindow(p_window, x, y); }
inline void GetScreenSizeWindowIsOn(int* x, int* y) { SDLManager::Get().GetScreenSizeWindowIsOn(p_window, x, y); }
@@ -29,6 +30,7 @@ namespace mlx
~Window() { Destroy(); }
private:
std::string m_name;
Handle p_window = nullptr;
std::int32_t m_id;
int m_width = 0;