int main (int argc, char *argv[])
{
  Example universe;
  universe.initializeUniverse();

  glutInit (&argc, argv);
  std::vector<sch::S_Object_GL*> sObjGL = createGL(universe.sObj);
  for (size_t i=0; i<sObjGL.size(); ++i)
    sObjGL[i]->drawGL();

  return 0;
}
示例#2
0
文件: GOAP.cpp 项目: OrangeKnife/NBE
	GOAPapp::GOAPapp(HINSTANCE h) :currentMapIdx(0),
		m_timer(NBETimer()),
		m_nextUpdateTime(0),
		m_startFrameTime(0),
		root(nullptr)
	{
		RenderInfo* rdinfo = loadRenderInfo(TEXT("config.ini"));

		switch (rdinfo->type)
		{
		case 0:
			m_pRenderer.reset(createGL(rdinfo, h));
			break;
		case 1:
			m_pRenderer.reset(createDX11(rdinfo, h));
			break;
		}

		textureMgr = TextureManager::getInstancePtr();
		textureMgr->initialize(m_pRenderer.get());
		textureMgr->LoadFromFile(TEXT("default-alpha.png"), TEXT("Default"));
		shaderMgr = ShaderManager::getInstancePtr();
		shaderMgr->initialize(m_pRenderer.get());



		root = new Node("root", vec3f(), Matrix4f::Identity());

		currentState = INGAME;



		initCamera(static_cast<float>(rdinfo->width) / rdinfo->height);

		initInput();

		ADDCLASSCALLBACK(NEvent_Key, GOAPapp, handleMovementEvent, NEvent_Key('W', NEvent_Key::KEY_DOWN), this, (void*)('W'));
		ADDCLASSCALLBACK(NEvent_Key, GOAPapp, handleMovementEvent, NEvent_Key('A', NEvent_Key::KEY_DOWN), this, (void*)('A'));
		ADDCLASSCALLBACK(NEvent_Key, GOAPapp, handleMovementEvent, NEvent_Key('S', NEvent_Key::KEY_DOWN), this, (void*)('S'));
		ADDCLASSCALLBACK(NEvent_Key, GOAPapp, handleMovementEvent, NEvent_Key('D', NEvent_Key::KEY_DOWN), this, (void*)('D'));
		ADDCLASSCALLBACK(NEvent_Key, GOAPapp, handleMovementEvent, NEvent_Key('C', NEvent_Key::KEY_DOWN), this, (void*)('C'));
		ADDCLASSCALLBACK(NEvent_Key, GOAPapp, handleMovementEvent, NEvent_Key(VK_SPACE, NEvent_Key::KEY_DOWN), this, (void*)(VK_SPACE));


	}
int I2CDeviceManager::createProxy( srcp::device_config_t config, srcp::SRCPGenericAccessoire **ga, srcp::SRCPGenericLoco **gl, srcp::SRCPFeedback **fb )
{
	// alle nicht I2C Board Proxies ignorieren
	if	( config.subDevice != srcp::I2CDESCRIPTION )
		return( 0 );

	int stepFB = config.args[0];
	int stepGA = config.args[1];
	int nextFB = 1;
	int nextGA = 1;
	union
	{
		uint8_t byte[12];
		int values[6];
	} buf;

#if	( DEBUG_SCOPE > 0 )
	Serial << "search I2C bus" << endl;
#endif

	for	( int i = 1; i < 128; i++ )
	{
		int board = I2CUtil::getSM( i, 0, 0, srcp::CV, CV_BOARD );
		// kein I2C Board auf dieser Adresse vorhanden?
		if	( board == -1 )
		{
			// Platzhalter 8 Adressen freihalten
			nextFB += stepFB;
			nextGA += stepGA;
			continue;
		}
		int rc = I2CUtil::getDescription( i, 0, 0, srcp::LAN, buf.byte );
		if	( rc == -1 )
			continue;
#if	( DEBUG_SCOPE > 0 )
			Serial << "I2C addr:id: " << i << ":" << board << ", fb: " << nextFB << " " << buf.values[0] << "-" << buf.values[1] <<
					", ga: " << nextGA << " " << buf.values[2] << "-" << buf.values[3] <<
					", gl: " << buf.values[4] << "-" << buf.values[5] << endl;
#endif
		switch	( board )
		{
			// DCC Boards haben fixe Adressen
			case srcp::BOARD_DCC:
				// GA Geraete vorhanden
				if	( buf.values[2] > 0 && buf.values[3] > 0 )
				{
					config.subDevice = srcp::I2CGAMaster;
					config.start_addr = buf.values[2];
					config.end_addr = buf.values[3];
					config.args[0] = i;
					*ga = createGA( config, *ga );
				}
				// GL Geraete vorhanden
				if	( buf.values[4] > 0 && buf.values[5] > 0 )
				{
					config.subDevice = srcp::I2CGLMaster;
					config.start_addr = buf.values[4];
					config.end_addr = buf.values[5];
					config.args[0] = i;
					*gl = createGL( config, *gl );
				}
				break;

			default:
				// FB Geraete vorhanden
				if	( buf.values[0] > 0 && buf.values[1] > 0 )
				{
					config.subDevice = srcp::I2CFBMaster;
					config.start_addr = nextFB;
					config.end_addr = nextFB + buf.values[1] - buf.values[0];
					config.args[0] = i;
					*fb = createFB( config, *fb );
					nextFB = config.end_addr + 1;
				}
				// GA Geraete vorhanden
				if	( buf.values[2] > 0 && buf.values[3] > 0 )
				{
					config.subDevice = srcp::I2CGAMaster;
					config.start_addr = nextGA;
					config.end_addr = nextGA +  + buf.values[3] - buf.values[2];
					config.args[0] = i;
					*ga = createGA( config, *ga );
					nextGA = config.end_addr + 1;
				}
				// GL (analoge) Geraete vorhanden
				if	( buf.values[4] > 0 && buf.values[5] > 0 )
				{
					config.subDevice = srcp::I2CGLMaster;
					config.start_addr = buf.values[4];
					config.end_addr = buf.values[5];
					config.args[0] = i;
					*gl = createGL( config, *gl );
				}
				break;
		}
	}

	return	( 1 );
}