Skip to content

Commit

Permalink
[GLFW] add icon
Browse files Browse the repository at this point in the history
  • Loading branch information
sarthou committed Aug 16, 2024
1 parent bcc735f commit d8c9066
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Engine/Graphics/GLFW/Window.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
#include "overworld/Engine/Graphics/GLFW/Window.h"

#include "overworld/Compat/ROS.h"
// should be first

#include <memory>
#include <string>

#include "overworld/Engine/Graphics/Common/WindowPlatformData.h"
#include "overworld/Engine/Graphics/OpenGL/Camera.h"
#include "overworld/Engine/Graphics/OpenGL/Renderer.h"

#ifndef STB_IMAGE_IMPLEMENTATION
#define STB_IMAGE_IMPLEMENTATION
#define STB_IMAGE_STATIC
#include "stb_image.h"
#endif

// Should be last
#define GLFW_EXPOSE_NATIVE_X11
#include <GLFW/glfw3.h>
Expand All @@ -24,6 +33,12 @@ namespace owds {
// glfwWindowHint(GLFW_SAMPLES, 4);
glfw_window_ = glfwCreateWindow(640, 480, name.c_str(), nullptr, nullptr);

GLFWimage icons[1];
std::string icon_path(owds::compat::owds_ros::getShareDirectory("overworld") + "/docs/images/overworld_light.png");
icons[0].pixels = stbi_load(icon_path.c_str(), &icons[0].width, &icons[0].height, 0, 4); // rgba channels
glfwSetWindowIcon(glfw_window_, 1, icons);
stbi_image_free(icons[0].pixels);

glfwMakeContextCurrent(glfw_window_);
glfwSetWindowUserPointer(glfw_window_, this);
glfwSetWindowSizeCallback(glfw_window_, [](GLFWwindow* window, const int width, const int height) {
Expand Down

0 comments on commit d8c9066

Please sign in to comment.