Set window icon.

This commit is contained in:
Bartosz Taudul 2019-06-02 18:03:56 +02:00
parent 9e3cf3d387
commit 7c7e32d49e

View File

@ -38,6 +38,7 @@
#include "Arimo.hpp" #include "Arimo.hpp"
#include "Cousine.hpp" #include "Cousine.hpp"
#include "FontAwesomeSolid.hpp" #include "FontAwesomeSolid.hpp"
#include "icon.hpp"
static void glfw_error_callback(int error, const char* description) static void glfw_error_callback(int error, const char* description)
{ {
@ -162,6 +163,15 @@ int main( int argc, char** argv )
#endif #endif
GLFWwindow* window = glfwCreateWindow( w, h, title, NULL, NULL); GLFWwindow* window = glfwCreateWindow( w, h, title, NULL, NULL);
if( !window ) return 1; if( !window ) return 1;
{
GLFWimage icon;
int comp;
icon.pixels = stbi_load_from_memory( (const stbi_uc*)Icon_data, Icon_size, &icon.width, &icon.height, nullptr, 4 );
glfwSetWindowIcon( window, 1, &icon );
free( icon.pixels );
}
glfwSetWindowPos( window, x, y ); glfwSetWindowPos( window, x, y );
#ifdef GLFW_MAXIMIZED #ifdef GLFW_MAXIMIZED
if( maximize ) glfwMaximizeWindow( window ); if( maximize ) glfwMaximizeWindow( window );