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


C++ ControllerInterface类代码示例

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


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

示例1: LoadDefaults

void ControllerEmu::LoadDefaults(const ControllerInterface &ciface)
{
	// load an empty inifile section, clears everything
	IniFile::Section sec;
	LoadConfig(&sec);

	if (ciface.Devices().size())
	{
		default_device.FromDevice(ciface.Devices()[0]);
		UpdateDefaultDevice();
	}
}
开发者ID:Everscent,项目名称:dolphin-emu,代码行数:12,代码来源:ControllerEmu.cpp

示例2: LoadDefaults

void ControllerEmu::LoadDefaults(const ControllerInterface& ciface)
{
  // load an empty inifile section, clears everything
  IniFile::Section sec;
  LoadConfig(&sec);

  const std::string& default_device_string = ciface.GetDefaultDeviceString();
  if (!default_device_string.empty())
  {
    default_device.FromString(default_device_string);
    UpdateDefaultDevice();
  }
}
开发者ID:,项目名称:,代码行数:13,代码来源:

示例3: UpdateReferences

void ControllerEmu::UpdateReferences(ControllerInterface& devi)
{
	for (auto& ctrlGroup : groups)
	{
		for (auto& control : ctrlGroup->controls)
			devi.UpdateReference(control->control_ref.get(), default_device);

		// extension
		if (ctrlGroup->type == GROUP_TYPE_EXTENSION)
		{
			for (auto& attachment : ((Extension*)ctrlGroup.get())->attachments)
				attachment->UpdateReferences(devi);
		}
	}
}
开发者ID:BhaaLseN,项目名称:dolphin,代码行数:15,代码来源:ControllerEmu.cpp

示例4: UpdateReferences

void ControllerEmu::UpdateReferences(ControllerInterface& devi)
{
	std::vector<ControlGroup*>::const_iterator
		i = groups.begin(),
		e = groups.end();
	for (; i!=e; ++i)
	{
		std::vector<ControlGroup::Control*>::const_iterator
			ci = (*i)->controls.begin(),
			ce = (*i)->controls.end();
		for (; ci!=ce; ++ci)
			devi.UpdateReference((*ci)->control_ref, default_device);

		// extension
		if (GROUP_TYPE_EXTENSION == (*i)->type)
		{
			std::vector<ControllerEmu*>::const_iterator
				ai = ((Extension*)*i)->attachments.begin(),
				ae = ((Extension*)*i)->attachments.end();
			for (; ai!=ae; ++ai)
				(*ai)->UpdateReferences(devi);
		}
	}
}
开发者ID:Everscent,项目名称:dolphin-emu,代码行数:24,代码来源:ControllerEmu.cpp

示例5: main

int main(int argc, char* argv[]) {
	try {
	ALLEGRO_DISPLAY *display = NULL;
	ALLEGRO_KEYBOARD_STATE keystate;
	ALLEGRO_EVENT_QUEUE *events;
	ALLEGRO_TIMER *updateTimer;

	if (!al_init()) {
		cout << "Allegro: failed to init" << endl; 
		return 1;
		}

	al_install_keyboard();
	al_init_primitives_addon();
	al_init_image_addon();

	updateTimer = al_install_timer(1.0 / 60);

	events = al_create_event_queue();
	al_register_event_source(events, al_get_keyboard_event_source());
	al_register_event_source(events, al_get_timer_event_source(updateTimer));

	al_start_timer(updateTimer);

	ControllerInterface* currentCon = new InitalController();
	stack<ControllerInterface*> conStack;

	while(currentCon != NULL) {

		if (currentCon->getDisplaySettingsChanged()) display = updateDisplay(display, events, currentCon);
		if (1.0 / currentCon->getDesiredFrameRate() != al_get_timer_speed(updateTimer)) al_set_timer_speed(updateTimer, 1.0 / currentCon->getDesiredFrameRate());

		ControllerReturn* rtn = currentCon->runEventHandler(events);
		
		if (rtn->finished) {
			delete currentCon;
			if (rtn->addController != NULL) {
				currentCon = rtn->addController;
				display = updateDisplay(display, events, currentCon);
				currentCon->iniController();
				}
					else
				{
				if (!conStack.empty()) {
					currentCon = conStack.top();
					display = updateDisplay(display, events, currentCon);
					currentCon->iniController();
					conStack.pop();
					}
						else
					{
					currentCon = NULL;
					}
				}
			}
				else
			{
			if (rtn->addController != NULL) {
				conStack.push(currentCon);
				currentCon = rtn->addController;
				display = updateDisplay(display, events, currentCon);
				currentCon->iniController();
				}
			}

		delete rtn;
		}

	al_destroy_event_queue(events);
	if (display != NULL) al_destroy_display(display);
	al_uninstall_system();
	}
	catch (string str) {
		cout << "Exception occured: " << str << endl;
	}
	catch (char const* str) {
		cout << "Exception occured: " << str << endl;
	}

	return 0;
	}
开发者ID:Orangeyness,项目名称:B-B-rebirth,代码行数:81,代码来源:main.cpp


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