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


C++ JMutex::IsInitialized方法代码示例

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


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

示例1: main

int main()
{
	sockets_init();
	atexit(sockets_cleanup);

	/*
		Run unit tests
	*/
	if(ENABLE_TESTS)
		run_tests();
	
	//return 0; //DEBUG
		
	/*
		Initialization
	*/

	srand(time(0));

	g_viewing_range_nodes_mutex.Init();
	assert(g_viewing_range_nodes_mutex.IsInitialized());

	MyEventReceiver receiver;

	// create device and exit if creation failed

	/*
		Host selection
	*/
	char connect_name[100];
	std::cout<<std::endl<<std::endl;
	std::cout<<"Address to connect to [empty = host a game]: ";
	std::cin.getline(connect_name, 100);
	
	bool hosting = false;
	if(connect_name[0] == 0){
		snprintf(connect_name, 100, "127.0.0.1");
		hosting = true;
	}
	std::cout<<"-> "<<connect_name<<std::endl;
	
	std::cout<<"Port [empty=30000]: ";
	char templine[100];
	std::cin.getline(templine, 100);
	unsigned short port;
	if(templine[0] == 0)
		port = 30000;
	else
		port = atoi(templine);

	/*
		Resolution selection
	*/

	u16 screenW = 800;
	u16 screenH = 600;

	/*
	u16 resolutions[][2] = {
		{640,480},
		{800,600},
		{1024,768},
		{1280,1024}
	};

	u16 res_count = sizeof(resolutions)/sizeof(resolutions[0]);
	
	std::cout<<"Select window resolution "
			<<"(type a number and press enter):"<<std::endl;
	for(u16 i=0; i<res_count; i++)
	{
		std::cout<<(i+1)<<": "<<resolutions[i][0]<<"x"
				<<resolutions[i][1]<<std::endl;
	}
	u16 r0;
	std::cin>>r0;
	if(r0 > res_count || r0 == 0)
		r0 = 0;
	u16 screenW = resolutions[r0-1][0];
	u16 screenH = resolutions[r0-1][1];
	*/

	//

	video::E_DRIVER_TYPE driverType;

#ifdef _WIN32
	//driverType = video::EDT_DIRECT3D9; // Doesn't seem to work
	driverType = video::EDT_OPENGL;
#else
	driverType = video::EDT_OPENGL;
#endif

	IrrlichtDevice *device;
	device = createDevice(driverType,
			core::dimension2d<u32>(screenW, screenH),
			16, false, false, false, &receiver);

	if (device == 0)
		return 1; // could not create selected driver.
//.........这里部分代码省略.........
开发者ID:EUGD,项目名称:minetest_nmpr,代码行数:101,代码来源:main.cpp


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