FIX: Rewrite options

This commit is contained in:
Kolyah35
2026-03-14 14:13:49 +03:00
parent 09d28be195
commit badd59b644
67 changed files with 1093 additions and 1377 deletions

View File

@@ -12,14 +12,12 @@ KeyboardInput::KeyboardInput( Options* options )
void KeyboardInput::setKey( int key, bool state )
{
int id = -1;
if (key == options->keyUp.key) id = KEY_UP;
if (key == options->keyDown.key) id = KEY_DOWN;
if (key == options->keyLeft.key) id = KEY_LEFT;
if (key == options->keyRight.key) id = KEY_RIGHT;
if (key == options->keyJump.key) id = KEY_JUMP;
if (key == options->keySneak.key) id = KEY_SNEAK;
if (key == options->keyCraft.key) id = KEY_CRAFT;
//printf("key: %d\n", id);
if (key == options->getIntValue(OPTIONS_KEY_FORWARD)) id = KEY_UP;
if (key == options->getIntValue(OPTIONS_KEY_BACK)) id = KEY_DOWN;
if (key == options->getIntValue(OPTIONS_KEY_LEFT)) id = KEY_LEFT;
if (key == options->getIntValue(OPTIONS_KEY_RIGHT)) id = KEY_RIGHT;
if (key == options->getIntValue(OPTIONS_KEY_JUMP)) id = KEY_JUMP;
if (key == options->getIntValue(OPTIONS_KEY_SNEAK)) id = KEY_SNEAK;
if (id >= 0) {
keys[id] = state;
}

View File

@@ -89,7 +89,7 @@ public:
}
virtual void onConfigChanged(const Config& c) {
if (false && _options->isJoyTouchArea) {
if (false && _options->getBooleanValue(OPTIONS_IS_JOY_TOUCH_AREA)) {
int touchWidth = c.width - (int)inventoryArea._x1;
if (touchWidth > (int)c.minecraft->pixelCalc.millimetersToPixels(60))
touchWidth = (int)c.minecraft->pixelCalc.millimetersToPixels(60);
@@ -293,7 +293,7 @@ public:
}
void render(float alpha) {
if (_options->isJoyTouchArea) {
if (_options->getBooleanValue(OPTIONS_IS_JOY_TOUCH_AREA)) {
fill( (int) (Gui::InvGuiScale * joyTouchArea._x0),
(int) (Gui::InvGuiScale * joyTouchArea._y0),
(int) (Gui::InvGuiScale * joyTouchArea._x1),
@@ -429,8 +429,8 @@ public:
#ifdef __APPLE__
_turnBuild.pauseArea = _move.getPauseRectangleArea();
#endif
_turnBuild.inventoryArea = _mc->gui.getRectangleArea( _mc->options.isLeftHanded? 1 : -1 );
_turnBuild.setSensitivity(c.options->isJoyTouchArea? 1.8f : 1.0f);
_turnBuild.inventoryArea = _mc->gui.getRectangleArea( _mc->options.getBooleanValue(OPTIONS_IS_LEFT_HANDED)? 1 : -1 );
_turnBuild.setSensitivity(c.options->getBooleanValue(OPTIONS_IS_JOY_TOUCH_AREA)? 1.8f : 1.0f);
((ITurnInput*)&_turnBuild)->onConfigChanged(c);
}

View File

@@ -134,7 +134,7 @@ void TouchscreenInput_TestFps::onConfigChanged(const Config& c) {
float yy;
const float BaseY = -8 + h - 3.0f * Bh;
const float BaseX = _options->isLeftHanded? -8 + w - 3 * Bw
const float BaseX = _options->getBooleanValue(OPTIONS_IS_LEFT_HANDED)? -8 + w - 3 * Bw
: 8 + 0;
// Setup the bounding rectangle
_boundingRectangle = RectangleArea(BaseX, BaseY, BaseX + 3 * Bw, BaseY + 3 * Bh);
@@ -418,7 +418,7 @@ const RectangleArea& TouchscreenInput_TestFps::getPauseRectangleArea()
}
void TouchscreenInput_TestFps::rebuild() {
if (_options->hideGui)
if (_options->getBooleanValue(OPTIONS_HIDEGUI))
return;
Tesselator& t = Tesselator::instance;