early-access version 1409

This commit is contained in:
pineappleEA
2021-02-03 23:00:31 +01:00
parent 3714ae3791
commit baa567a60d
21 changed files with 435 additions and 269 deletions

View File

@@ -139,6 +139,10 @@ public:
static_cast<float>(y) * coef * (x == 0 ? 1.0f : SQRT_HALF));
}
Input::AnalogProperties GetAnalogProperties() const override {
return {modifier_scale, 1.0f, 0.5f};
}
bool GetAnalogDirectionStatus(Input::AnalogDirection direction) const override {
switch (direction) {
case Input::AnalogDirection::RIGHT:

View File

@@ -2,6 +2,7 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "core/settings.h"
#include "input_common/mouse/mouse_input.h"
namespace MouseInput {
@@ -65,8 +66,21 @@ void Mouse::PressButton(int x, int y, int button_) {
mouse_info[button_index].data.pressed = true;
}
void Mouse::MouseMove(int x, int y) {
void Mouse::MouseMove(int x, int y, int center_x, int center_y) {
for (MouseInfo& info : mouse_info) {
if (Settings::values.mouse_panning) {
const auto mouse_change = Common::MakeVec(x, y) - Common::MakeVec(center_x, center_y);
info.data.axis = {mouse_change.x, -mouse_change.y};
if (mouse_change.x == 0 && mouse_change.y == 0) {
info.tilt_speed = 0;
} else {
info.tilt_direction = mouse_change.Cast<float>();
info.tilt_speed = info.tilt_direction.Normalize() * info.sensitivity;
}
continue;
}
if (info.data.pressed) {
const auto mouse_move = Common::MakeVec(x, y) - info.mouse_origin;
const auto mouse_change = Common::MakeVec(x, y) - info.last_mouse_position;

View File

@@ -57,8 +57,10 @@ public:
* Signals that mouse has moved.
* @param x the x-coordinate of the cursor
* @param y the y-coordinate of the cursor
* @param center_x the x-coordinate of the middle of the screen
* @param center_y the y-coordinate of the middle of the screen
*/
void MouseMove(int x, int y);
void MouseMove(int x, int y, int center_x, int center_y);
/**
* Signals that a motion sensor tilt has ended.

View File

@@ -6,6 +6,7 @@
#include <utility>
#include "common/threadsafe_queue.h"
#include "core/settings.h"
#include "input_common/mouse/mouse_input.h"
#include "input_common/mouse/mouse_poller.h"
@@ -71,7 +72,7 @@ public:
std::lock_guard lock{mutex};
const auto axis_value =
static_cast<float>(mouse_input->GetMouseState(button).axis.at(axis));
return axis_value / (100.0f * range);
return axis_value * Settings::values.mouse_panning_sensitivity / (100.0f * range);
}
std::pair<float, float> GetAnalog(u32 analog_axis_x, u32 analog_axis_y) const {
@@ -106,6 +107,16 @@ public:
return {0.0f, 0.0f};
}
std::tuple<float, float> GetRawStatus() const override {
const float x = GetAxis(axis_x);
const float y = GetAxis(axis_y);
return {x, y};
}
Input::AnalogProperties GetAnalogProperties() const override {
return {deadzone, range, 0.5f};
}
private:
const u32 button;
const u32 axis_x;