From: RealBadAngel Date: Tue, 1 Jan 2013 23:03:47 +0000 (+0100) Subject: Bugfixes to item_image formspec method X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=36f03a7f4ae81e8735328a38c9415b6e7081c37c;p=zefram%2Fminetest%2Fminetest_engine.git Bugfixes to item_image formspec method --- diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp index 986f3049..ea537deb 100644 --- a/src/guiFormSpecMenu.cpp +++ b/src/guiFormSpecMenu.cpp @@ -293,7 +293,7 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize) geom.X = stof(f.next(",")) * (float)imgsize.X; geom.Y = stof(f.next(";")) * (float)imgsize.Y; std::string name = f.next("]"); - errorstream<<"item name="<getOriginalSize())), NULL/*&AbsoluteClippingRect*/, colors, true); } - + + /* + Draw item images + */ + for(u32 i=0; iidef(); + ItemStack item; + item.deSerialize(spec.name, idef); + video::ITexture *texture = idef->getInventoryTexture(item.getDefinition(idef).name, m_gamedef); + // Image size on screen + core::rect imgrect(0, 0, spec.geom.X, spec.geom.Y); + // Image rectangle on screen + core::rect rect = imgrect + spec.pos; + const video::SColor color(255,255,255,255); + const video::SColor colors[] = {color,color,color,color}; + driver->draw2DImage(texture, rect, + core::rect(core::position2d(0,0), + core::dimension2di(texture->getOriginalSize())), + NULL/*&AbsoluteClippingRect*/, colors, true); + } + /* Draw items Phase 0: Item slot rectangles