Skip to content

Commit 21d15f7

Browse files
committed
Added multiple resolution window icons
1 parent 5e96ff3 commit 21d15f7

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed
2.87 KB
Loading
751 Bytes
Loading

Libs/UI/Src/Window.cpp

+17-7
Original file line numberDiff line numberDiff line change
@@ -173,17 +173,27 @@ namespace rift::UI
173173

174174
void SetWindowIcon()
175175
{
176-
p::String iconPath = p::JoinPaths(p::GetBasePath(), "Resources/Editor/Icons/Icon.png");
177-
GLFWimage image;
178-
image.pixels = stbi_load(
179-
iconPath.c_str(), &image.width, &image.height, nullptr, 0); // rgba channels
180-
if (image.pixels == nullptr)
176+
p::String icon64Path = p::JoinPaths(p::GetBasePath(), "Resources/Editor/Icons/Logo_64.png");
177+
p::String icon128Path =
178+
p::JoinPaths(p::GetBasePath(), "Resources/Editor/Icons/Logo_128.png");
179+
p::String icon256Path =
180+
p::JoinPaths(p::GetBasePath(), "Resources/Editor/Icons/Logo_256.png");
181+
GLFWimage images[3];
182+
images[0].pixels =
183+
stbi_load(icon64Path.c_str(), &images[0].width, &images[0].height, nullptr, 0);
184+
images[1].pixels =
185+
stbi_load(icon128Path.c_str(), &images[1].width, &images[1].height, nullptr, 0);
186+
images[2].pixels =
187+
stbi_load(icon256Path.c_str(), &images[2].width, &images[2].height, nullptr, 0);
188+
if (!images[0].pixels || !images[1].pixels || !images[2].pixels)
181189
{
182190
p::Error("Window icon couldn't be loaded");
183191
return;
184192
}
185-
glfwSetWindowIcon(gWindow, 1, &image);
193+
glfwSetWindowIcon(gWindow, 3, images);
186194

187-
stbi_image_free(image.pixels);
195+
stbi_image_free(images[0].pixels);
196+
stbi_image_free(images[1].pixels);
197+
stbi_image_free(images[2].pixels);
188198
}
189199
} // namespace rift::UI

0 commit comments

Comments
 (0)