mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-08-10 16:19:59 +00:00
Improve input menu a bit, accept Esc in the designated field, remove "Mic" section from config
This commit is contained in:
parent
798e4c6619
commit
2efc227ad9
6 changed files with 26 additions and 36 deletions
|
@ -480,6 +480,7 @@ AquariaKeyConfig::AquariaKeyConfig(const std::string &actionInputName, InputSetT
|
||||||
|
|
||||||
|
|
||||||
keyDown = false;
|
keyDown = false;
|
||||||
|
acceptEsc = false;
|
||||||
|
|
||||||
toggleEnterKey(false);
|
toggleEnterKey(false);
|
||||||
}
|
}
|
||||||
|
@ -621,8 +622,6 @@ void AquariaKeyConfig::onUpdate(float dt)
|
||||||
{
|
{
|
||||||
if (i != KEY_ESCAPE)
|
if (i != KEY_ESCAPE)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
if (i >= KEY_0 && i <= KEY_9)
|
if (i >= KEY_0 && i <= KEY_9)
|
||||||
{
|
{
|
||||||
*value = i-KEY_0;
|
*value = i-KEY_0;
|
||||||
|
@ -649,7 +648,9 @@ void AquariaKeyConfig::onUpdate(float dt)
|
||||||
{
|
{
|
||||||
if (core->getKeyState(i))
|
if (core->getKeyState(i))
|
||||||
{
|
{
|
||||||
if (i != KEY_ESCAPE)
|
if(*k == i) // clear key if pressed again
|
||||||
|
*k = 0;
|
||||||
|
else if(acceptEsc || i != KEY_ESCAPE)
|
||||||
{
|
{
|
||||||
if (i == KEY_DELETE || i == KEY_BACKSPACE)
|
if (i == KEY_DELETE || i == KEY_BACKSPACE)
|
||||||
*k = 0;
|
*k = 0;
|
||||||
|
@ -750,6 +751,11 @@ void AquariaKeyConfig::onUpdate(float dt)
|
||||||
inLoop = false;
|
inLoop = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AquariaKeyConfig::setAcceptEsc(bool a)
|
||||||
|
{
|
||||||
|
acceptEsc = a;
|
||||||
|
}
|
||||||
|
|
||||||
AquariaMenuItem::AquariaMenuItem() : Quad(), ActionMapper(), AquariaGuiElement()
|
AquariaMenuItem::AquariaMenuItem() : Quad(), ActionMapper(), AquariaGuiElement()
|
||||||
{
|
{
|
||||||
quad = glow = 0;
|
quad = glow = 0;
|
||||||
|
|
|
@ -170,6 +170,8 @@ public:
|
||||||
|
|
||||||
static AquariaKeyConfig *waitingForInput;
|
static AquariaKeyConfig *waitingForInput;
|
||||||
|
|
||||||
|
void setAcceptEsc(bool a);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void toggleEnterKey(int on);
|
void toggleEnterKey(int on);
|
||||||
|
|
||||||
|
@ -181,11 +183,9 @@ protected:
|
||||||
std::string actionInputName;
|
std::string actionInputName;
|
||||||
InputSetType inputSetType;
|
InputSetType inputSetType;
|
||||||
int inputIdx;
|
int inputIdx;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TTFText *keyConfigFont;
|
TTFText *keyConfigFont;
|
||||||
Quad *bg;
|
Quad *bg;
|
||||||
|
bool acceptEsc;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AquariaComboBox;
|
class AquariaComboBox;
|
||||||
|
|
|
@ -1490,7 +1490,7 @@ void InGameMenu::hide(bool effects, bool cancel)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InGameMenu::addKeyConfigLine(RenderObject *group, const std::string &label, const std::string &actionInputName, int y)
|
void InGameMenu::addKeyConfigLine(RenderObject *group, const std::string &label, const std::string &actionInputName, int y, bool acceptEsc)
|
||||||
{
|
{
|
||||||
TTFText *lb = new TTFText(&dsq->fontArialSmallest);
|
TTFText *lb = new TTFText(&dsq->fontArialSmallest);
|
||||||
lb->setText(label);
|
lb->setText(label);
|
||||||
|
@ -1500,10 +1500,12 @@ void InGameMenu::addKeyConfigLine(RenderObject *group, const std::string &label,
|
||||||
AquariaKeyConfig *k1 = new AquariaKeyConfig(actionInputName, INPUTSET_KEY, 0);
|
AquariaKeyConfig *k1 = new AquariaKeyConfig(actionInputName, INPUTSET_KEY, 0);
|
||||||
k1->position = Vector(350,y);
|
k1->position = Vector(350,y);
|
||||||
group->addChild(k1, PM_POINTER);
|
group->addChild(k1, PM_POINTER);
|
||||||
|
k1->setAcceptEsc(acceptEsc);
|
||||||
|
|
||||||
AquariaKeyConfig *k2 = new AquariaKeyConfig(actionInputName, INPUTSET_KEY, 1);
|
AquariaKeyConfig *k2 = new AquariaKeyConfig(actionInputName, INPUTSET_KEY, 1);
|
||||||
k2->position = Vector(475,y);
|
k2->position = Vector(475,y);
|
||||||
group->addChild(k2, PM_POINTER);
|
group->addChild(k2, PM_POINTER);
|
||||||
|
k2->setAcceptEsc(acceptEsc);
|
||||||
|
|
||||||
AquariaKeyConfig *j1 = new AquariaKeyConfig(actionInputName, INPUTSET_JOY, 0);
|
AquariaKeyConfig *j1 = new AquariaKeyConfig(actionInputName, INPUTSET_JOY, 0);
|
||||||
j1->position = Vector(600,y);
|
j1->position = Vector(600,y);
|
||||||
|
@ -1763,8 +1765,6 @@ void InGameMenu::create()
|
||||||
flipInputButtonsCheck->position = Vector(checkx,checky);
|
flipInputButtonsCheck->position = Vector(checkx,checky);
|
||||||
options->addChild(flipInputButtonsCheck, PM_POINTER);
|
options->addChild(flipInputButtonsCheck, PM_POINTER);
|
||||||
|
|
||||||
micInputCheck = 0;
|
|
||||||
|
|
||||||
toolTipsCheck = new AquariaCheckBox();
|
toolTipsCheck = new AquariaCheckBox();
|
||||||
toolTipsCheck->setValue(dsq->user.control.toolTipsOn);
|
toolTipsCheck->setValue(dsq->user.control.toolTipsOn);
|
||||||
toolTipsCheck->position = Vector(checkx,checky+1*checkd);
|
toolTipsCheck->position = Vector(checkx,checky+1*checkd);
|
||||||
|
@ -1965,7 +1965,7 @@ void InGameMenu::create()
|
||||||
addKeyConfigLine(group_keyConfig, SB(2113), "Roll", 260+offy);
|
addKeyConfigLine(group_keyConfig, SB(2113), "Roll", 260+offy);
|
||||||
addKeyConfigLine(group_keyConfig, SB(2114), "Revert", 280+offy);
|
addKeyConfigLine(group_keyConfig, SB(2114), "Revert", 280+offy);
|
||||||
addKeyConfigLine(group_keyConfig, SB(2115), "WorldMap", 300+offy);
|
addKeyConfigLine(group_keyConfig, SB(2115), "WorldMap", 300+offy);
|
||||||
addKeyConfigLine(group_keyConfig, SB(2116), "Escape", 320+offy);
|
addKeyConfigLine(group_keyConfig, SB(2116), "Escape", 320+offy, true);
|
||||||
|
|
||||||
AquariaKeyConfig* s1x = addAxesConfigLine(group_keyConfig, SB(2117), "s1ax", 340+offy, 0);
|
AquariaKeyConfig* s1x = addAxesConfigLine(group_keyConfig, SB(2117), "s1ax", 340+offy, 0);
|
||||||
AquariaKeyConfig* s1y = addAxesConfigLine(group_keyConfig, SB(2118), "s1ay", 340+offy, 130);
|
AquariaKeyConfig* s1y = addAxesConfigLine(group_keyConfig, SB(2118), "s1ay", 340+offy, 130);
|
||||||
|
@ -3686,9 +3686,6 @@ void InGameMenu::toggleOptionsMenu(bool f, bool skipBackup, bool isKeyConfig)
|
||||||
if (ripplesCheck)
|
if (ripplesCheck)
|
||||||
ripplesCheck->setValue(core->afterEffectManager!=0);
|
ripplesCheck->setValue(core->afterEffectManager!=0);
|
||||||
|
|
||||||
if (micInputCheck)
|
|
||||||
micInputCheck->setValue(dsq->user.audio.micOn);
|
|
||||||
|
|
||||||
if (resBox)
|
if (resBox)
|
||||||
{
|
{
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
|
@ -3802,9 +3799,6 @@ void InGameMenu::updateOptionsMenu(float dt)
|
||||||
dsq->user.audio.sfxvol = sfxslider->getValue();
|
dsq->user.audio.sfxvol = sfxslider->getValue();
|
||||||
dsq->user.audio.musvol = musslider->getValue();
|
dsq->user.audio.musvol = musslider->getValue();
|
||||||
|
|
||||||
if (micInputCheck)
|
|
||||||
dsq->user.audio.micOn = micInputCheck->getValue();
|
|
||||||
|
|
||||||
dsq->user.control.flipInputButtons = flipInputButtonsCheck->getValue();
|
dsq->user.control.flipInputButtons = flipInputButtonsCheck->getValue();
|
||||||
dsq->user.control.toolTipsOn = toolTipsCheck->getValue();
|
dsq->user.control.toolTipsOn = toolTipsCheck->getValue();
|
||||||
dsq->user.control.autoAim = autoAimCheck->getValue();
|
dsq->user.control.autoAim = autoAimCheck->getValue();
|
||||||
|
@ -3832,15 +3826,18 @@ void InGameMenu::updateOptionsMenu(float dt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool apply = false;
|
||||||
optsfxdly += dt;
|
optsfxdly += dt;
|
||||||
if (sfxslider->hadInput())
|
if (sfxslider->hadInput())
|
||||||
{
|
{
|
||||||
dsq->sound->playSfx("denied");
|
dsq->sound->playSfx("denied");
|
||||||
|
apply = true;
|
||||||
}
|
}
|
||||||
else if (voxslider->hadInput())
|
else if (voxslider->hadInput())
|
||||||
{
|
{
|
||||||
if (!dsq->sound->isPlayingVoice())
|
if (!dsq->sound->isPlayingVoice())
|
||||||
dsq->voice("naija_somethingfamiliar");
|
dsq->voice("naija_somethingfamiliar");
|
||||||
|
apply = true;
|
||||||
}
|
}
|
||||||
else if (optsfxdly > 0.6f)
|
else if (optsfxdly > 0.6f)
|
||||||
{
|
{
|
||||||
|
@ -3849,6 +3846,7 @@ void InGameMenu::updateOptionsMenu(float dt)
|
||||||
{
|
{
|
||||||
dsq->sound->playSfx("denied");
|
dsq->sound->playSfx("denied");
|
||||||
dsq->loops.updateVolume();
|
dsq->loops.updateVolume();
|
||||||
|
apply = true;
|
||||||
}
|
}
|
||||||
if (voxslider->isGrabbed())
|
if (voxslider->isGrabbed())
|
||||||
{
|
{
|
||||||
|
@ -3856,10 +3854,12 @@ void InGameMenu::updateOptionsMenu(float dt)
|
||||||
{
|
{
|
||||||
dsq->voice("naija_somethingfamiliar");
|
dsq->voice("naija_somethingfamiliar");
|
||||||
}
|
}
|
||||||
|
apply = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dsq->user.apply();
|
if(apply)
|
||||||
|
dsq->user.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InGameMenu::update(float dt)
|
void InGameMenu::update(float dt)
|
||||||
|
|
|
@ -188,14 +188,14 @@ private:
|
||||||
|
|
||||||
void onKeyConfig();
|
void onKeyConfig();
|
||||||
|
|
||||||
void addKeyConfigLine(RenderObject *group, const std::string &label, const std::string &actionInputName, int y);
|
void addKeyConfigLine(RenderObject *group, const std::string &label, const std::string &actionInputName, int y, bool acceptEsc = false);
|
||||||
|
|
||||||
AquariaKeyConfig *addAxesConfigLine(RenderObject *group, const std::string &label, const std::string &actionInputName, int y, int offx);
|
AquariaKeyConfig *addAxesConfigLine(RenderObject *group, const std::string &label, const std::string &actionInputName, int y, int offx);
|
||||||
|
|
||||||
void onOptionsSave();
|
void onOptionsSave();
|
||||||
void onOptionsCancel();
|
void onOptionsCancel();
|
||||||
AquariaSlider *sfxslider, *musslider, *voxslider;
|
AquariaSlider *sfxslider, *musslider, *voxslider;
|
||||||
AquariaCheckBox *autoAimCheck, *targetingCheck, *toolTipsCheck, *flipInputButtonsCheck, *micInputCheck, *blurEffectsCheck;
|
AquariaCheckBox *autoAimCheck, *targetingCheck, *toolTipsCheck, *flipInputButtonsCheck, *blurEffectsCheck;
|
||||||
AquariaCheckBox *subtitlesCheck, *fullscreenCheck, *ripplesCheck;
|
AquariaCheckBox *subtitlesCheck, *fullscreenCheck, *ripplesCheck;
|
||||||
AquariaComboBox *resBox;
|
AquariaComboBox *resBox;
|
||||||
Quad *songBubbles, *energyIdol, *liCrystal;
|
Quad *songBubbles, *energyIdol, *liCrystal;
|
||||||
|
|
|
@ -68,13 +68,6 @@ void UserSettings::save()
|
||||||
|
|
||||||
XMLElement *xml_audio = doc.NewElement("Audio");
|
XMLElement *xml_audio = doc.NewElement("Audio");
|
||||||
{
|
{
|
||||||
XMLElement *xml_microphone = doc.NewElement("Mic");
|
|
||||||
{
|
|
||||||
xml_microphone->SetAttribute("on", audio.micOn);
|
|
||||||
xml_microphone->SetAttribute("octave", audio.octave);
|
|
||||||
}
|
|
||||||
xml_audio->InsertEndChild(xml_microphone);
|
|
||||||
|
|
||||||
XMLElement *xml_volume = doc.NewElement("Volume");
|
XMLElement *xml_volume = doc.NewElement("Volume");
|
||||||
{
|
{
|
||||||
xml_volume->SetAttribute("sfx", double(audio.sfxvol));
|
xml_volume->SetAttribute("sfx", double(audio.sfxvol));
|
||||||
|
@ -372,13 +365,6 @@ void UserSettings::load(bool doApply, const std::string &overrideFile)
|
||||||
XMLElement *xml_audio = doc.FirstChildElement("Audio");
|
XMLElement *xml_audio = doc.FirstChildElement("Audio");
|
||||||
if (xml_audio)
|
if (xml_audio)
|
||||||
{
|
{
|
||||||
XMLElement *xml_microphone = xml_audio->FirstChildElement("Mic");
|
|
||||||
if (xml_microphone)
|
|
||||||
{
|
|
||||||
audio.micOn = xml_microphone->IntAttribute("on");
|
|
||||||
audio.octave = xml_microphone->IntAttribute("octave");
|
|
||||||
}
|
|
||||||
|
|
||||||
XMLElement *xml_volume = xml_audio->FirstChildElement("Volume");
|
XMLElement *xml_volume = xml_audio->FirstChildElement("Volume");
|
||||||
if (xml_volume)
|
if (xml_volume)
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,9 +46,7 @@ public:
|
||||||
|
|
||||||
struct Audio
|
struct Audio
|
||||||
{
|
{
|
||||||
Audio() { micOn = 0; octave=0; musvol=voxvol=sfxvol=1.0; subtitles=false; prebuffer=false;}
|
Audio() { musvol=voxvol=sfxvol=1.0; subtitles=false; prebuffer=false;}
|
||||||
int micOn;
|
|
||||||
int octave;
|
|
||||||
float voxvol, sfxvol, musvol;
|
float voxvol, sfxvol, musvol;
|
||||||
int subtitles;
|
int subtitles;
|
||||||
std::string deviceName;
|
std::string deviceName;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue