forked from Kolyah35/minecraft-pe-0.6.1
24 lines
776 B
C++
Executable File
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);
|
|
} |