Skip to content

Commit

Permalink
Added icon to editor window, use new logo in exe files
Browse files Browse the repository at this point in the history
  • Loading branch information
muit committed Feb 6, 2024
1 parent af62f96 commit 5e96ff3
Show file tree
Hide file tree
Showing 12 changed files with 8,017 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Apps/CLI/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ target_link_libraries(RiftCLIExe PUBLIC

rift_module(RiftCLIExe)
set_target_properties(RiftCLIExe PROPERTIES OUTPUT_NAME "Rift")
set_icon(RiftCLIExe ../../Resources/Icon.ico)
set_icon(RiftCLIExe Icon.ico)
Binary file modified Apps/CLI/Icon.ico
Binary file not shown.
Binary file modified Apps/Editor/Icon.ico
Binary file not shown.
4 changes: 4 additions & 0 deletions Extern/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ add_subdirectory(CLI11)


if (RIFT_BUILD_EDITOR)
add_library(stb_image INTERFACE)
target_include_directories(stb_image INTERFACE stb)


find_package(OpenGL REQUIRED)
add_library(gl3w STATIC gl3w/GL/gl3w.c)
target_include_directories(gl3w PUBLIC gl3w)
Expand Down
7,985 changes: 7,985 additions & 0 deletions Extern/stb/stb_image.h

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion Libs/Editor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ target_link_libraries(RiftEditor PUBLIC

rift_module(RiftEditor)
rift_enable_module_resources(RiftEditor)
set_icon(RiftEditor ../../Resources/Icon.ico)
Binary file modified Libs/Editor/Resources/Editor/Icons/Icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions Libs/UI/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ target_link_libraries(RiftUI PUBLIC
imgui
IconFontCppHeaders
)
target_link_libraries(RiftUI PRIVATE stb_image)
target_compile_definitions(RiftUI PRIVATE NOMINMAX)

rift_module(RiftUI)
2 changes: 2 additions & 0 deletions Libs/UI/Include/UI/Window.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ namespace rift::UI
bool WantsToClose();

GLFWwindow* GetWindow();

void SetWindowIcon();
}; // namespace rift::UI
22 changes: 22 additions & 0 deletions Libs/UI/Src/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@
// Include glfw3.h after our OpenGL definitions
#include <GLFW/glfw3.h>
#include <Pipe/Core/Log.h>
#include <Pipe/Files/Paths.h>
#include <PipeColor.h>

#define STB_IMAGE_IMPLEMENTATION
#include <stb_image.h>


namespace rift::UI
{
Expand Down Expand Up @@ -94,6 +98,8 @@ namespace rift::UI
ImGui_ImplGlfw_InitForOpenGL(gWindow, true);
ImGui_ImplOpenGL3_Init(glslVersion);

SetWindowIcon();

RegisterCoreKeyValueInspections();
return true;
}
Expand Down Expand Up @@ -164,4 +170,20 @@ namespace rift::UI
{
return gWindow;
}

void SetWindowIcon()
{
p::String iconPath = p::JoinPaths(p::GetBasePath(), "Resources/Editor/Icons/Icon.png");
GLFWimage image;
image.pixels = stbi_load(
iconPath.c_str(), &image.width, &image.height, nullptr, 0); // rgba channels
if (image.pixels == nullptr)
{
p::Error("Window icon couldn't be loaded");
return;
}
glfwSetWindowIcon(gWindow, 1, &image);

stbi_image_free(image.pixels);
}
} // namespace rift::UI
2 changes: 2 additions & 0 deletions Tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ target_include_directories(RiftTests PUBLIC .)
target_link_libraries(RiftTests PUBLIC RiftAST Bandit)

add_test(NAME RiftTests COMMAND $<TARGET_FILE:RiftTests>)

set_icon(RiftTests Icon.ico)
Binary file added Tests/Icon.ico
Binary file not shown.

0 comments on commit 5e96ff3

Please sign in to comment.