#include "RecipieOutput.h" #include #include "Globals.h" #include "UIMLToolTip.h" RecipieOutputElement::RecipieOutputElement() : Framework::UIMLElement() {} //! prüft, ob dieses UIML Element für ein bestimmtes xml Element zuständig //! ist bool RecipieOutputElement::isApplicableFor(Framework::XML::Element& element) { return element.getName().istGleich("output"); } //! erstellt eine neue Zeichnung zu einem gegebenen xml Element Framework::Zeichnung* RecipieOutputElement::parseElement( Framework::XML::Element& element, Framework::UIMLContainer& generalFactory) { SlotInfo info; info.itemCount = (int)element.getAttributeValue("amount"); int itemType = (int)element.getAttributeValue("itemType"); info.hp = (float)(double)element.getAttributeValue("hp"); info.maxHp = (float)(double)element.getAttributeValue("maxHp"); info.durability = (float)(double)element.getAttributeValue("durability"); info.maxDurability = (float)(double)element.getAttributeValue("maxDurability"); info.zItem = zItemType(itemType)->zIcon(); return new RecipieOutput(info, element.zChild(0)->toString()); } bool RecipieOutputElement::updateElement(Framework::XML::Element& element, Framework::Zeichnung& z, Framework::UIMLContainer& generalFactory) { return false; } //! wendet die layout parameter zu einer Zeichnung an void RecipieOutputElement::layout(Framework::XML::Element& element, Framework::Zeichnung& z, int pWidth, int pHeight, Framework::UIMLContainer& generalLayouter) { UIMLElement::layout(element, z, pWidth, pHeight, generalLayouter); z.setWidth(50); z.setHeight(50); } RecipieOutput::RecipieOutput(SlotInfo info, Framework::Text toolTipUIML) : info(info) { setStyle(Framework::Zeichnung::Style::Erlaubt | Framework::Zeichnung::Style::Sichtbar); UIMLToolTip* tip = new UIMLToolTip(); tip->setUIML(toolTipUIML); tip->setWarten(0.5); setToolTipZ(tip); } void RecipieOutput::render(Framework::Bild& rObj) { ZeichnungHintergrund::render(rObj); if (!rObj.setDrawOptions(pos.x, pos.y, gr.x, gr.y)) return; info.render(-1, -1, rObj, 0, 0); rObj.releaseDrawOptions(); }