void Tetris::initOptions () { gchar *bgcolourstr; themeno = themeNameToNumber (confGetString (KEY_OPTIONS_GROUP, KEY_THEME, "plain")); field->setTheme (themeno); preview->setTheme (themeno); startingLevel = confGetInt (KEY_OPTIONS_GROUP, KEY_STARTING_LEVEL, 1); if (startingLevel < 1) startingLevel = 1; if (startingLevel > 20) startingLevel = 20; games_sound_enable (confGetBoolean (KEY_OPTIONS_GROUP, KEY_SOUND, FALSE)); useTarget = confGetBoolean (KEY_OPTIONS_GROUP, KEY_USE_TARGET, FALSE); do_preview = confGetBoolean (KEY_OPTIONS_GROUP, KEY_DO_PREVIEW, TRUE); if (preview) { preview->enable(do_preview); } random_block_colors = confGetBoolean (KEY_OPTIONS_GROUP, KEY_RANDOM_BLOCK_COLORS, FALSE); rotateCounterClockWise = confGetBoolean (KEY_OPTIONS_GROUP, KEY_ROTATE_COUNTER_CLOCKWISE, TRUE); line_fill_height = confGetInt (KEY_OPTIONS_GROUP, KEY_LINE_FILL_HEIGHT, 0); if (line_fill_height < 0) line_fill_height = 0; if (line_fill_height > 19) line_fill_height = 19; line_fill_prob = confGetInt (KEY_OPTIONS_GROUP, KEY_LINE_FILL_PROBABILITY, 0); if (line_fill_prob < 0) line_fill_prob = 0; if (line_fill_prob > 10) line_fill_prob = 10; moveLeft = games_conf_get_keyval_with_default (KEY_CONTROLS_GROUP, KEY_MOVE_LEFT, GDK_Left); moveRight = games_conf_get_keyval_with_default (KEY_CONTROLS_GROUP, KEY_MOVE_RIGHT, GDK_Right); moveDown = games_conf_get_keyval_with_default (KEY_CONTROLS_GROUP, KEY_MOVE_DOWN, GDK_Down); moveDrop = games_conf_get_keyval_with_default (KEY_CONTROLS_GROUP, KEY_MOVE_DROP, GDK_Pause); moveRotate = games_conf_get_keyval_with_default (KEY_CONTROLS_GROUP, KEY_MOVE_ROTATE, GDK_Up); movePause = games_conf_get_keyval_with_default (KEY_CONTROLS_GROUP, KEY_MOVE_PAUSE, GDK_space); bgcolourstr = confGetString (KEY_OPTIONS_GROUP, KEY_BG_COLOUR, "Black"); gdk_color_parse (bgcolourstr, &bgcolour); g_free (bgcolourstr); usebg = confGetBoolean (KEY_OPTIONS_GROUP, KEY_USE_BG_IMAGE, TRUE); }
void loadConfig() { config.showCursor = confGetBool("showcursor", true); config.snapToBorder = confGetBool("snaptoborder", true); config.stretchToFit = confGetBool("stretchtofit", false); config.sensitivity = confGetInt("sensitivity", -5); config.screen = confGetInt("screen", kScreenBoth); // Turn off the backlight of any screen not used if (R_SUCCEEDED(gspLcdInit())) { if (config.screen == kScreenTop) { GSPLCD_PowerOnBacklight(GSPLCD_SCREEN_TOP); GSPLCD_PowerOffBacklight(GSPLCD_SCREEN_BOTTOM); } else if (config.screen == kScreenBottom) { GSPLCD_PowerOnBacklight(GSPLCD_SCREEN_BOTTOM); GSPLCD_PowerOffBacklight(GSPLCD_SCREEN_TOP); } else GSPLCD_PowerOnBacklight(GSPLCD_SCREEN_BOTH); gspLcdExit(); } OSystem_3DS *osys = (OSystem_3DS *)g_system; osys->updateConfig(); }
DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(0, 0, 320 - 10, 230 - 40) { new GUI::ButtonWidget(this, 10, 170, 72, 16, _("~C~lose"), 0, GUI::kCloseCmd); new GUI::ButtonWidget(this, 320 - 10 - 130, 170, 120, 16, _("ScummVM Main Menu"), 0, 0x40000000, 'M'); _tab = new GUI::TabWidget(this, 10, 5, 300, 230 - 20 - 40 - 20); _tab->addTab("Controls"); _leftHandedCheckbox = new GUI::CheckboxWidget(_tab, 5, 5, 130, 20, _("~L~eft handed mode")); _indyFightCheckbox = new GUI::CheckboxWidget(_tab, 5, 20, 140, 20, _("~I~ndy fight controls")); _showCursorCheckbox = new GUI::CheckboxWidget(_tab, 150, 5, 130, 20, _("Show mouse cursor"), 0, 0, 'T'); _snapToBorderCheckbox = new GUI::CheckboxWidget(_tab, 150, 20, 130, 20, _("Snap to edges"), 0, 0, 'T'); new GUI::StaticTextWidget(_tab, 20, 35, 100, 15, _("Touch X Offset"), Graphics::kTextAlignLeft); _touchX = new GUI::SliderWidget(_tab, 130, 35, 130, 12, "TODO: Add tooltip", 1); _touchX->setMinValue(-8); _touchX->setMaxValue(+8); _touchX->setValue(0); _touchX->setFlags(GUI::WIDGET_CLEARBG); new GUI::StaticTextWidget(_tab, 20, 50, 100, 15, _("Touch Y Offset"), Graphics::kTextAlignLeft); _touchY = new GUI::SliderWidget(_tab, 130, 50, 130, 12, "TODO: Add tooltip", 2); _touchY->setMinValue(-8); _touchY->setMaxValue(+8); _touchY->setValue(0); _touchY->setFlags(GUI::WIDGET_CLEARBG); new GUI::StaticTextWidget(_tab, 130 + 65 - 10, 65, 20, 15, "0", Graphics::kTextAlignCenter); new GUI::StaticTextWidget(_tab, 130 + 130 - 10, 65, 20, 15, "8", Graphics::kTextAlignCenter); new GUI::StaticTextWidget(_tab, 130 - 20, 65, 20, 15, "-8", Graphics::kTextAlignCenter); _touchPadStyle = new GUI::CheckboxWidget(_tab, 5, 80, 270, 20, _("Use laptop trackpad-style cursor control"), 0, 0x20000001, 'T'); _screenTaps = new GUI::CheckboxWidget(_tab, 5, 95, 285, 20, _("Tap for left click, double tap right click"), 0, 0x20000002, 'T'); _sensitivityLabel = new GUI::StaticTextWidget(_tab, 20, 110, 110, 15, _("Sensitivity"), Graphics::kTextAlignLeft); _sensitivity = new GUI::SliderWidget(_tab, 130, 110, 130, 12, "TODO: Add tooltip", 1); _sensitivity->setMinValue(4); _sensitivity->setMaxValue(16); _sensitivity->setValue(8); _sensitivity->setFlags(GUI::WIDGET_CLEARBG); _tab->addTab("Graphics"); new GUI::StaticTextWidget(_tab, 5, 67, 180, 15, _("Initial top screen scale:"), Graphics::kTextAlignLeft); _100PercentCheckbox = new GUI::CheckboxWidget(_tab, 5, 82, 80, 20, "100%", "TODO: Add tooltip", 0x30000001, 'T'); _150PercentCheckbox = new GUI::CheckboxWidget(_tab, 5, 97, 80, 20, "150%", "TODO: Add tooltip", 0x30000002, 'T'); _200PercentCheckbox = new GUI::CheckboxWidget(_tab, 5, 112, 80, 20, "200%", "TODO: Add tooltip", 0x30000003, 'T'); new GUI::StaticTextWidget(_tab, 5, 5, 180, 15, _("Main screen scaling:"), Graphics::kTextAlignLeft); _hardScaler = new GUI::CheckboxWidget(_tab, 5, 20, 270, 20, _("Hardware scale (fast, but low quality)"), 0, 0x10000001, 'T'); _cpuScaler = new GUI::CheckboxWidget(_tab, 5, 35, 270, 20, _("Software scale (good quality, but slower)"), 0, 0x10000002, 'S'); _unscaledCheckbox = new GUI::CheckboxWidget(_tab, 5, 50, 270, 20, _("Unscaled (you must scroll left and right)"), 0, 0x10000003, 'S'); new GUI::StaticTextWidget(_tab, 5, 125, 110, 15, _("Brightness:"), Graphics::kTextAlignLeft); _gammaCorrection = new GUI::SliderWidget(_tab, 130, 120, 130, 12, "TODO: Add tooltip", 1); _gammaCorrection->setMinValue(0); _gammaCorrection->setMaxValue(8); _gammaCorrection->setValue(0); _tab->addTab("General"); _highQualityAudioCheckbox = new GUI::CheckboxWidget(_tab, 5, 5, 250, 20, _("High quality audio (slower) (reboot)"), 0, 0, 'T'); _disablePowerOff = new GUI::CheckboxWidget(_tab, 5, 20, 200, 20, _("Disable power off"), 0, 0, 'T'); _tab->setActiveTab(0); _radioButtonMode = false; // new GUI::StaticTextWidget(this, 90, 10, 130, 15, "ScummVM DS Options", Graphics::kTextAlignCenter); //#ifdef ALLOW_CPU_SCALER // _cpuScaler = new GUI::CheckboxWidget(this, 160, 115, 90, 20, "CPU scaler", 0, 0, 'T'); //#endif #ifdef DS_BUILD_D _snapToBorderCheckbox->setState(confGetBool("snaptoborder", true)); #else _snapToBorderCheckbox->setState(confGetBool("snaptoborder", false)); #endif _showCursorCheckbox->setState(confGetBool("showcursor", true)); _leftHandedCheckbox->setState(confGetBool("lefthanded", false)); _unscaledCheckbox->setState(confGetBool("unscaled", false)); if (ConfMan.hasKey("topscreenzoom", "ds")) { _100PercentCheckbox->setState(false); _150PercentCheckbox->setState(false); _200PercentCheckbox->setState(false); switch (ConfMan.getInt("topscreenzoom", "ds")) { case 100: { _100PercentCheckbox->setState(true); break; } case 150: { _150PercentCheckbox->setState(true); break; } case 200: { _200PercentCheckbox->setState(true); break; } } } else if (ConfMan.hasKey("twohundredpercent", "ds")) { _200PercentCheckbox->setState(ConfMan.getBool("twohundredpercent", "ds")); } else { // No setting _150PercentCheckbox->setState(true); } if (ConfMan.hasKey("gamma", "ds")) { _gammaCorrection->setValue(ConfMan.getInt("gamma", "ds")); } else { _gammaCorrection->setValue(0); } _highQualityAudioCheckbox->setState(confGetBool("22khzaudio", false)); _disablePowerOff->setState(confGetBool("disablepoweroff", false)); #ifdef ALLOW_CPU_SCALER _cpuScaler->setState(confGetBool("cpu_scaler", false)); #endif _indyFightCheckbox->setState(DS::getIndyFightState()); _touchX->setValue(confGetInt("xoffset", 0)); _touchY->setValue(confGetInt("yoffset", 0)); _sensitivity->setValue(confGetInt("sensitivity", 8)); _touchPadStyle->setState(confGetBool("touchpad", false)); _screenTaps->setState(confGetBool("screentaps", false)); _screenTaps->setEnabled(!_touchPadStyle->getState()); _sensitivity->setEnabled(_touchPadStyle->getState()); _sensitivityLabel->setEnabled(_touchPadStyle->getState()); _sensitivityLabel->draw(); if (!_cpuScaler->getState() && !_unscaledCheckbox->getState()) { _hardScaler->setState(true); } _radioButtonMode = true; }
void setOptions() { static bool firstLoad = true; ConfMan.addGameDomain("ds"); DS::setLeftHanded(confGetBool("lefthanded", false)); DS::setMouseCursorVisible(confGetBool("showcursor", true)); #ifdef DS_BUILD_D DS::setSnapToBorder(confGetBool("snaptoborder", true)); #else DS::setSnapToBorder(confGetBool("snaptoborder", false)); #endif DS::setUnscaledMode(confGetBool("unscaled", false)); if (firstLoad) { if (ConfMan.hasKey("topscreenzoom", "ds")) { DS::setTopScreenZoom(ConfMan.getInt("topscreenzoom", "ds")); } else { if (ConfMan.hasKey("twohundredpercent", "ds")) { DS::setTopScreenZoom(200); } else { DS::setTopScreenZoom(150); } } } DS::setTouchXOffset(confGetInt("xoffset", 0)); DS::setTouchYOffset(confGetInt("yoffset", 0)); DS::setSensitivity(confGetInt("sensitivity", 8)); #ifdef ALLOW_CPU_SCALER DS::setCpuScalerEnable(confGetBool("cpu_scaler", false)); #endif DS::setTapScreenClicksEnable(confGetBool("screentaps", false)); DS::setGamma(confGetInt("gamma", 0)); if (ConfMan.hasKey("touchpad", "ds")) { bool enable = ConfMan.getBool("touchpad", "ds"); DS::setTrackPadStyleEnable(enable); if (enable && firstLoad) { // If we've just booted up, want to swap screens when trackpad mode is in use // but not every time we enter the options dialog. DS::setGameScreenSwap(true); } if (enable) { DS::setTapScreenClicksEnable(true); } } else { DS::setTrackPadStyleEnable(false); } firstLoad = false; }