void DSPEngine::run()
{
	connect(&m_messageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleMessages()), Qt::QueuedConnection);

	m_state = StIdle;

	handleMessages();
	exec();
}
void waitAndHandleMessages(JNIEnv *env, jlong contextHandle)
{
    ddjvu_context_t* ctx = (ddjvu_context_t*) (contextHandle);
    // Wait for first message
    ddjvu_message_wait(ctx);
    // Process available messages
    handleMessages(env, ctx);
}
示例#3
0
void MessageRouter::run()
{
   for (int i = 0; i < MAX_NUM_ADAPTERS; i++)
   {
      if (adapters[i] != 0)
      {
         handleMessages(*adapters[i]);
      }
   }
}
示例#4
0
void VLCNative::stopTranscoding() {
	handleMessages();
	DEBUG("VLCNative: stop transcoding");
   libvlc_vlm_stop_media(vlc, medianame);
	DEBUG("VLCNative: stopped media");
   libvlc_vlm_release(vlc);
	DEBUG("VLCNative: released vlm");
   libvlc_release(vlc);
	DEBUG("VLCNative: released libvlc");
}
示例#5
0
void Kore::System::start() {
    appstate::running = true;

#if !defined(SYS_HTML5) && !defined(SYS_TIZEN)
    // if (Graphics::hasWindow()) Graphics::swapBuffers();

    while (appstate::running) {
        callback();
        handleMessages();
    }
#endif
}
示例#6
0
void Game::runStep(Scalar<SIUnit::Time> dt, MessageCallbackType messageCallback) {
	clock += dt;
	handleMessages(messageCallback);

	for (ObjectContainerType::iterator i = objects.begin(); i != objects.end();) {
		ObjectContainerType::iterator next = i;
		++next;
		if (!i->second->runStep(dt, *this)) {
			objects.erase(i);
		}
		i = next;
	}
}
示例#7
0
文件: client.c 项目: sclaxton/chirc
void handleUser(cli *client, blist leftOverMessages, bstring incompleteMessage){
    /*take care of any messages left over from registration*/
    if (leftOverMessages->qty){
        handleMessages(leftOverMessages, client);
    }
    bstrListDestroy(leftOverMessages);

    blist messages;
    bstring raw;

    incompleteMessage = incompleteMessage ? incompleteMessage : safe_BfromCstr("");

    /*recv messages until you receive a nick and user msg*/
    while (1){
        raw = safeRecv(client);
        messages = extractMessages(raw, &incompleteMessage);
        if (messages){
            handleMessages(messages, client);
            bstrListDestroy(messages);
        }
    }
    /*exit pthread*/
}
示例#8
0
bool SocketServer::serve() {
  while (!stopped && !errored) {
    waitForActivity();
    checkForNewConnections();
    handleMessages();
  }

  for (auto& clientList : clientLists) {
    for (auto& client : clientList->clients) {
      client.close();
    }
  }

  return !errored;
}
示例#9
0
	//Determines whether a pinch is being held (pinchHold) or has just been released (pinch)
	void Terrain::testPinch(MHTypes::Point3D finger, MHTypes::Point3D thumb)
	{
		//Set current interaction mode
		handleMessages();

		//update current pinching state
		if(finger.distance(thumb) < FINGER_PINCH_MAX_DIST)
		{
			oldPinchHold = pinchHold;
			pinchHold = true;
		}
		else{
			pinchHold = false;
			if(oldPinchHold && !pinchHold){
				pinch = true;
				pinchHold = false;
			}else{
				pinch = false;
			}
			oldPinchHold = false;
		}

		if (currDelay > 0){
			currDelay--;
		}

		//Invoke state machine for current mode
		if(mode == ENDPOINT_DRAWING_MODE)
			handleEndpointDrawing(state);
		else if (mode == DIRECT_DRAWING_MODE)
			handleDirectDrawing(state);
		else if (mode == ROI_MODE)
			handleROIPlacement(state);
		else if (mode == POI_MODE)
			handlePOIPlacement(state);
		else if (mode == HEIGHT_FILTERING_MODE)
			handleHeightFiltering(state);
		else if (mode == HEIGHT_SELECT_MODE)
			handleHeightSelection(state);

	}
示例#10
0
void _Mavlink::update(void)
{
	while (m_bThreadON)
	{
		if (!m_pSerialPort->isOpen())
		{
			if (!m_pSerialPort->open())
			{
				this->sleepThread(USEC_1SEC);
				continue;
			}
			m_status.packet_rx_drop_count = 0;
		}

		this->autoFPSfrom();

		//Handling incoming messages
		handleMessages();

		this->autoFPSto();
	}

}
示例#11
0
void _MavlinkInterface::update(void)
{
	while (m_bThreadON)
	{
		if (m_sportName == "")
		{
			this->sleepThread(0, 1000);
			continue;
		}

		if (!m_bSerialConnected)
		{
			if (m_pSerialPort->Open((char*)m_sportName.c_str()))
			{
				LOG(INFO)<< "Serial port: "+m_sportName+" connected";
			}
			else
			{
				this->sleepThread(0,1000);
				continue;
			}
		}

		this->autoFPSfrom();

		//Connected to Vehicle
		requestDataStream(/*MAV_DATA_STREAM_RAW_SENSORS*/MAV_DATA_STREAM_ALL, 10);

		handleMessages();


		//send local ned control at 2Hz

		this->autoFPSto();
	}

}
示例#12
0
float VLCNative::getPosition() {
	handleMessages();
	float ret = libvlc_vlm_get_media_instance_position(vlc, medianame, 0);
	DEBUG("VLCNative::getPosition = {0}", ret);
	return ret;
}
示例#13
0
	// Render
	// desc: handles drawing of scene
	void Terrain::render()
	{
		glEnable(GL_TEXTURE_2D);
		Color3f *color;

		//server->parseData();
		handleMessages();
		//###########################################
		//## For taking cross-section screenshots ###
		//###########################################
		//glMatrixMode(GL_MODELVIEW);

		//glPushMatrix();
		//glTranslatef(0.0f, minY*(MAP_SCALE/20) + 0.045f, 0.0f);
		//glClipPlane(GL_CLIP_PLANE2, topPlaneEq);
		//glPopMatrix();

		//glPushMatrix();
		//glTranslatef(0.0f, minY*(MAP_SCALE/20) +0.045f, 0.0f);
		//glClipPlane(GL_CLIP_PLANE3, botPlaneEq);
		//glPopMatrix();
		//glEnable(GL_CLIP_PLANE2);
		//glEnable(GL_CLIP_PLANE3);

		
		//#################################
		//***Drawing original Terrain***//
		//#################################
		// set the current texture to the land texture
		//glBindTexture(GL_TEXTURE_2D, land);
		//glPushMatrix();
		////glTranslatef(((MAP_X*MAP_SCALE)/2.0f), 0.0, -((MAP_Z*MAP_SCALE)/2.0f)); //translate back from origin
		////glMultMatrixf(rotMatrix); //rotate via Vicon
		//glTranslatef(-((MAP_X*MAP_SCALE)/2.0f), 0.0, ((MAP_Z*MAP_SCALE)/2.0f)); //translate to origin

		//for (int z = 0; z < MAP_Z-1; z++)
		//{
		//	glBegin(GL_TRIANGLE_STRIP);
		//	for (int x = 0; x < MAP_X-1; x++)
		//	{

		//		pathColor->setRGB(terrain[x][z][1]/255.0f);

		//		glColor3f(pathColor->getRed(), pathColor->getGreen(), pathColor->getBlue());
		//		//glColor3f(d, d, d);
		//		glTexCoord2f(0.0f, 0.0f);
		//		glVertex3f(terrain[x][z][0], terrain[x][z][1] * (MAP_SCALE/20.0f), terrain[x][z][2]);
		//		pathColor->setRGB(terrain[x+1][z][1]/255.0f);


		//		// draw vertex 1
		//		glTexCoord2f(1.0f, 0.0f);
		//		//glColor3f(terrain[x+1][z][1]/255.0f, terrain[x+1][z][1]/255.0f, terrain[x+1][z][1]/255.0f);
		//		glColor3f(pathColor->getRed(), pathColor->getGreen(), pathColor->getBlue());
		//		glVertex3f(terrain[x+1][z][0], terrain[x+1][z][1] * (MAP_SCALE/20.0f), terrain[x+1][z][2]);
		//		pathColor->setRGB(terrain[x][z+1][1]/255.0f);

		//		// draw vertex 2
		//		glTexCoord2f(0.0f, 1.0f);
		//		glColor3f(pathColor->getRed(), pathColor->getGreen(), pathColor->getBlue());
		//		glVertex3f(terrain[x][z+1][0], terrain[x][z+1][1] * (MAP_SCALE/20.0f), terrain[x][z+1][2]);

		//		pathColor->setRGB(terrain[x+1][z+1][1]/255.0f);
		//		// draw vertex 3
		//		glColor3f(pathColor->getRed(), pathColor->getGreen(), pathColor->getBlue());
		//		glTexCoord2f(1.0f, 1.0f);
		//		glVertex3f(terrain[x+1][z+1][0], terrain[x+1][z+1][1] * (MAP_SCALE/20.0f), terrain[x+1][z+1][2]);
		//	}
		//	glEnd();
		//}
		//glPopMatrix();

		glMatrixMode(GL_MODELVIEW);
		//############################
		//##Draw Holo-Mobile Terrain##
		//############################
		glBindTexture(GL_TEXTURE_2D, land);
		glPushMatrix(); //Save pre-terrain view matrix

		glTranslatef(loc->x, loc->y, loc->z); //Positions Terrain
		glMultMatrixf(rotMatrix); //Rotates Terrain
		glTranslatef(-((MAP_X*MAP_SCALE)/2.0f), 0.0, ((MAP_Z*MAP_SCALE)/2.0f)); //Moves terrain to origin

		glPushMatrix(); //Save pre-clip view matrix

		//Determine which clipping plane is the upper and which is lower
		//based on their height relative to one another.
		// ------first => upper     OR    -------second => upper
		// ------second => lower          -------first  => lower
		if(firstClipY > secondClipY){
			botClipY = secondClipY;
			topClipY = firstClipY;
		}
		else{
			botClipY = firstClipY;
			topClipY = secondClipY;
		}
		//Position & initialize clipping planes
		glTranslatef(0.0f, botClipY, 0.0f);
		glClipPlane(GL_CLIP_PLANE0, botPlaneEq);
		
		glTranslatef(0.0f, topClipY - botClipY, 0.0f);
		glClipPlane(GL_CLIP_PLANE1, topPlaneEq);

		//Enable clipping planes
		if(enableFirstClip){
			if(firstClipY > secondClipY){
				glEnable(GL_CLIP_PLANE0);
			}
			else{
				glEnable(GL_CLIP_PLANE1);
			}
		}
			
		if(enableSecondClip){
			if(secondClipY > firstClipY){
				glEnable(GL_CLIP_PLANE0);
			}
			else{
				glEnable(GL_CLIP_PLANE1);
			}
		}

		glPopMatrix(); //Restore pre-clip (post-terrain) view matrix


		// we are going to loop through all of our terrain's data points,
		// but we only want to draw one triangle strip for each set along the x-axis.
		for (int z = 0; z < MAP_Z-1; z++)
		{
			glBegin(GL_TRIANGLE_STRIP);
			for (int x = 0; x < MAP_X-1; x++)
			{
				// for each vertex, we calculate the grayscale shade color, 
				// we set the texture coordinate, and we draw the vertex.
				/*
				   the vertices are drawn in this order:

				   0  ---> 1
						  /
						/
					 |/
				   2  ---> 3
				*/

				// draw vertex 0
				setVertexColor(x, z);
				glTexCoord2f(0.0f, 0.0f);
				glVertex3f(terrain[x][z][0], terrain[x][z][1] * (MAP_SCALE/20.0f), terrain[x][z][2]);

				// draw vertex 1
				setVertexColor(x+1, z);
				glTexCoord2f(1.0f, 0.0f);
				glVertex3f(terrain[x+1][z][0], terrain[x+1][z][1] * (MAP_SCALE/20.0f), terrain[x+1][z][2]);

				// draw vertex 2
				setVertexColor(x, z+1);
				glTexCoord2f(0.0f, 1.0f);
				glVertex3f(terrain[x][z+1][0], terrain[x][z+1][1] * (MAP_SCALE/20.0f), terrain[x][z+1][2]);

				// draw vertex 3
				setVertexColor(x+1, z+1);
				glTexCoord2f(1.0f, 1.0f);
				glVertex3f(terrain[x+1][z+1][0], terrain[x+1][z+1][1] * (MAP_SCALE/20.0f), terrain[x+1][z+1][2]);
			}
			glEnd();


		}
		glColor3f(1.0f, 1.0f, 1.0f);
		//Try drawing text to the screen
		//glutStrokeString(GLUT_STROKE_ROMAN, (unsigned char*)"some text");

		//############################
		//##      Draw Markers      ##
		//############################

			if(start){
				startCube->setRotMat(rotMatrix);
				startCube->setPosition(MHTypes::Point3D(start->x, (terrain[(int)(start->x *(1/MAP_SCALE))][(int)(start->z *(1/MAP_SCALE))][1]* (MAP_SCALE/20.0f)) + 0.02f , start->z));
				startCube->render();
			}

			if(end){
				endCube->setRotMat(rotMatrix);
				endCube->setPosition(MHTypes::Point3D(end->x, (terrain[(int)(end->x *(1/MAP_SCALE))][(int)(end->z *(1/MAP_SCALE))][1]* (MAP_SCALE/20.0f)) + 0.02f , end->z));
				endCube->render();
			}

			roiCube->setRotMat(rotMatrix);
			roiCube->setPosition(MHTypes::Point3D(roi.x, (terrain[(int)(roi.x *(1/MAP_SCALE))][(int)(roi.z *(1/MAP_SCALE))][1]* (MAP_SCALE/20.0f)) + 0.02f , roi.z));
			roiCube->render();

			poiCube->setRotMat(rotMatrix);
			poiCube->setPosition(MHTypes::Point3D(poi.x, (terrain[(int)(poi.x *(1/MAP_SCALE))][(int)(poi.z *(1/MAP_SCALE))][1]* (MAP_SCALE/20.0f)) + 0.02f , poi.z));
			poiCube->render();

			//render lightingCube once, so lighting is applied, then hide. (is what I'm assuming is happening here)
			if(isFirst){
				lightingCube->render();
				isFirst = false;
			}
			
				
		glPopMatrix();
		
		// enable blending
		glEnable(GL_BLEND);

		// enable read-only depth buffer
		glDepthMask(GL_FALSE);

		// set the blend function to what we use for transparency
		glBlendFunc(GL_SRC_ALPHA, GL_ONE);

		// set back to normal depth buffer mode (writable)
		glDepthMask(GL_TRUE);

		// disable blending
		glDisable(GL_BLEND);
				
		//############################################
		//############ Renders Selection Ray #########
		//############################################
		glPushMatrix();
		glTranslatef(loc->x, loc->y, loc->z);
		glMultMatrixf(rotMatrix);
		glTranslatef(-((MAP_X*MAP_SCALE)/2.0f), 0.0, ((MAP_Z*MAP_SCALE)/2.0f));

		glLineWidth(10.0f);

		//Determine selection ray color
		//red => not intersecting, not pinching
		//blue => intersecting, not pinching
		//green => pinching
		glColor3f(1.0f, 0.0f, 0.0f);
		if(intersecting){
			glColor3f(0.0f, 0.0f, 1.0f);
		}
		if(pinch || pinchHold){
			glColor3f(0.0f, 1.0f, 0.0f);
		}
		//Draw SelectorRay
		glBegin(GL_LINES);
		//Disable SelectorRay (comment following 2 lines out to disable)
		glVertex3f(selectorRay.x, -1000.0f, selectorRay.z);
		glVertex3f(selectorRay.x, 1000.0f, selectorRay.z);
		glEnd();


		//#######################################
		//########### Renders Clip Plane ########
		//#######################################

		//Set up transparency for clip plane visualizations
		glColor4f(0.0f, 0.0f, 1.0f, 0.5f);
		glEnable (GL_BLEND); 
		glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

		//If enabled, render the visualization of the first clip plane
		if(enableFirstClipVis){
			glPushMatrix();

			glTranslatef(0.0f, clipPlaneFirstVisOffset, 0.0f);
			glBegin(GL_QUADS);
				glVertex3f(0.0f, firstClipY, -MAP_Z*MAP_SCALE);
				glVertex3f(0.0f, firstClipY, 0.0f);
				glVertex3f(MAP_X*MAP_SCALE, firstClipY, 0.0f);
				glVertex3f(MAP_X*MAP_SCALE, firstClipY, -MAP_Z*MAP_SCALE);
			glEnd();

			glPopMatrix();
		}
		//If enabled, render the visualization of the second clip plane
		if(enableSecondClipVis){
			glPushMatrix();

			glTranslatef(0.0f, clipPlaneSecondVisOffset, 0.0f);
			glBegin(GL_QUADS);
				glVertex3f(0.0f, secondClipY, -MAP_Z*MAP_SCALE);
				glVertex3f(0.0f, secondClipY, 0.0f);
				glVertex3f(MAP_X*MAP_SCALE, secondClipY, 0.0f);
				glVertex3f(MAP_X*MAP_SCALE, secondClipY, -MAP_Z*MAP_SCALE);
			glEnd();

			glPopMatrix();
		}
		//If enabled, render the height selector
		if(enableHeightVis){
			glPushMatrix();

			glTranslatef(0.0f, 0.0f, 0.0f);
			glBegin(GL_QUADS);
				glVertex3f(0.0f, selectorRay.y, -MAP_Z*MAP_SCALE);
				glVertex3f(0.0f, selectorRay.y, 0.0f);
				glVertex3f(MAP_X*MAP_SCALE, selectorRay.y, 0.0f);
				glVertex3f(MAP_X*MAP_SCALE, selectorRay.y, -MAP_Z*MAP_SCALE);
			glEnd();

			glPopMatrix();
		}

		glPopMatrix();

		glFlush();
		
	}
示例#14
0
int main( ) {
	config.load( "config.cfg" );
	if( config.error( ) ) {
		puts( "Error loading config." );
		return 1;
	}

	rc::MessageHandler hMessages;
	rc::registerMessageHandler( &hMessages );

	rc::init( "KakaTD", (int)config.getNum("xres"), (int)config.getNum("yres"), (int)config.getNum("zres"), config.getNum("fullscreen") > 0.01f, config.getNum("fov"), config.getNum("near"), config.getNum("far"), (int)config.getNum("depth"), (int)config.getNum("fsaa"), (int)config.getNum("stencil"), (int)config.getNum("accum") );
	handleMessages( );

	rc::Shader::global = "const vec3 lightDir = vec3( 0.5, 0.0, 0.866 );\n";
	if( (int)config.getNum("pcf") ) rc::Shader::global += "#define PCF\n";
	rc::Shader::global += "#define SHADOWMAPSIZE " + strFloat((float)config.getNum("shadowmapres")) + "\n";
	rc::Shader::global += "#line 0\n";

	culling::setup( config.getNum("fov"), config.getNum("xres") / config.getNum("yres"), 60.0f );
	camera::setup( config.getNum("heightSpeed"), config.getNum("heightMoveSmoothness"), (int)config.getNum("moveBorder"), config.getNum("moveSpeed"), config.getNum("lookAngle"), config.getNum("targetHeight") );
	map::setup( config.getString("map").c_str( ) );
	shadows::setup( (int)config.getNum("shadowmapres"), config.getNum("bilinearpcf") > 0.01f );

	rc::Object pickMarker;
	pickMarker.setMesh( rc::getRessource<rc::Mesh>( "media/cube2" ) );
	pickMarker.setTexture( rc::getRessource<rc::Texture>( "media/spawn.png" ) );
	pickMarker.scale( Eigen::Vector3f( 0.01f, 0.01f, 0.01f ) );
	pickMarker.position( Eigen::Vector3f( 0.0f, 0.0f, 0.0f ) );

	rc::Shader* towerShader = rc::getRessource<rc::Shader>( "media/tower.vert;media/tower.frag" );
	towerShader->defaultUniforms.add( rc::uniform::SAMPLER, "shadowMap", &rc::Texture::sampler1 );
	towerShader->defaultUniforms.add( rc::uniform::MAT4 | rc::uniform::FLOAT, "lightMVP", shadows::lightMVP );
	towerShader->defaultUniforms.add( rc::uniform::MAT4 | rc::uniform::FLOAT, "objectMVP", rc::Object::MVP );

	rc::Renderable::finishInitialization( );
	/*for( std::list<rc::Renderable*>::iterator i = rc::Renderable::renderables.begin( ); i != rc::Renderable::renderables.end( ); ++i) {
		printf( "%d\n", (*i)->hash( ) );
	};*/
	puts( "------------------------------------------------- Start ");

	time_t next = clock( );
	int frameCounter = 0;
	double t0 = 0.0, t1 = 0.0;
	glfwSetTime(0.0);
	Eigen::Vector2i pickPos = Eigen::Vector2i( -1, -1 );
	bool lastEnter = false;
	bool lastClick = false;
	do {
		t0 = glfwGetTime();
		//float speed = ((t0.tv_sec - t1.tv_sec) * 1000000 + (t0.tv_usec - t1.tv_usec)) * 0.0001f;
		//shaderTime = (t0.tv_sec * 1000000 + t0.tv_usec) * 0.000001f;
		float speed = (float)(t0 - t1) * 100.0f;
		shaderTime = (float)t0 * 1.0f;
		t1 = t0;

		bool click = glfwGetMouseButton( GLFW_MOUSE_BUTTON_LEFT ) == GLFW_PRESS;
		if( pickPos.x( ) != -1 ) {
			map::GridField* field = map::mapGrid + pickPos.y( )*map::width + pickPos.x( );
			Eigen::Vector3f pos = Eigen::Vector3f( (pickPos.x( ) - map::width * 0.5f) * SPACING, field->type==map::GridField::RAISED?HEIGHT:0.0f, (pickPos.y( ) - map::height * 0.5f) * SPACING );
			pickMarker.position( pos );
			if( click && !lastClick ) {
				rc::Object* temp = new rc::Object;
				temp->setMesh( rc::getRessource<rc::Mesh>( "media/Blitz" ) );
				temp->setShader( rc::getRessource<rc::Shader>( "media/tower.vert;media/tower.frag" ) );
				temp->setTexture( &shadows::shadowMap, rc::Texture::sampler1 );
				temp->position( pos );
				temp->scale( Eigen::Vector3f( 0.024f, 0.024f, 0.03f ) );
				temp->orientation(Eigen::Vector3f(-(float)M_PI / 2.0f, 0.0f, 0.0f));
			}
		}
		lastClick = click;

		camera::update( speed );
		if( rc::getKey( GLFW_KEY_SPACE ) ) {
			camera::camPos = Eigen::Vector3f( 50.0f, 50.0f, -50.0f );
			camera::targetHeight = 50.0f;
		};

		bool enter = rc::getKey( GLFW_KEY_ENTER );
		if( enter && !lastEnter ) {

		};
		lastEnter = enter;

		//puts( "--------------------------------------- Frame ");
		// Rendering
		culling::update( );
		pickPos = picking::update( );
		shadows::update( );
		rc::update( );
		frameCounter++;
		handleMessages( );

		if( next < clock( ) ) {
			char Buf[256];
			sprintf( Buf, "FPS: %d, Rendered: %d, Texture-Switches: %d, Shader-Binds: %d, Polygons: %.3d", frameCounter, rc::Renderable::rendered, rc::Texture::binds, rc::Shader::binds, rc::Mesh::polysDrawn );
			puts( Buf );
			glfwSetWindowTitle( Buf );
			frameCounter = 0;
			next = clock( ) + CLOCKS_PER_SEC;
		};
	} while( rc::windowOpen( ) && !rc::getKey( GLFW_KEY_ESC ) );

	rc::terminate( );
	return 0;
}
示例#15
0
int WindowsMain(int argc, char** argv, IApp* app)
{
	pApp = app;

	//Used for automated testing, if enabled app will exit after 120 frames
	bool testing = false;
	uint32_t testingFrameCount = 0;
	const uint32_t testingDesiredFrameCount = 120;

	//search for --test in command line arguments
	if (argc > 1)
	{
		for(int i = 0 ; i < argc ; i++)
		{
			if (strcmp(argv[i], "--testing"))
				testing = true;
		}
	}


	FileSystem::SetCurrentDir(FileSystem::GetProgramDir());

	IApp::Settings* pSettings = &pApp->mSettings;
	WindowsDesc window = {};
	Timer deltaTimer;

	if (pSettings->mWidth == -1 || pSettings->mHeight == -1)
	{
		RectDesc rect = {};
		getRecommendedResolution(&rect);
		pSettings->mWidth = getRectWidth(rect);
		pSettings->mHeight = getRectHeight(rect);
	}

	window.windowedRect = { 0, 0, (int)pSettings->mWidth, (int)pSettings->mHeight };
	window.fullScreen = pSettings->mFullScreen;
	window.maximized = false;
	openWindow(pApp->GetName(), &window);

	pSettings->mWidth = window.fullScreen ? getRectWidth(window.fullscreenRect) : getRectWidth(window.windowedRect);
	pSettings->mHeight = window.fullScreen ? getRectHeight(window.fullscreenRect) : getRectHeight(window.windowedRect);
	pApp->pWindow = &window;
	pApp->mCommandLine = GetCommandLineA();

	if (!pApp->Init())
		return EXIT_FAILURE;

	registerWindowResizeEvent(onResize);

	while (isRunning())
	{
		float deltaTime = deltaTimer.GetMSec(true) / 1000.0f;
		// if framerate appears to drop below about 6, assume we're at a breakpoint and simulate 20fps.
		if (deltaTime > 0.15f)
			deltaTime = 0.05f;

		handleMessages();
		pApp->Update(deltaTime);
		pApp->Draw();
		
		//used in automated tests only.
		if (testing)
		{
			testingFrameCount++;
			if (testingFrameCount >= testingDesiredFrameCount)
				break;
		}
	}

	pApp->Exit();

	return 0;
}
extern "C" void Java_org_ebookdroid_droids_djvu_codec_DjvuContext_free(JNIEnv *env, jclass cls, jlong contextHandle)
{
    ddjvu_context_t* ctx = (ddjvu_context_t*) (contextHandle);
    handleMessages(env, ctx);
    ddjvu_context_release(ctx);
}
示例#17
0
void VLCNative::seek(float position) {
	DEBUG("VLCNative::seek called with pos={0}", position);
	handleMessages();
	libvlc_vlm_seek_media(vlc, medianame, position);
}
示例#18
0
int VLCNative::getTime() {
	handleMessages();
	int ret = libvlc_vlm_get_media_instance_time(vlc, medianame, 0);
	DEBUG("VLCNative::getTime = {0}", ret);
	return ret;
}
示例#19
-1
void VLCNative::startTranscoding() {
	DEBUG("VLCNative::startTranscoding called");

	// init vlc
	vlc = libvlc_new(this->argc, this->argv);
	libvlc_set_user_agent(vlc, USER_AGENT, HTTP_USER_AGENT);

	// open log
   libvlc_set_log_verbosity(vlc, 3);
   log = libvlc_log_open(vlc);

	// register for events
	eventManager = libvlc_vlm_get_event_manager(vlc);
	libvlc_event_attach(eventManager, libvlc_VlmMediaInstanceStarted, event_handler_started, (void*)this);
	libvlc_event_attach(eventManager, libvlc_VlmMediaInstanceStatusPlaying, event_handler_status_playing, (void*)this);
	libvlc_event_attach(eventManager, libvlc_VlmMediaInstanceStatusError, event_handler_status_error, (void*)this);
	libvlc_event_attach(eventManager, libvlc_VlmMediaInstanceStatusEnd, event_handler_status_end, (void*)this);

	// start broadcast
	libvlc_vlm_add_broadcast(vlc, medianame, input, sout, 0, NULL, true, false);
	this->state = CREATED;
	DEBUG("VLCNative: created media");

	// and start playing
   libvlc_vlm_play_media(vlc, medianame);
	DEBUG("VLCNative: started media")
	handleMessages();
}