mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-11 22:53:34 +00:00
yes
This commit is contained in:
@@ -52,10 +52,7 @@ namespace mlx
|
||||
Internal::WindowInfos* infos = new Internal::WindowInfos;
|
||||
Verify(infos != nullptr, "SDL: window allocation failed");
|
||||
|
||||
if(title == "让我们在月光下做爱吧")
|
||||
infos->window = SDL_CreateWindow(title.c_str(), std::rand() % 512, std::rand() % 512, w, h, SDL_WINDOW_VULKAN | (hidden ? SDL_WINDOW_HIDDEN : SDL_WINDOW_SHOWN));
|
||||
else
|
||||
infos->window = SDL_CreateWindow(title.c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, w, h, SDL_WINDOW_VULKAN | (hidden ? SDL_WINDOW_HIDDEN : SDL_WINDOW_SHOWN));
|
||||
infos->window = SDL_CreateWindow(title.c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, w, h, SDL_WINDOW_VULKAN | (hidden ? SDL_WINDOW_HIDDEN : SDL_WINDOW_SHOWN));
|
||||
if(!infos->window)
|
||||
FatalError("SDL: unable to open a new window; %", SDL_GetError());
|
||||
infos->icon = SDL_CreateRGBSurfaceFrom(static_cast<void*>(logo_mlx), logo_mlx_width, logo_mlx_height, 32, 4 * logo_mlx_width, rmask, gmask, bmask, amask);
|
||||
|
||||
@@ -50,17 +50,17 @@ namespace mlx
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
m_atlas.Init(vulkan_bitmap, RANGE, RANGE, VK_FORMAT_R8G8B8A8_SRGB, false, m_name + "_font_atlas");
|
||||
m_atlas.Init(vulkan_bitmap, RANGE, RANGE, VK_FORMAT_R8G8B8A8_SRGB, false, m_name + "_font_atlas_" + std::to_string(m_scale));
|
||||
#else
|
||||
m_atlas.Init(vulkan_bitmap, RANGE, RANGE, VK_FORMAT_R8G8B8A8_SRGB, false, {});
|
||||
#endif
|
||||
|
||||
DebugLog("Font: loaded %", m_name);
|
||||
DebugLog("Font: loaded % with a scale of %", m_name, m_scale);
|
||||
}
|
||||
|
||||
void Font::Destroy()
|
||||
{
|
||||
m_atlas.Destroy();
|
||||
DebugLog("Font: unloaded %", m_name);
|
||||
DebugLog("Font: unloaded % with a scale of %", m_name, m_scale);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,13 +19,14 @@ namespace mlx
|
||||
float stb_x = 0.0f;
|
||||
float stb_y = 0.0f;
|
||||
|
||||
auto char_data = font->GetCharData();
|
||||
for(char c : text)
|
||||
{
|
||||
if(c < 32)
|
||||
continue;
|
||||
|
||||
stbtt_aligned_quad q;
|
||||
stbtt_GetPackedQuad(font->GetCharData().data(), RANGE, RANGE, c - 32, &stb_x, &stb_y, &q, 1);
|
||||
stbtt_GetPackedQuad(char_data.data(), RANGE, RANGE, c - 32, &stb_x, &stb_y, &q, 1);
|
||||
|
||||
std::size_t index = vertex_data.size();
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace mlx
|
||||
struct SpriteData
|
||||
{
|
||||
Vec4f color;
|
||||
Vec4f position;
|
||||
Vec2f position;
|
||||
};
|
||||
|
||||
void Render2DPass::Init()
|
||||
@@ -106,7 +106,7 @@ namespace mlx
|
||||
for(auto drawable : drawables)
|
||||
{
|
||||
SpriteData drawable_data;
|
||||
drawable_data.position = Vec4f{ drawable->GetPosition(), 0.0f, 1.0f };
|
||||
drawable_data.position = drawable->GetPosition();
|
||||
drawable_data.color = drawable->GetColor();
|
||||
|
||||
drawable->Bind(frame_index, cmd);
|
||||
|
||||
Reference in New Issue
Block a user