I want to use my custom icon and display it on the window's top left corner.
It is possible to do so if i named my icon as "irrlicht.ico".
However, if I want to embed my icon inside the exe file, there's no way for me to use it in Irrlicht.
Could we modify the source code a little bit in this way:
for struct SIrrlichtCreationParameters, add const char* windowIcon (default is "irrlicht.ico")
for createDevice()
Code: Select all
IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDevice(video::E_DRIVER_TYPE driverType,
const core::dimension2d<s32>& windowSize,
u32 bits, bool fullscreen,
bool stencilbuffer, bool vsync, IEventReceiver* res,
const char* windowIcon) /***added***/
{
SIrrlichtCreationParameters p;
p.DriverType = driverType;
p.WindowSize = windowSize;
p.Bits = bits;
p.Fullscreen = fullscreen;
p.Stencilbuffer = stencilbuffer;
p.Vsync = vsync;
p.EventReceiver = res;
p.windowIcon = windowIcon; /***added***/
return createDeviceEx(p);
}
Code: Select all
CIrrDeviceWin32::CIrrDeviceWin32(const SIrrlichtCreationParameters& params)
: CIrrDeviceStub(params), HWnd(0), ChangedToFullScreen(false),
IsNonNTWindows(false), Resized(false),
ExternalWindow(false), Win32CursorControl(0)
{
......
......
// if there is an icon, load it
wcex.hIcon = (HICON)LoadImage(hInstance, CreationParams.windowIcon /***modified***/, IMAGE_ICON, 0,0, LR_LOADFROMFILE);
......
......
}
Code: Select all
_device = createDevice(
video::EDT_DIRECT3D9,
core::dimension2d<s32>(800, 600),
32,
false,
false,
false,
0,
MAKEINTRESOURCEA(IDI_ICON1) //IDI_ICON1 is the icon embedded in the exe file
);