Beispiel #1
0
void EyeXHost::HandleEvent(TX_CONSTHANDLE hAsyncData)
{
	TX_HANDLE hEvent(TX_EMPTY_HANDLE);
	txGetAsyncDataContent(hAsyncData, &hEvent);

	// NOTE. Uncomment the following line of code to view the event object. The same function can be used with any interaction object.
	//OutputDebugStringA(txDebugObject(hEvent));

	// read the interactor ID from the event.
	const int bufferSize = 20;
	TX_CHAR stringBuffer[bufferSize];
	TX_SIZE idLength(bufferSize);
	if (txGetEventInteractorId(hEvent, stringBuffer, &idLength) == TX_RESULT_OK)
	{
		int interactorId = atoi(stringBuffer);

		HandleActivatableEvent(hEvent, interactorId);
	}

	txReleaseObject(&hEvent);
}
Beispiel #2
0
HGame::HGame(void)
{
	instance = this;
	didRoomChange = false;

	isRunning = true;

	new HScreen();
	new HResources();
	new HRoom();

	HRoom::gotoRoom(HResources::ROOM_TEST);

    clock_t t = clock();
	// Start the game loop
    while (HScreen::getScreen()->isOpen())
    {
        while((clock() - t)/static_cast<double>(CLOCKS_PER_SEC) < static_cast<double>(1)/FPS);
        t = clock();

        didRoomChange = false;

        hEvent();
        hStep();
        hDraw();
        while(destroyQueue.size()>0)
		{
			std::vector<Obj*>* objList = &HGame::getInstance()->objectList;
			std::vector<Obj*>::iterator it = std::find(objList->begin(), objList->end(), destroyQueue.front());
			if(it != objList->end())
			{
				objList->erase(it);
			}

			destroyQueue.pop();
		}
    }
}