mirror of
https://github.com/minetest/irrlicht.git
synced 2024-12-25 02:00:30 +01:00
Add error checks and log warnings in CIrrDeviceWin32::CCursorControl::addIcon
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6601 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
parent
8f8a4ef5e1
commit
ac341472d6
@ -2135,11 +2135,29 @@ gui::ECURSOR_ICON CIrrDeviceWin32::CCursorControl::addIcon(const gui::SCursorSpr
|
||||
irr::core::rect<s32> rectIcon = icon.SpriteBank->getPositions()[rectId];
|
||||
|
||||
HCURSOR hc = Device->TextureToCursor(HWnd, icon.SpriteBank->getTexture(texId), rectIcon, icon.HotSpot);
|
||||
cW32.Frames.push_back( CursorFrameW32(hc) );
|
||||
if ( hc != NULL )
|
||||
{
|
||||
cW32.Frames.push_back( CursorFrameW32(hc) );
|
||||
}
|
||||
else
|
||||
{
|
||||
core::stringc warning("addIcon could not convert texture to cursor for frame ");
|
||||
warning += core::stringc(i);
|
||||
warning += " error ";
|
||||
warning += core::stringc(GetLastError());
|
||||
os::Printer::log(warning.c_str(), ELL_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
Cursors.push_back( cW32 );
|
||||
return (gui::ECURSOR_ICON)(Cursors.size() - 1);
|
||||
if ( !cW32.Frames.empty() )
|
||||
{
|
||||
Cursors.push_back( cW32 );
|
||||
return (gui::ECURSOR_ICON)(Cursors.size() - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
os::Printer::log("addIcon failed due to the lack of cursor frames", ELL_WARNING);
|
||||
}
|
||||
}
|
||||
return gui::ECI_NORMAL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user