2017-08-06 16:04:06 -05:00
|
|
|
// Copyright 2017 Citra Emulator Project
|
2016-12-11 15:32:41 -06:00
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
2017-08-08 19:05:03 -05:00
|
|
|
|
2017-08-06 16:04:06 -05:00
|
|
|
#include "core/frontend/input.h"
|
2016-12-11 15:32:41 -06:00
|
|
|
|
2017-08-06 16:04:06 -05:00
|
|
|
namespace InputCommon {
|
2016-12-11 15:32:41 -06:00
|
|
|
|
2017-08-06 16:04:06 -05:00
|
|
|
class MotionEmuDevice;
|
2016-12-11 15:32:41 -06:00
|
|
|
|
2017-08-06 16:04:06 -05:00
|
|
|
class MotionEmu : public Input::Factory<Input::MotionDevice> {
|
2016-12-11 15:32:41 -06:00
|
|
|
public:
|
2017-08-06 16:04:06 -05:00
|
|
|
/**
|
|
|
|
* Creates a motion device emulated from mouse input
|
|
|
|
* @param params contains parameters for creating the device:
|
|
|
|
* - "update_period": update period in milliseconds
|
|
|
|
* - "sensitivity": the coefficient converting mouse movement to tilting angle
|
|
|
|
*/
|
|
|
|
std::unique_ptr<Input::MotionDevice> Create(const Common::ParamPackage& params) override;
|
2016-12-11 15:32:41 -06:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Signals that a motion sensor tilt has begun.
|
|
|
|
* @param x the x-coordinate of the cursor
|
|
|
|
* @param y the y-coordinate of the cursor
|
|
|
|
*/
|
|
|
|
void BeginTilt(int x, int y);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Signals that a motion sensor tilt is occurring.
|
|
|
|
* @param x the x-coordinate of the cursor
|
|
|
|
* @param y the y-coordinate of the cursor
|
|
|
|
*/
|
|
|
|
void Tilt(int x, int y);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Signals that a motion sensor tilt has ended.
|
|
|
|
*/
|
|
|
|
void EndTilt();
|
|
|
|
|
|
|
|
private:
|
2017-08-06 16:04:06 -05:00
|
|
|
std::weak_ptr<MotionEmuDevice> current_device;
|
2016-12-11 15:32:41 -06:00
|
|
|
};
|
|
|
|
|
2017-08-06 16:04:06 -05:00
|
|
|
} // namespace InputCommon
|