当前位置: 首页>>代码示例>>C++>>正文


C++ InputConfig类代码示例

本文整理汇总了C++中InputConfig的典型用法代码示例。如果您正苦于以下问题:C++ InputConfig类的具体用法?C++ InputConfig怎么用?C++ InputConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了InputConfig类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: s_config

namespace HotkeyManagerEmu
{

static u32 hotkeyDown[6];

static InputConfig s_config("Hotkeys", _trans("Hotkeys"), "Hotkeys");
InputConfig* GetConfig()
{
	return &s_config;
}

void GetStatus(u8 _port, HotkeyStatus* _pHotkeyStatus)
{
	memset(_pHotkeyStatus, 0, sizeof(*_pHotkeyStatus));
	_pHotkeyStatus->err = PAD_ERR_NONE;

	std::unique_lock<std::recursive_mutex> lk(s_config.controls_lock, std::try_to_lock);

	if (!lk.owns_lock())
	{
		// if gui has lock (messing with controls), skip this input cycle
		for (int i = 0; i < 6; i++)
			_pHotkeyStatus->button[i] = 0;

		return;
	}

	// get input
	((HotkeyManager*)s_config.controllers[_port])->GetInput(_pHotkeyStatus);
}

bool IsPressed(int Id, bool held)
{
	HotkeyStatus hotkey;
	memset(&hotkey, 0, sizeof(hotkey));
	GetStatus(0, &hotkey);
	unsigned int set = Id / 32;
	unsigned int setKey = Id % 32;
	if (hotkey.button[set] & (1 << setKey))
	{
		hotkeyDown[set] |= (1 << setKey);
		if (held)
			return true;
	}
	else
	{
		bool pressed = !!(hotkeyDown[set] & (1 << setKey));
		hotkeyDown[set] &= ~(1 << setKey);
		if (pressed)
			return true;
	}

	return false;
}

void Initialize(void* const hwnd)
{
	if (s_config.controllers.empty())
		s_config.controllers.push_back(new HotkeyManager());

	g_controller_interface.Initialize(hwnd);

	// load the saved controller config
	s_config.LoadConfig(true);

	for (unsigned int i = 0; i < 6; ++i)
		hotkeyDown[i] = 0;
}

void Shutdown()
{
	std::vector<ControllerEmu*>::const_iterator
		i = s_config.controllers.begin(),
		e = s_config.controllers.end();
	for (; i != e; ++i)
		delete *i;
	s_config.controllers.clear();

	g_controller_interface.Shutdown();
}

}
开发者ID:Pnum,项目名称:dolphin,代码行数:82,代码来源:HotkeyManager.cpp

示例2: s_config

namespace HotkeyManagerEmu
{
static u32 s_hotkeyDown[(NUM_HOTKEYS + 31) / 32];
static HotkeyStatus s_hotkey;
static bool s_enabled;

static InputConfig s_config("Hotkeys", _trans("Hotkeys"), "Hotkeys");

InputConfig* GetConfig()
{
  return &s_config;
}

void GetStatus()
{
  s_hotkey.err = PAD_ERR_NONE;

  // Get input
  static_cast<HotkeyManager*>(s_config.GetController(0))->GetInput(&s_hotkey);
}

bool IsEnabled()
{
  return s_enabled;
}

void Enable(bool enable_toggle)
{
  s_enabled = enable_toggle;
}

bool IsPressed(int Id, bool held)
{
  unsigned int set = Id / 32;
  unsigned int setKey = Id % 32;
  if (s_hotkey.button[set] & (1 << setKey))
  {
    bool pressed = !!(s_hotkeyDown[set] & (1 << setKey));
    s_hotkeyDown[set] |= (1 << setKey);
    if (!pressed || held)
      return true;
  }
  else
  {
    s_hotkeyDown[set] &= ~(1 << setKey);
  }

  return false;
}

void Initialize(void* const hwnd)
{
  if (s_config.ControllersNeedToBeCreated())
    s_config.CreateController<HotkeyManager>();

  g_controller_interface.Initialize(hwnd);

  // load the saved controller config
  s_config.LoadConfig(true);

  for (u32& key : s_hotkeyDown)
    key = 0;

  s_enabled = true;
}

void LoadConfig()
{
  s_config.LoadConfig(true);
}

void Shutdown()
{
  s_config.ClearControllers();

  g_controller_interface.Shutdown();
}
}
开发者ID:E2xD,项目名称:dolphin,代码行数:78,代码来源:HotkeyManager.cpp

示例3: s_config

namespace Wiimote
{
static InputConfig s_config(WIIMOTE_INI_NAME, _trans("Wii Remote"), "Wiimote");

InputConfig* GetConfig()
{
  return &s_config;
}

ControllerEmu::ControlGroup* GetWiimoteGroup(int number, WiimoteEmu::WiimoteGroup group)
{
  return static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(number))->GetWiimoteGroup(group);
}

ControllerEmu::ControlGroup* GetNunchukGroup(int number, WiimoteEmu::NunchukGroup group)
{
  return static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(number))->GetNunchukGroup(group);
}

ControllerEmu::ControlGroup* GetClassicGroup(int number, WiimoteEmu::ClassicGroup group)
{
  return static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(number))->GetClassicGroup(group);
}

ControllerEmu::ControlGroup* GetGuitarGroup(int number, WiimoteEmu::GuitarGroup group)
{
  return static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(number))->GetGuitarGroup(group);
}

ControllerEmu::ControlGroup* GetDrumsGroup(int number, WiimoteEmu::DrumsGroup group)
{
  return static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(number))->GetDrumsGroup(group);
}

ControllerEmu::ControlGroup* GetTurntableGroup(int number, WiimoteEmu::TurntableGroup group)
{
  return static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(number))
      ->GetTurntableGroup(group);
}

void Shutdown()
{
  s_config.ClearControllers();

  WiimoteReal::Stop();
}

void Initialize(InitializeMode init_mode)
{
  if (s_config.ControllersNeedToBeCreated())
  {
    for (unsigned int i = WIIMOTE_CHAN_0; i < MAX_BBMOTES; ++i)
      s_config.CreateController<WiimoteEmu::Wiimote>(i);
  }

  g_controller_interface.RegisterDevicesChangedCallback(LoadConfig);

  LoadConfig();

  WiimoteReal::Initialize(init_mode);

  // Reload Wiimotes with our settings
  if (Movie::IsMovieActive())
    Movie::ChangeWiiPads();
}

void Connect(unsigned int index, bool connect)
{
  if (SConfig::GetInstance().m_bt_passthrough_enabled || index >= MAX_BBMOTES)
    return;

  const auto ios = IOS::HLE::GetIOS();
  if (!ios)
    return;

  const auto bluetooth = std::static_pointer_cast<IOS::HLE::Device::BluetoothEmu>(
      ios->GetDeviceByName("/dev/usb/oh1/57e/305"));

  if (bluetooth)
    bluetooth->AccessWiimoteByIndex(index)->Activate(connect);

  const char* message = connect ? "Wii Remote %u connected" : "Wii Remote %u disconnected";
  Core::DisplayMessage(StringFromFormat(message, index + 1), 3000);
}

void ResetAllWiimotes()
{
  for (int i = WIIMOTE_CHAN_0; i < MAX_BBMOTES; ++i)
    static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(i))->Reset();
}

void LoadConfig()
{
  s_config.LoadConfig(false);
  s_last_connect_request_counter.fill(0);
}

void Resume()
{
  WiimoteReal::Resume();
//.........这里部分代码省略.........
开发者ID:MerryMage,项目名称:dolphin,代码行数:101,代码来源:Wiimote.cpp

示例4: s_config

namespace HotkeyManagerEmu
{

static u32 s_hotkeyDown[(NUM_HOTKEYS + 31) / 32];
static HotkeyStatus s_hotkey;
static bool s_enabled;

static InputConfig s_config("Hotkeys", _trans("Hotkeys"), "Hotkeys");

InputConfig* GetConfig()
{
	return &s_config;
}

void GetStatus()
{
	s_hotkey.err = PAD_ERR_NONE;

	// get input
	((HotkeyManager*)s_config.controllers[0])->GetInput(&s_hotkey);
}

bool IsEnabled()
{
	return s_enabled;
}

void Enable(bool enable_toggle)
{
	s_enabled = enable_toggle;
}

bool IsPressed(int Id, bool held)
{
	unsigned int set = Id / 32;
	unsigned int setKey = Id % 32;
	if (s_hotkey.button[set] & (1 << setKey))
	{
		bool pressed = !!(s_hotkeyDown[set] & (1 << setKey));
		s_hotkeyDown[set] |= (1 << setKey);
		if (!pressed || held)
			return true;
	}
	else
	{
		s_hotkeyDown[set] &= ~(1 << setKey);
	}

	return false;
}

void Initialize(void* const hwnd)
{
	if (s_config.controllers.empty())
		s_config.controllers.push_back(new HotkeyManager());

	g_controller_interface.Initialize(hwnd);

	// load the saved controller config
	s_config.LoadConfig(true);

	for (u32& key : s_hotkeyDown)
		key = 0;

	s_enabled = true;
}

void LoadConfig()
{
	s_config.LoadConfig(true);
}

void Shutdown()
{
	std::vector<ControllerEmu*>::const_iterator
		i = s_config.controllers.begin(),
		e = s_config.controllers.end();
	for (; i != e; ++i)
		delete *i;
	s_config.controllers.clear();

	g_controller_interface.Shutdown();
}

}
开发者ID:dragonbane0,项目名称:dolphin,代码行数:85,代码来源:HotkeyManager.cpp

示例5: LoadConfig

void LoadConfig()
{
  s_config.LoadConfig(true);
}
开发者ID:E2xD,项目名称:dolphin,代码行数:4,代码来源:HotkeyManager.cpp

示例6: Shutdown

void Shutdown()
{
  s_config.ClearControllers();

  g_controller_interface.Shutdown();
}
开发者ID:E2xD,项目名称:dolphin,代码行数:6,代码来源:HotkeyManager.cpp

示例7:

/**
 * Looks up the specified key code, and returns the associated event
 * id.  Returns 0 if the key was not found.
 */
gcc_pure
static unsigned
key_to_event(InputEvents::Mode mode, unsigned key_code)
{
  return input_config.GetKeyEvent(mode, key_code);
}
开发者ID:DRIZO,项目名称:xcsoar,代码行数:10,代码来源:InputEvents.cpp

示例8: GetTurntableGroup

ControllerEmu::ControlGroup* GetTurntableGroup(int number, WiimoteEmu::TurntableGroup group)
{
  return static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(number))
      ->GetTurntableGroup(group);
}
开发者ID:MerryMage,项目名称:dolphin,代码行数:5,代码来源:Wiimote.cpp

示例9: Shutdown

void Shutdown()
{
  s_config.ClearControllers();

  WiimoteReal::Stop();
}
开发者ID:MerryMage,项目名称:dolphin,代码行数:6,代码来源:Wiimote.cpp

示例10: DoState

// Save/Load state
void DoState(PointerWrap& p)
{
  for (int i = 0; i < MAX_BBMOTES; ++i)
    static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(i))->DoState(p);
}
开发者ID:MerryMage,项目名称:dolphin,代码行数:6,代码来源:Wiimote.cpp

示例11: LoadConfig

void LoadConfig()
{
  s_config.LoadConfig(false);
  s_last_connect_request_counter.fill(0);
}
开发者ID:MerryMage,项目名称:dolphin,代码行数:5,代码来源:Wiimote.cpp

示例12: ResetAllWiimotes

void ResetAllWiimotes()
{
  for (int i = WIIMOTE_CHAN_0; i < MAX_BBMOTES; ++i)
    static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(i))->Reset();
}
开发者ID:MerryMage,项目名称:dolphin,代码行数:5,代码来源:Wiimote.cpp


注:本文中的InputConfig类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。