summaryrefslogtreecommitdiff
path: root/engine/xe_window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engine/xe_window.cpp')
-rwxr-xr-xengine/xe_window.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/engine/xe_window.cpp b/engine/xe_window.cpp
index 0f9a2d1..8da1cc4 100755
--- a/engine/xe_window.cpp
+++ b/engine/xe_window.cpp
@@ -1,9 +1,11 @@
#include "xe_window.hpp"
+#include "stb_image.h"
namespace xe {
- Window::Window(int w, int h, std::string name) : width{w}, height{h}, windowName{name} {
+ Window::Window(int w, int h, std::string name, const char *icon) : width{w}, height{h}, windowName{name} {
initWindow();
+ setIcon(icon);
}
Window::~Window() {
@@ -21,6 +23,14 @@ namespace xe {
glfwSetFramebufferSizeCallback(window, framebufferResizeCallback);
}
+ void Window::setIcon(const char *icon) {
+ if(icon == NULL) return;
+ GLFWimage images[1];
+ images[0].pixels = stbi_load(icon, &images[0].width, &images[0].height, 0, 4); //rgba channels
+ glfwSetWindowIcon(window, 1, images);
+ stbi_image_free(images[0].pixels);
+ }
+
void Window::createWindowSurface(VkInstance instance, VkSurfaceKHR *surface){
if (glfwCreateWindowSurface(instance, window, nullptr, surface) != VK_SUCCESS) {
throw std::runtime_error("failed to create window surface");