Skip to content

Commit 5e96ff3

Browse files
committed
Added icon to editor window, use new logo in exe files
1 parent af62f96 commit 5e96ff3

File tree

12 files changed

+8017
-2
lines changed

12 files changed

+8017
-2
lines changed

Apps/CLI/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ target_link_libraries(RiftCLIExe PUBLIC
1414

1515
rift_module(RiftCLIExe)
1616
set_target_properties(RiftCLIExe PROPERTIES OUTPUT_NAME "Rift")
17-
set_icon(RiftCLIExe ../../Resources/Icon.ico)
17+
set_icon(RiftCLIExe Icon.ico)

Apps/CLI/Icon.ico

33.6 KB
Binary file not shown.

Apps/Editor/Icon.ico

33.6 KB
Binary file not shown.

Extern/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ add_subdirectory(CLI11)
1515

1616

1717
if (RIFT_BUILD_EDITOR)
18+
add_library(stb_image INTERFACE)
19+
target_include_directories(stb_image INTERFACE stb)
20+
21+
1822
find_package(OpenGL REQUIRED)
1923
add_library(gl3w STATIC gl3w/GL/gl3w.c)
2024
target_include_directories(gl3w PUBLIC gl3w)

Extern/stb/stb_image.h

+7,985
Large diffs are not rendered by default.

Libs/Editor/CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,3 @@ target_link_libraries(RiftEditor PUBLIC
1515

1616
rift_module(RiftEditor)
1717
rift_enable_module_resources(RiftEditor)
18-
set_icon(RiftEditor ../../Resources/Icon.ico)
-3.13 KB
Loading

Libs/UI/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ target_link_libraries(RiftUI PUBLIC
1313
imgui
1414
IconFontCppHeaders
1515
)
16+
target_link_libraries(RiftUI PRIVATE stb_image)
1617
target_compile_definitions(RiftUI PRIVATE NOMINMAX)
1718

1819
rift_module(RiftUI)

Libs/UI/Include/UI/Window.h

+2
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,6 @@ namespace rift::UI
2222
bool WantsToClose();
2323

2424
GLFWwindow* GetWindow();
25+
26+
void SetWindowIcon();
2527
}; // namespace rift::UI

Libs/UI/Src/Window.cpp

+22
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@
1616
// Include glfw3.h after our OpenGL definitions
1717
#include <GLFW/glfw3.h>
1818
#include <Pipe/Core/Log.h>
19+
#include <Pipe/Files/Paths.h>
1920
#include <PipeColor.h>
2021

22+
#define STB_IMAGE_IMPLEMENTATION
23+
#include <stb_image.h>
24+
2125

2226
namespace rift::UI
2327
{
@@ -94,6 +98,8 @@ namespace rift::UI
9498
ImGui_ImplGlfw_InitForOpenGL(gWindow, true);
9599
ImGui_ImplOpenGL3_Init(glslVersion);
96100

101+
SetWindowIcon();
102+
97103
RegisterCoreKeyValueInspections();
98104
return true;
99105
}
@@ -164,4 +170,20 @@ namespace rift::UI
164170
{
165171
return gWindow;
166172
}
173+
174+
void SetWindowIcon()
175+
{
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)
181+
{
182+
p::Error("Window icon couldn't be loaded");
183+
return;
184+
}
185+
glfwSetWindowIcon(gWindow, 1, &image);
186+
187+
stbi_image_free(image.pixels);
188+
}
167189
} // namespace rift::UI

Tests/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ target_include_directories(RiftTests PUBLIC .)
88
target_link_libraries(RiftTests PUBLIC RiftAST Bandit)
99

1010
add_test(NAME RiftTests COMMAND $<TARGET_FILE:RiftTests>)
11+
12+
set_icon(RiftTests Icon.ico)

Tests/Icon.ico

99.7 KB
Binary file not shown.

0 commit comments

Comments
 (0)