mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-01-24 17:26:41 +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)
|
||||
{
|
||||
currentFocus = this;
|
||||
if (dsq->inputMode == INPUT_JOYSTICK || dsq->inputMode == INPUT_KEYBOARD)
|
||||
if (dsq->getInputMode() == INPUT_JOYSTICK || dsq->getInputMode() == INPUT_KEYBOARD)
|
||||
core->setMousePosition(getGuiPosition());
|
||||
|
||||
AquariaGuiElement *gui=0, *guiThis = (AquariaGuiElement*)this;
|
||||
|
|
|
@ -163,7 +163,7 @@ void Avatar::bindInput()
|
|||
Vector Avatar::getAim()
|
||||
{
|
||||
Vector d;
|
||||
if (dsq->inputMode == INPUT_JOYSTICK)
|
||||
if (dsq->getInputMode() == INPUT_JOYSTICK)
|
||||
{
|
||||
for(size_t i = 0; i < core->getNumJoysticks(); ++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 (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)
|
||||
{
|
||||
|
@ -1756,7 +1756,7 @@ void Avatar::updateSingingInterface(float dt)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (dsq->inputMode == INPUT_JOYSTICK)
|
||||
if (dsq->getInputMode() == INPUT_JOYSTICK)
|
||||
{
|
||||
Vector d;
|
||||
for(size_t i = 0; i < core->getNumJoysticks(); ++i)
|
||||
|
@ -1948,7 +1948,7 @@ void Avatar::updateTargets(float dt, bool override)
|
|||
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;
|
||||
float mod = 1;
|
||||
|
|
|
@ -142,7 +142,7 @@ const bool isReleaseCandidate = false;
|
|||
const bool isFinalCandidate = false;
|
||||
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!
|
||||
#define PARTICLE_AMOUNT_DEFAULT 2048
|
||||
|
@ -2605,7 +2605,6 @@ void DSQ::createSaveSlots(SaveSlotMode ssm)
|
|||
|
||||
|
||||
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.interpolateTo(1, t);
|
||||
menu[1]->scale = savesz * 0.5f;
|
||||
|
@ -4560,3 +4559,30 @@ void DSQ::loadStringBank()
|
|||
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;
|
||||
|
||||
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);
|
||||
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 vision(std::string folder, int num, bool ignoreMusic = false);
|
||||
|
|
|
@ -646,7 +646,7 @@ void FoodSlot::onUpdate(float dt)
|
|||
{
|
||||
if (!themenu->recipeMenu.on)
|
||||
{
|
||||
if (dsq->inputMode == INPUT_MOUSE)
|
||||
if (dsq->getInputMode() == INPUT_MOUSE)
|
||||
{
|
||||
Vector diff = core->mouse.position - getWorldPosition();
|
||||
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);
|
||||
if(closest)
|
||||
|
|
|
@ -8396,7 +8396,8 @@ luaFunc(disableInput)
|
|||
|
||||
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)
|
||||
|
|
|
@ -66,4 +66,12 @@ enum InputSetType
|
|||
INPUTSET_OTHER = 4
|
||||
};
|
||||
|
||||
enum InputDevice
|
||||
{
|
||||
INPUT_NODEVICE = 0,
|
||||
INPUT_MOUSE,
|
||||
INPUT_JOYSTICK,
|
||||
INPUT_KEYBOARD
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,14 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define _actionmapper_
|
||||
|
||||
#include "Base.h"
|
||||
|
||||
enum InputDevice
|
||||
{
|
||||
INPUT_NODEVICE = 0,
|
||||
INPUT_MOUSE,
|
||||
INPUT_JOYSTICK,
|
||||
INPUT_KEYBOARD
|
||||
};
|
||||
#include "ActionInput.h"
|
||||
|
||||
InputDevice getDeviceForActionbutton(int k);
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ JoystickConfig::JoystickConfig()
|
|||
|
||||
ActionSet::ActionSet()
|
||||
{
|
||||
inputMode = INPUT_NODEVICE;
|
||||
enabled = true;
|
||||
joystickID = ACTIONSET_REASSIGN_JOYSTICK;
|
||||
}
|
||||
|
|
|
@ -59,6 +59,7 @@ public:
|
|||
ActionInput *addActionInput(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
|
||||
|
||||
// --- Saved in config ---
|
||||
|
|
Loading…
Reference in a new issue