mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-06-08 01:22:02 +00:00
temp commit
This commit is contained in:
parent
8f565c6171
commit
5f2eafad7c
11 changed files with 57 additions and 19 deletions
|
@ -89,7 +89,7 @@ void AquariaGuiElement::setFocus(bool v)
|
||||||
if (v)
|
if (v)
|
||||||
{
|
{
|
||||||
currentFocus = this;
|
currentFocus = this;
|
||||||
if (dsq->inputMode == INPUT_JOYSTICK || dsq->inputMode == INPUT_KEYBOARD)
|
if (dsq->getInputMode() == INPUT_JOYSTICK || dsq->getInputMode() == INPUT_KEYBOARD)
|
||||||
core->setMousePosition(getGuiPosition());
|
core->setMousePosition(getGuiPosition());
|
||||||
|
|
||||||
AquariaGuiElement *gui=0, *guiThis = (AquariaGuiElement*)this;
|
AquariaGuiElement *gui=0, *guiThis = (AquariaGuiElement*)this;
|
||||||
|
|
|
@ -163,7 +163,7 @@ void Avatar::bindInput()
|
||||||
Vector Avatar::getAim()
|
Vector Avatar::getAim()
|
||||||
{
|
{
|
||||||
Vector d;
|
Vector d;
|
||||||
if (dsq->inputMode == INPUT_JOYSTICK)
|
if (dsq->getInputMode() == INPUT_JOYSTICK)
|
||||||
{
|
{
|
||||||
for(size_t i = 0; i < core->getNumJoysticks(); ++i)
|
for(size_t i = 0; i < core->getNumJoysticks(); ++i)
|
||||||
if(Joystick *j = core->getJoystick(i))
|
if(Joystick *j = core->getJoystick(i))
|
||||||
|
@ -1730,7 +1730,7 @@ void Avatar::updateSingingInterface(float dt)
|
||||||
{
|
{
|
||||||
if (songIcons.size()>0 && songIcons[0]->alpha.x > 0)
|
if (songIcons.size()>0 && songIcons[0]->alpha.x > 0)
|
||||||
{
|
{
|
||||||
if (dsq->inputMode != INPUT_JOYSTICK && !core->mouse.change.isZero())
|
if (dsq->getInputMode() != INPUT_JOYSTICK && !core->mouse.change.isZero())
|
||||||
{
|
{
|
||||||
if (dsq->game->songLineRender && songIcons[0]->alpha.x == 1)
|
if (dsq->game->songLineRender && songIcons[0]->alpha.x == 1)
|
||||||
{
|
{
|
||||||
|
@ -1756,7 +1756,7 @@ void Avatar::updateSingingInterface(float dt)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (dsq->inputMode == INPUT_JOYSTICK)
|
if (dsq->getInputMode() == INPUT_JOYSTICK)
|
||||||
{
|
{
|
||||||
Vector d;
|
Vector d;
|
||||||
for(size_t i = 0; i < core->getNumJoysticks(); ++i)
|
for(size_t i = 0; i < core->getNumJoysticks(); ++i)
|
||||||
|
@ -1948,7 +1948,7 @@ void Avatar::updateTargets(float dt, bool override)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((dsq->inputMode == INPUT_MOUSE || dsq->inputMode == INPUT_KEYBOARD) && !(wasDown && core->mouse.buttons.right))
|
if ((dsq->getInputMode() == INPUT_MOUSE || dsq->getInputMode() == INPUT_KEYBOARD) && !(wasDown && core->mouse.buttons.right))
|
||||||
{
|
{
|
||||||
wasDown = false;
|
wasDown = false;
|
||||||
float mod = 1;
|
float mod = 1;
|
||||||
|
|
|
@ -142,7 +142,7 @@ const bool isReleaseCandidate = false;
|
||||||
const bool isFinalCandidate = false;
|
const bool isFinalCandidate = false;
|
||||||
const bool isGoldMaster = true;
|
const bool isGoldMaster = true;
|
||||||
|
|
||||||
Vector savesz;
|
static const Vector savesz(750.0f/1024.0f, 750.0f/1024.0f);
|
||||||
|
|
||||||
/// WARNING: this is just to init, the actual value is set from user settings!
|
/// WARNING: this is just to init, the actual value is set from user settings!
|
||||||
#define PARTICLE_AMOUNT_DEFAULT 2048
|
#define PARTICLE_AMOUNT_DEFAULT 2048
|
||||||
|
@ -2605,7 +2605,6 @@ void DSQ::createSaveSlots(SaveSlotMode ssm)
|
||||||
|
|
||||||
|
|
||||||
menu[1] = new Quad("gui/save-menu", Vector(400,300));
|
menu[1] = new Quad("gui/save-menu", Vector(400,300));
|
||||||
savesz = Vector(750.0f/1024.0f, 750.0f/1024.0f);
|
|
||||||
menu[1]->alpha = 0;
|
menu[1]->alpha = 0;
|
||||||
menu[1]->alpha.interpolateTo(1, t);
|
menu[1]->alpha.interpolateTo(1, t);
|
||||||
menu[1]->scale = savesz * 0.5f;
|
menu[1]->scale = savesz * 0.5f;
|
||||||
|
@ -4560,3 +4559,30 @@ void DSQ::loadStringBank()
|
||||||
stringbank.load(fname);
|
stringbank.load(fname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
InputDevice DSQ::getInputMode() const
|
||||||
|
{
|
||||||
|
return lastInputMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
InputDevice DSQ::getInputMode(int source) const
|
||||||
|
{
|
||||||
|
assert(source >= 0 && size_t(source) < _inputModes.size());
|
||||||
|
return _inputModes[source];
|
||||||
|
}
|
||||||
|
|
||||||
|
void DSQ::getInputModeSafe(int source) const
|
||||||
|
{
|
||||||
|
return source < 0 ? lastInputMode :
|
||||||
|
(size_t(source) < _inputModes.size() ? _inputModes[source] : INPUT_NODEVICE);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DSQ::useMouseInput() const
|
||||||
|
{
|
||||||
|
return lastInputMode == INPUT_MOUSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DSQ::useJoystickInput() const
|
||||||
|
{
|
||||||
|
return lastInputMode == INPUT_JOYSTICK;
|
||||||
|
}
|
|
@ -347,8 +347,16 @@ public:
|
||||||
|
|
||||||
InterpolatedVector gameSpeed;
|
InterpolatedVector gameSpeed;
|
||||||
|
|
||||||
InputDevice inputMode;
|
private:
|
||||||
|
InputDevice lastInputMode; // really don't want to expose this one
|
||||||
|
std::vector<InputDevice> _inputModes; // index: FIXME ADD INFO
|
||||||
|
public:
|
||||||
void setInputMode(InputDevice mode);
|
void setInputMode(InputDevice mode);
|
||||||
|
InputDevice getInputMode() const;
|
||||||
|
InputDevice getInputMode(int source) const;
|
||||||
|
InputDevice getInputModeSafe(int source) const;
|
||||||
|
bool useMouseInput() const;
|
||||||
|
bool useJoystickInput() const;
|
||||||
|
|
||||||
void rumble(float leftMotor, float rightMotor, float time, int source, InputDevice device);
|
void rumble(float leftMotor, float rightMotor, float time, int source, InputDevice device);
|
||||||
void vision(std::string folder, int num, bool ignoreMusic = false);
|
void vision(std::string folder, int num, bool ignoreMusic = false);
|
||||||
|
|
|
@ -646,7 +646,7 @@ void FoodSlot::onUpdate(float dt)
|
||||||
{
|
{
|
||||||
if (!themenu->recipeMenu.on)
|
if (!themenu->recipeMenu.on)
|
||||||
{
|
{
|
||||||
if (dsq->inputMode == INPUT_MOUSE)
|
if (dsq->getInputMode() == INPUT_MOUSE)
|
||||||
{
|
{
|
||||||
Vector diff = core->mouse.position - getWorldPosition();
|
Vector diff = core->mouse.position - getWorldPosition();
|
||||||
position += diff;
|
position += diff;
|
||||||
|
|
|
@ -120,7 +120,7 @@ void ModSelectorScreen::onUpdate(float dt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!AquariaGuiElement::currentFocus && dsq->inputMode == INPUT_JOYSTICK)
|
if(!AquariaGuiElement::currentFocus && dsq->getInputMode() == INPUT_JOYSTICK)
|
||||||
{
|
{
|
||||||
AquariaGuiElement *closest = AquariaGuiElement::getClosestGuiElement(core->mouse.position);
|
AquariaGuiElement *closest = AquariaGuiElement::getClosestGuiElement(core->mouse.position);
|
||||||
if(closest)
|
if(closest)
|
||||||
|
|
|
@ -8396,7 +8396,8 @@ luaFunc(disableInput)
|
||||||
|
|
||||||
luaFunc(getInputMode)
|
luaFunc(getInputMode)
|
||||||
{
|
{
|
||||||
luaReturnInt(dsq->inputMode);
|
int source = lua_tointeger(L, 1);
|
||||||
|
luaReturnInt(dsq->getInputModeSafe(source - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Joystick *_getJoystick(lua_State *L, int idx = 1)
|
static Joystick *_getJoystick(lua_State *L, int idx = 1)
|
||||||
|
|
|
@ -66,4 +66,12 @@ enum InputSetType
|
||||||
INPUTSET_OTHER = 4
|
INPUTSET_OTHER = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum InputDevice
|
||||||
|
{
|
||||||
|
INPUT_NODEVICE = 0,
|
||||||
|
INPUT_MOUSE,
|
||||||
|
INPUT_JOYSTICK,
|
||||||
|
INPUT_KEYBOARD
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -22,14 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#define _actionmapper_
|
#define _actionmapper_
|
||||||
|
|
||||||
#include "Base.h"
|
#include "Base.h"
|
||||||
|
#include "ActionInput.h"
|
||||||
enum InputDevice
|
|
||||||
{
|
|
||||||
INPUT_NODEVICE = 0,
|
|
||||||
INPUT_MOUSE,
|
|
||||||
INPUT_JOYSTICK,
|
|
||||||
INPUT_KEYBOARD
|
|
||||||
};
|
|
||||||
|
|
||||||
InputDevice getDeviceForActionbutton(int k);
|
InputDevice getDeviceForActionbutton(int k);
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ JoystickConfig::JoystickConfig()
|
||||||
|
|
||||||
ActionSet::ActionSet()
|
ActionSet::ActionSet()
|
||||||
{
|
{
|
||||||
|
inputMode = INPUT_NODEVICE;
|
||||||
enabled = true;
|
enabled = true;
|
||||||
joystickID = ACTIONSET_REASSIGN_JOYSTICK;
|
joystickID = ACTIONSET_REASSIGN_JOYSTICK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,6 +59,7 @@ public:
|
||||||
ActionInput *addActionInput(const std::string &name);
|
ActionInput *addActionInput(const std::string &name);
|
||||||
ActionInput *getActionInputByName(const std::string &name);
|
ActionInput *getActionInputByName(const std::string &name);
|
||||||
|
|
||||||
|
InputDevice inputMode;
|
||||||
size_t joystickID; // >= 0: use that, -1 = no joystick, or ACTIONSET_REASSIGN_JOYSTICK
|
size_t joystickID; // >= 0: use that, -1 = no joystick, or ACTIONSET_REASSIGN_JOYSTICK
|
||||||
|
|
||||||
// --- Saved in config ---
|
// --- Saved in config ---
|
||||||
|
|
Loading…
Add table
Reference in a new issue