Files
minecraft-pe-0.6.1/src/client/gui/components/OptionsItem.cpp
2026-03-02 22:04:18 +03:00

24 lines
776 B
C++
Executable File

#include "OptionsItem.h"
#include "../../Minecraft.h"
#include "../../../util/Mth.h"
OptionsItem::OptionsItem( std::string label, GuiElement* element )
: GuiElementContainer(false, true, 0, 0, 24, 12),
label(label) {
addChild(element);
}
void OptionsItem::setupPositions() {
int currentHeight = 0;
for(std::vector<GuiElement*>::iterator it = children.begin(); it != children.end(); ++it) {
(*it)->x = x + width - (*it)->width - 15;
(*it)->y = y + currentHeight;
currentHeight += (*it)->height;
}
height = currentHeight;
}
void OptionsItem::render( Minecraft* minecraft, int xm, int ym ) {
int yOffset = (height - 8) / 2;
minecraft->font->draw(label, (float)x, (float)y + yOffset, 0x909090, false);
super::render(minecraft, xm, ym);
}