dolphin/Source/Core/Core/HW/GCPadEmu.h
Lioncash 6a75ea5653 ControllerEmu: Separate ControlGroup from ControllerEmu
ControllerEmu, the class, is essentially acting like a namespace for
ControlGroup. This makes it impossible to forward declare any of the
internals. It also globs a bunch of classes together which is kind of a
pain to manage.

This splits ControlGroup and the classes it contains into their own source
files and situates them all within a namespace, which gets them out of
global scope.

Since this allows forward declarations for the once-internal classes, it
now requires significantly less files to be rebuilt if anything is changed
in the ControllerEmu portion of code.

It does not split out the settings classes yet, however, as it
would be preferable to make a settings base class that all settings derive
from, but this would be a functional change -- this commit only intends to
move around existing code. Extracting the settings class will be done in
another commit.
2017-02-09 18:18:52 -05:00

63 lines
1.3 KiB
C++

// Copyright 2010 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <string>
#include "InputCommon/ControllerEmu/ControllerEmu.h"
struct GCPadStatus;
namespace ControllerEmu
{
class AnalogStick;
class Buttons;
class ControlGroup;
class MixedTriggers;
}
enum class PadGroup
{
Buttons,
MainStick,
CStick,
DPad,
Triggers,
Rumble,
Mic,
Options
};
class GCPad : public ControllerEmu::EmulatedController
{
public:
explicit GCPad(unsigned int index);
GCPadStatus GetInput() const;
void SetOutput(const ControlState strength);
bool GetMicButton() const;
std::string GetName() const override;
ControllerEmu::ControlGroup* GetGroup(PadGroup group);
void LoadDefaults(const ControllerInterface& ciface) override;
private:
ControllerEmu::Buttons* m_buttons;
ControllerEmu::AnalogStick* m_main_stick;
ControllerEmu::AnalogStick* m_c_stick;
ControllerEmu::Buttons* m_dpad;
ControllerEmu::MixedTriggers* m_triggers;
ControllerEmu::ControlGroup* m_rumble;
ControllerEmu::Buttons* m_mic;
ControllerEmu::ControlGroup* m_options;
const unsigned int m_index;
// Default analog stick radius for GameCube controllers.
static constexpr ControlState DEFAULT_PAD_STICK_RADIUS = 1.0;
};