Kaynağa Gözat

Set Win32 window icon with app icon. Fixes #102.

woollybah 6 yıl önce
ebeveyn
işleme
ba4fe5b85d

+ 4 - 0
blitz.mod/blitz_app.c

@@ -141,6 +141,10 @@ void bbGetAppFileDir(wchar_t * buf) {
 	}
 }
 
+HICON bbAppIcon(HINSTANCE hInstance) {
+	return LoadIcon(hInstance, MAKEINTRESOURCE (101));
+}
+
 #elif __linux
 
 #include <unistd.h>

+ 4 - 0
blitz.mod/blitz_app.h

@@ -35,6 +35,10 @@ int		bbIsMainThread();
 
 void		bbStartup( int argc,char *argv[],void *dummy1,void *dummy2 );
 
+#ifdef _WIN32
+HICON bbAppIcon(HINSTANCE hInstance);
+#endif
+
 #ifdef __cplusplus
 }
 #endif

+ 4 - 0
dxgraphics.mod/d3d9graphics.bmx

@@ -9,6 +9,9 @@ Import BRL.LinkedList
 Import brl.systemdefault
 
 Private
+Extern
+	Function bbAppIcon:Byte Ptr(inst:Byte Ptr)="HICON bbAppIcon(HINSTANCE)!"
+End Extern
 
 Global _wndClass$="BBDX9Device Window Class"
 
@@ -373,6 +376,7 @@ Type TD3D9GraphicsDriver Extends TGraphicsDriver
 		wndclass.SethInstance(GetModuleHandleW( Null ))
 		wndclass.SetlpfnWndProc(D3D9WndProc)
 		wndclass.SethCursor(LoadCursorW( Null,Short Ptr IDC_ARROW ))
+		wndClass.SethIcon(bbAppIcon(GetModuleHandleW( Null )))
 		wndclass.SetlpszClassName(name)
 		RegisterClassW wndclass.classPtr
 		MemFree name

+ 2 - 0
glgraphics.mod/glgraphics.win32.c

@@ -157,6 +157,7 @@ static void _initWndClass(){
 		wc.hInstance=GetModuleHandle(0);
 		wc.lpszClassName=CLASS_NAMEW;
 		wc.hCursor=(HCURSOR)LoadCursor( 0,IDC_ARROW );
+		wc.hIcon = bbAppIcon(wc.hInstance);
 		wc.hbrBackground=0;
 		if( !RegisterClassExW( &wc ) ) exit( -1 );
 	}else{
@@ -166,6 +167,7 @@ static void _initWndClass(){
 		wc.hInstance=GetModuleHandle(0);
 		wc.lpszClassName=CLASS_NAME;
 		wc.hCursor=(HCURSOR)LoadCursor( 0,IDC_ARROW );
+		wc.hIcon = bbAppIcon(wc.hInstance);
 		wc.hbrBackground=0;
 		if( !RegisterClassEx( &wc ) ) exit( -1 );
 	}