forked from Kolyah35/minecraft-pe-0.6.1
22 lines
717 B
C++
22 lines
717 B
C++
#include "KeyOption.hpp"
|
|
#include <client/Minecraft.hpp>
|
|
|
|
KeyOption::KeyOption(Minecraft* minecraft, OptionId optId)
|
|
: Touch::TButton((int)optId, Keyboard::getKeyName(minecraft->options.getIntValue(optId))) {}
|
|
|
|
|
|
void KeyOption::mouseClicked(Minecraft* minecraft, int x, int y, int buttonNum) {
|
|
selected = isInside(x, y);
|
|
msg = (selected)? "..." : Keyboard::getKeyName(minecraft->options.getIntValue((OptionId)id));
|
|
}
|
|
|
|
void KeyOption::keyPressed(Minecraft* minecraft, int key) {
|
|
if (!selected) return;
|
|
|
|
if (key != Keyboard::KEY_ESCAPE) {
|
|
minecraft->options.set((OptionId)id, key);
|
|
}
|
|
|
|
selected = false;
|
|
msg = Keyboard::getKeyName(minecraft->options.getIntValue((OptionId)id));
|
|
} |