forked from Kolyah35/minecraft-pe-0.6.1
the whole game
This commit is contained in:
24
src/client/gui/components/OptionsItem.cpp
Executable file
24
src/client/gui/components/OptionsItem.cpp
Executable file
@@ -0,0 +1,24 @@
|
||||
#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);
|
||||
}
|
||||
Reference in New Issue
Block a user