mirror of
https://gitea.sffempire.ru/Kolyah35/minecraft-pe-0.6.1.git
synced 2026-03-30 20:13:31 +00:00
FIX: Rewrite options
This commit is contained in:
22
src/client/gui/components/KeyOption.cpp
Normal file
22
src/client/gui/components/KeyOption.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#include "KeyOption.h"
|
||||
#include <client/Minecraft.h>
|
||||
|
||||
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));
|
||||
}
|
||||
Reference in New Issue
Block a user