Controller Interface: Remove "using namespace" in header file.
This commit is contained in:
parent
a9a6270982
commit
b0060e5184
|
@ -218,19 +218,19 @@ void ControlDialog::UpdateListContents()
|
||||||
{
|
{
|
||||||
control_lbox->Clear();
|
control_lbox->Clear();
|
||||||
|
|
||||||
Device* const dev = g_controller_interface.FindDevice(m_devq);
|
ciface::Core::Device* const dev = g_controller_interface.FindDevice(m_devq);
|
||||||
if (dev)
|
if (dev)
|
||||||
{
|
{
|
||||||
if (control_reference->is_input)
|
if (control_reference->is_input)
|
||||||
{
|
{
|
||||||
for (Device::Input* input : dev->Inputs())
|
for (ciface::Core::Device::Input* input : dev->Inputs())
|
||||||
{
|
{
|
||||||
control_lbox->Append(StrToWxStr(input->GetName()));
|
control_lbox->Append(StrToWxStr(input->GetName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // It's an output
|
else // It's an output
|
||||||
{
|
{
|
||||||
for (Device::Output* output : dev->Outputs())
|
for (ciface::Core::Device::Output* output : dev->Outputs())
|
||||||
{
|
{
|
||||||
control_lbox->Append(StrToWxStr(output->GetName()));
|
control_lbox->Append(StrToWxStr(output->GetName()));
|
||||||
}
|
}
|
||||||
|
@ -373,8 +373,8 @@ inline bool IsAlphabetic(wxString &str)
|
||||||
|
|
||||||
inline void GetExpressionForControl(wxString &expr,
|
inline void GetExpressionForControl(wxString &expr,
|
||||||
wxString &control_name,
|
wxString &control_name,
|
||||||
DeviceQualifier *control_device = nullptr,
|
ciface::Core::DeviceQualifier *control_device = nullptr,
|
||||||
DeviceQualifier *default_device = nullptr)
|
ciface::Core::DeviceQualifier *default_device = nullptr)
|
||||||
{
|
{
|
||||||
expr = "";
|
expr = "";
|
||||||
|
|
||||||
|
@ -506,7 +506,7 @@ void ControlDialog::DetectControl(wxCommandEvent& event)
|
||||||
wxButton* const btn = (wxButton*)event.GetEventObject();
|
wxButton* const btn = (wxButton*)event.GetEventObject();
|
||||||
const wxString lbl = btn->GetLabel();
|
const wxString lbl = btn->GetLabel();
|
||||||
|
|
||||||
Device* const dev = g_controller_interface.FindDevice(m_devq);
|
ciface::Core::Device* const dev = g_controller_interface.FindDevice(m_devq);
|
||||||
if (dev)
|
if (dev)
|
||||||
{
|
{
|
||||||
btn->SetLabel(_("[ waiting ]"));
|
btn->SetLabel(_("[ waiting ]"));
|
||||||
|
@ -515,7 +515,7 @@ void ControlDialog::DetectControl(wxCommandEvent& event)
|
||||||
wxTheApp->Yield(true);
|
wxTheApp->Yield(true);
|
||||||
|
|
||||||
std::lock_guard<std::recursive_mutex> lk(m_config.controls_lock);
|
std::lock_guard<std::recursive_mutex> lk(m_config.controls_lock);
|
||||||
Device::Control* const ctrl = control_reference->Detect(DETECT_WAIT_TIME, dev);
|
ciface::Core::Device::Control* const ctrl = control_reference->Detect(DETECT_WAIT_TIME, dev);
|
||||||
|
|
||||||
// if we got input, select it in the list
|
// if we got input, select it in the list
|
||||||
if (ctrl)
|
if (ctrl)
|
||||||
|
@ -546,7 +546,7 @@ bool GamepadPage::DetectButton(ControlButton* button)
|
||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
// find device :/
|
// find device :/
|
||||||
Device* const dev = g_controller_interface.FindDevice(controller->default_device);
|
ciface::Core::Device* const dev = g_controller_interface.FindDevice(controller->default_device);
|
||||||
if (dev)
|
if (dev)
|
||||||
{
|
{
|
||||||
button->SetLabel(_("[ waiting ]"));
|
button->SetLabel(_("[ waiting ]"));
|
||||||
|
@ -555,7 +555,7 @@ bool GamepadPage::DetectButton(ControlButton* button)
|
||||||
wxTheApp->Yield(true);
|
wxTheApp->Yield(true);
|
||||||
|
|
||||||
std::lock_guard<std::recursive_mutex> lk(m_config.controls_lock);
|
std::lock_guard<std::recursive_mutex> lk(m_config.controls_lock);
|
||||||
Device::Control* const ctrl = button->control_reference->Detect(DETECT_WAIT_TIME, dev);
|
ciface::Core::Device::Control* const ctrl = button->control_reference->Detect(DETECT_WAIT_TIME, dev);
|
||||||
|
|
||||||
// if we got input, update expression and reference
|
// if we got input, update expression and reference
|
||||||
if (ctrl)
|
if (ctrl)
|
||||||
|
@ -725,12 +725,12 @@ void GamepadPage::DeleteProfile(wxCommandEvent&)
|
||||||
|
|
||||||
void InputConfigDialog::UpdateDeviceComboBox()
|
void InputConfigDialog::UpdateDeviceComboBox()
|
||||||
{
|
{
|
||||||
DeviceQualifier dq;
|
ciface::Core::DeviceQualifier dq;
|
||||||
for (GamepadPage* page : m_padpages)
|
for (GamepadPage* page : m_padpages)
|
||||||
{
|
{
|
||||||
page->device_cbox->Clear();
|
page->device_cbox->Clear();
|
||||||
|
|
||||||
for (Device* d : g_controller_interface.Devices())
|
for (ciface::Core::Device* d : g_controller_interface.Devices())
|
||||||
{
|
{
|
||||||
dq.FromDevice(d);
|
dq.FromDevice(d);
|
||||||
page->device_cbox->Append(StrToWxStr(dq.ToString()));
|
page->device_cbox->Append(StrToWxStr(dq.ToString()));
|
||||||
|
|
|
@ -124,7 +124,7 @@ private:
|
||||||
GamepadPage* const m_parent;
|
GamepadPage* const m_parent;
|
||||||
wxStaticText* m_bound_label;
|
wxStaticText* m_bound_label;
|
||||||
wxStaticText* m_error_label;
|
wxStaticText* m_error_label;
|
||||||
DeviceQualifier m_devq;
|
ciface::Core::DeviceQualifier m_devq;
|
||||||
bool GetExpressionForSelectedControl(wxString &expr);
|
bool GetExpressionForSelectedControl(wxString &expr);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -442,5 +442,5 @@ public:
|
||||||
|
|
||||||
std::vector<std::unique_ptr<ControlGroup>> groups;
|
std::vector<std::unique_ptr<ControlGroup>> groups;
|
||||||
|
|
||||||
DeviceQualifier default_device;
|
ciface::Core::DeviceQualifier default_device;
|
||||||
};
|
};
|
||||||
|
|
|
@ -81,10 +81,10 @@ void ControllerInterface::Shutdown()
|
||||||
if (!m_is_init)
|
if (!m_is_init)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Device* d : m_devices)
|
for (ciface::Core::Device* d : m_devices)
|
||||||
{
|
{
|
||||||
// Set outputs to ZERO before destroying device
|
// Set outputs to ZERO before destroying device
|
||||||
for (Device::Output* o : d->Outputs())
|
for (ciface::Core::Device::Output* o : d->Outputs())
|
||||||
o->SetState(0);
|
o->SetState(0);
|
||||||
|
|
||||||
// Update output
|
// Update output
|
||||||
|
@ -145,7 +145,7 @@ bool ControllerInterface::UpdateInput(const bool force)
|
||||||
|
|
||||||
size_t ok_count = 0;
|
size_t ok_count = 0;
|
||||||
|
|
||||||
for (Device* d : m_devices)
|
for (ciface::Core::Device* d : m_devices)
|
||||||
{
|
{
|
||||||
if (d->UpdateInput())
|
if (d->UpdateInput())
|
||||||
++ok_count;
|
++ok_count;
|
||||||
|
@ -173,7 +173,7 @@ bool ControllerInterface::UpdateOutput(const bool force)
|
||||||
|
|
||||||
size_t ok_count = 0;
|
size_t ok_count = 0;
|
||||||
|
|
||||||
for (Device* d : m_devices)
|
for (ciface::Core::Device* d : m_devices)
|
||||||
{
|
{
|
||||||
if (d->UpdateOutput())
|
if (d->UpdateOutput())
|
||||||
++ok_count;
|
++ok_count;
|
||||||
|
@ -217,7 +217,7 @@ ControlState ControllerInterface::OutputReference::State(const ControlState stat
|
||||||
// need to call this to re-parse a control reference's expression after changing it
|
// need to call this to re-parse a control reference's expression after changing it
|
||||||
//
|
//
|
||||||
void ControllerInterface::UpdateReference(ControllerInterface::ControlReference* ref
|
void ControllerInterface::UpdateReference(ControllerInterface::ControlReference* ref
|
||||||
, const DeviceQualifier& default_device) const
|
, const ciface::Core::DeviceQualifier& default_device) const
|
||||||
{
|
{
|
||||||
delete ref->parsed_expression;
|
delete ref->parsed_expression;
|
||||||
ref->parsed_expression = nullptr;
|
ref->parsed_expression = nullptr;
|
||||||
|
@ -236,7 +236,7 @@ void ControllerInterface::UpdateReference(ControllerInterface::ControlReference*
|
||||||
// upon input, return pointer to detected Control
|
// upon input, return pointer to detected Control
|
||||||
// else return nullptr
|
// else return nullptr
|
||||||
//
|
//
|
||||||
Device::Control* ControllerInterface::InputReference::Detect(const unsigned int ms, Device* const device)
|
ciface::Core::Device::Control* ControllerInterface::InputReference::Detect(const unsigned int ms, ciface::Core::Device* const device)
|
||||||
{
|
{
|
||||||
unsigned int time = 0;
|
unsigned int time = 0;
|
||||||
std::vector<bool> states(device->Inputs().size());
|
std::vector<bool> states(device->Inputs().size());
|
||||||
|
@ -246,7 +246,7 @@ Device::Control* ControllerInterface::InputReference::Detect(const unsigned int
|
||||||
|
|
||||||
// get starting state of all inputs,
|
// get starting state of all inputs,
|
||||||
// so we can ignore those that were activated at time of Detect start
|
// so we can ignore those that were activated at time of Detect start
|
||||||
std::vector<Device::Input*>::const_iterator
|
std::vector<ciface::Core::Device::Input*>::const_iterator
|
||||||
i = device->Inputs().begin(),
|
i = device->Inputs().begin(),
|
||||||
e = device->Inputs().end();
|
e = device->Inputs().end();
|
||||||
for (std::vector<bool>::iterator state = states.begin(); i != e; ++i)
|
for (std::vector<bool>::iterator state = states.begin(); i != e; ++i)
|
||||||
|
@ -286,7 +286,7 @@ Device::Control* ControllerInterface::InputReference::Detect(const unsigned int
|
||||||
//
|
//
|
||||||
// set all binded outputs to <range> power for x milliseconds return false
|
// set all binded outputs to <range> power for x milliseconds return false
|
||||||
//
|
//
|
||||||
Device::Control* ControllerInterface::OutputReference::Detect(const unsigned int ms, Device* const device)
|
ciface::Core::Device::Control* ControllerInterface::OutputReference::Detect(const unsigned int ms, ciface::Core::Device* const device)
|
||||||
{
|
{
|
||||||
// ignore device
|
// ignore device
|
||||||
|
|
||||||
|
|
|
@ -36,15 +36,13 @@
|
||||||
#define CIFACE_USE_SDL
|
#define CIFACE_USE_SDL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace ciface::Core;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// ControllerInterface
|
// ControllerInterface
|
||||||
//
|
//
|
||||||
// Some crazy shit I made to control different device inputs and outputs
|
// Some crazy shit I made to control different device inputs and outputs
|
||||||
// from lots of different sources, hopefully more easily.
|
// from lots of different sources, hopefully more easily.
|
||||||
//
|
//
|
||||||
class ControllerInterface : public DeviceContainer
|
class ControllerInterface : public ciface::Core::DeviceContainer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -63,7 +61,7 @@ public:
|
||||||
friend class ControllerInterface;
|
friend class ControllerInterface;
|
||||||
public:
|
public:
|
||||||
virtual ControlState State(const ControlState state = 0) = 0;
|
virtual ControlState State(const ControlState state = 0) = 0;
|
||||||
virtual Device::Control* Detect(const unsigned int ms, Device* const device) = 0;
|
virtual ciface::Core::Device::Control* Detect(const unsigned int ms, ciface::Core::Device* const device) = 0;
|
||||||
|
|
||||||
ControlState range;
|
ControlState range;
|
||||||
std::string expression;
|
std::string expression;
|
||||||
|
@ -98,7 +96,7 @@ public:
|
||||||
public:
|
public:
|
||||||
InputReference() : ControlReference(true) {}
|
InputReference() : ControlReference(true) {}
|
||||||
ControlState State(const ControlState state) override;
|
ControlState State(const ControlState state) override;
|
||||||
Device::Control* Detect(const unsigned int ms, Device* const device) override;
|
ciface::Core::Device::Control* Detect(const unsigned int ms, ciface::Core::Device* const device) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -111,7 +109,7 @@ public:
|
||||||
public:
|
public:
|
||||||
OutputReference() : ControlReference(false) {}
|
OutputReference() : ControlReference(false) {}
|
||||||
ControlState State(const ControlState state) override;
|
ControlState State(const ControlState state) override;
|
||||||
Device::Control* Detect(const unsigned int ms, Device* const device) override;
|
ciface::Core::Device::Control* Detect(const unsigned int ms, ciface::Core::Device* const device) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
ControllerInterface() : m_is_init(false), m_hwnd(nullptr) {}
|
ControllerInterface() : m_is_init(false), m_hwnd(nullptr) {}
|
||||||
|
@ -121,7 +119,7 @@ public:
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
bool IsInit() const { return m_is_init; }
|
bool IsInit() const { return m_is_init; }
|
||||||
|
|
||||||
void UpdateReference(ControlReference* control, const DeviceQualifier& default_device) const;
|
void UpdateReference(ControlReference* control, const ciface::Core::DeviceQualifier& default_device) const;
|
||||||
bool UpdateInput(const bool force = false);
|
bool UpdateInput(const bool force = false);
|
||||||
bool UpdateOutput(const bool force = false);
|
bool UpdateOutput(const bool force = false);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue