summaryrefslogtreecommitdiff
path: root/engine/xe_window.cpp
diff options
context:
space:
mode:
authortylermurphy534 <tylermurphy534@gmail.com>2022-09-26 21:24:28 -0400
committertylermurphy534 <tylermurphy534@gmail.com>2022-09-26 21:24:28 -0400
commitbc2a2d08c9b7e5ab7b5b85bdcba77087abaed95a (patch)
treeaabc135163b7569f3c339a471479963ef7eabf2f /engine/xe_window.cpp
parentvertex buffer is not a byte vector, multi texture loading (diff)
downloadminecraftvulkan-bc2a2d08c9b7e5ab7b5b85bdcba77087abaed95a.tar.gz
minecraftvulkan-bc2a2d08c9b7e5ab7b5b85bdcba77087abaed95a.tar.bz2
minecraftvulkan-bc2a2d08c9b7e5ab7b5b85bdcba77087abaed95a.zip
window icon
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");