mirror of
https://github.com/minetest/irrlicht.git
synced 2024-12-26 02:30:31 +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,12 +2135,30 @@ gui::ECURSOR_ICON CIrrDeviceWin32::CCursorControl::addIcon(const gui::SCursorSpr
|
|||||||
irr::core::rect<s32> rectIcon = icon.SpriteBank->getPositions()[rectId];
|
irr::core::rect<s32> rectIcon = icon.SpriteBank->getPositions()[rectId];
|
||||||
|
|
||||||
HCURSOR hc = Device->TextureToCursor(HWnd, icon.SpriteBank->getTexture(texId), rectIcon, icon.HotSpot);
|
HCURSOR hc = Device->TextureToCursor(HWnd, icon.SpriteBank->getTexture(texId), rectIcon, icon.HotSpot);
|
||||||
|
if ( hc != NULL )
|
||||||
|
{
|
||||||
cW32.Frames.push_back( CursorFrameW32(hc) );
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !cW32.Frames.empty() )
|
||||||
|
{
|
||||||
Cursors.push_back( cW32 );
|
Cursors.push_back( cW32 );
|
||||||
return (gui::ECURSOR_ICON)(Cursors.size() - 1);
|
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;
|
return gui::ECI_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user