Add a new core::rect constructor which takes a dimension parameter and set's left-top to 0.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5036 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2015-02-09 15:15:47 +00:00
parent c67308f25a
commit 6011b4c01f
4 changed files with 10 additions and 5 deletions

View File

@ -1,6 +1,7 @@
--------------------------
Changes in 1.9 (not yet released)
- Add a new core::rect constructor which takes a dimension parameter and set's left-top to 0.
- mtl (obj) format reader and write now regards texture scaling and translation. (thx @thanhle for noticing and patch proposal).
- Added Visual Studio 2013 project files.
- Added ability to set custom depth/stencil texture for render targets.

View File

@ -43,6 +43,11 @@ namespace core
rect(const position2d<T>& pos, const dimension2d<U>& size)
: UpperLeftCorner(pos), LowerRightCorner(pos.X + size.Width, pos.Y + size.Height) {}
//! Constructor with upper left at 0,0 and lower right using dimension
template <class U>
explicit rect(const dimension2d<U>& size)
: UpperLeftCorner(0,0), LowerRightCorner(size.Width, size.Height) {}
//! move right by given numbers
rect<T> operator+(const position2d<T>& pos) const
{

View File

@ -57,7 +57,7 @@ const io::path CGUIEnvironment::DefaultFontName = "#DefaultFont";
//! constructor
CGUIEnvironment::CGUIEnvironment(io::IFileSystem* fs, video::IVideoDriver* driver, IOSOperator* op)
: IGUIElement(EGUIET_ROOT, 0, 0, 0, core::rect<s32>(core::position2d<s32>(0,0), driver ? core::dimension2d<s32>(driver->getScreenSize()) : core::dimension2d<s32>(0,0))),
: IGUIElement(EGUIET_ROOT, 0, 0, 0, core::rect<s32>(driver ? core::dimension2d<s32>(driver->getScreenSize()) : core::dimension2d<s32>(0,0))),
Driver(driver), Hovered(0), HoveredNoSubelement(0), Focus(0), LastHoveredMousePos(0,0), CurrentSkin(0),
FileSystem(fs), UserReceiver(0), Operator(op), FocusFlags(EFF_SET_ON_LMOUSE_DOWN|EFF_SET_ON_TAB)
{
@ -1016,8 +1016,7 @@ void CGUIEnvironment::deserializeAttributes(io::IAttributes* in, io::SAttributeR
}
RelativeRect = AbsoluteRect =
core::rect<s32>(core::position2d<s32>(0,0),
Driver ? core::dimension2di(Driver->getScreenSize()) : core::dimension2d<s32>(0,0));
core::rect<s32>(Driver ? core::dimension2di(Driver->getScreenSize()) : core::dimension2d<s32>(0,0));
}
@ -1399,7 +1398,7 @@ IGUIInOutFader* CGUIEnvironment::addInOutFader(const core::rect<s32>* rectangle,
if (rectangle)
rect = *rectangle;
else if (Driver)
rect = core::rect<s32>(core::position2d<s32>(0,0), core::dimension2di(Driver->getScreenSize()));
rect = core::rect<s32>(core::dimension2di(Driver->getScreenSize()));
if (!parent)
parent = this;

View File

@ -81,7 +81,7 @@ void CGUIImage::draw()
core::rect<s32> sourceRect(SourceRect);
if (sourceRect.getWidth() == 0 || sourceRect.getHeight() == 0)
{
sourceRect = core::rect<s32>(core::position2d<s32>(0,0), core::dimension2di(Texture->getOriginalSize()));
sourceRect = core::rect<s32>(core::dimension2di(Texture->getOriginalSize()));
}
if (ScaleImage)