mirror of
				https://github.com/raysan5/raylib.git
				synced 2025-11-04 01:34:19 +00:00 
			
		
		
		
	Added function SetWindowIcon()
Only DESKTOP platforms (Windows, Linus, OSX)
This commit is contained in:
		
							
								
								
									
										21
									
								
								src/core.c
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								src/core.c
									
									
									
									
									
								
							@@ -524,7 +524,7 @@ bool IsWindowMinimized(void)
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Fullscreen toggle
 | 
					// Fullscreen toggle (only PLATFORM_DESKTOP)
 | 
				
			||||||
void ToggleFullscreen(void)
 | 
					void ToggleFullscreen(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
#if defined(PLATFORM_DESKTOP)
 | 
					#if defined(PLATFORM_DESKTOP)
 | 
				
			||||||
@@ -540,6 +540,25 @@ void ToggleFullscreen(void)
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Set icon for window (only PLATFORM_DESKTOP)
 | 
				
			||||||
 | 
					void SetWindowIcon(Image image)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					#if defined(PLATFORM_DESKTOP)
 | 
				
			||||||
 | 
					    ImageFormat(&image, UNCOMPRESSED_R8G8B8A8);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    GLFWimage icon[1];
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    icon[0].width = image.width;
 | 
				
			||||||
 | 
					    icon[0].height = image.height;
 | 
				
			||||||
 | 
					    icon[0].pixels = (unsigned char *)image.data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // NOTE: We only support one image icon
 | 
				
			||||||
 | 
					    glfwSetWindowIcon(window, 1, icon);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // TODO: Support multi-image icons --> image.mipmaps
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Get current screen width
 | 
					// Get current screen width
 | 
				
			||||||
int GetScreenWidth(void)
 | 
					int GetScreenWidth(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -638,6 +638,7 @@ RLAPI void CloseWindow(void);                                     // Close Windo
 | 
				
			|||||||
RLAPI bool WindowShouldClose(void);                               // Detect if KEY_ESCAPE pressed or Close icon pressed
 | 
					RLAPI bool WindowShouldClose(void);                               // Detect if KEY_ESCAPE pressed or Close icon pressed
 | 
				
			||||||
RLAPI bool IsWindowMinimized(void);                               // Detect if window has been minimized (or lost focus)
 | 
					RLAPI bool IsWindowMinimized(void);                               // Detect if window has been minimized (or lost focus)
 | 
				
			||||||
RLAPI void ToggleFullscreen(void);                                // Fullscreen toggle (only PLATFORM_DESKTOP)
 | 
					RLAPI void ToggleFullscreen(void);                                // Fullscreen toggle (only PLATFORM_DESKTOP)
 | 
				
			||||||
 | 
					RLAPI void SetWindowIcon(Image image);                            // Set icon for window (only PLATFORM_DESKTOP)
 | 
				
			||||||
RLAPI int GetScreenWidth(void);                                   // Get current screen width
 | 
					RLAPI int GetScreenWidth(void);                                   // Get current screen width
 | 
				
			||||||
RLAPI int GetScreenHeight(void);                                  // Get current screen height
 | 
					RLAPI int GetScreenHeight(void);                                  // Get current screen height
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user