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


C++ Controller::addListener方法代码示例

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


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

示例1: main

int main(int argc, char **argv)
{
    EffectRunner r;

     // Create a sample listener and controller
  SampleListener listener;
  Leap::Controller controller;

  // Have the sample listener receive events from the controller
  controller.addListener(listener);

  if (argc > 1 && strcmp(argv[1], "--bg") == 0)
    controller.setPolicy(Leap::Controller::POLICY_BACKGROUND_FRAMES);

  // Keep this process running until Enter is pressed
  //std::cout << "Press Enter to quit..." << std::endl;
  //std::cin.get();

  // Remove the sample listener when done
  //controller.removeListener(listener);

  //return 0;

    MyEffect e;
    r.setEffect(&e);

    // Defaults, overridable with command line options
    r.setMaxFrameRate(100);
    r.setLayout("../layouts/grid32x16z.json");

    return r.main(argc, argv);
}
开发者ID:RobDeBagel,项目名称:fadecandy,代码行数:32,代码来源:simple.cpp

示例2: main

int main(int argc, const char *argv[]) {

    if (argc < 2) {
        cout << "Usage: leap_high_five /path/to/serial\n";
        return 1;
    }

    LynxSSC lynx(argv[1], 115200);
//    lynx.move(3, 1500, -1, -1);
    lynx.move(3, 1500, -1, -1);
    sleep(2);
    lynx.move(4, 500, -1, 1000);
    sleep(2);
    lynx.move(
        LynxMoveGroup().move(3,1000,-1,500)
                       .move(4,1500,-1,1000));

return 0;
    cout << "Initializing controller";
    static Leap::Controller s_controller;
    FrameListener listener;
    cout << "Adding listener to controller";
    s_controller.addListener(listener);

    
    // while (running) {
    // 
    //     while (inMotion) {
    //         Jacobian3 J(armCurrent.q, armLengths); 
    //     }
    // }

    cin.get();
    return 0;
}
开发者ID:theJenix,项目名称:leap-high-five,代码行数:35,代码来源:leap_high_five.cpp

示例3: setup

//Inherited from Cinder - post-graphics initalization setup steps.  Loads our particle texture & sets up the Leap controller.
void GesturesDemo::setup() {
  ci::gl::Texture* particleTexture = new ci::gl::Texture(ci::loadImage(ci::app::loadResource(RES_PARTICLE)));
  ci::gl::disableVerticalSync(); //required for higher than 60fps
  field.SetParticleTexture(particleTexture);
  mouseIsDown = false;
  lastMousePos.set(0, 0);
  controller.addListener( listener );
}
开发者ID:sjokoladevx,项目名称:Black-Nanocopter-Down---Final-Project-Repo,代码行数:9,代码来源:GesturesDemo.cpp

示例4: main

int main(int argc, const char * argv[]) {
    MouseController listener;
    Leap::Controller controller;
    controller.addListener(listener);
    
    std::cout << "Press any key to exit" << std::endl;
    std::cin.get();
    
    controller.removeListener(listener);
    
    return 0;
}
开发者ID:revmischa,项目名称:leapmouse,代码行数:12,代码来源:main.cpp

示例5: main

int main(int argc, char **argv){

    ros::init(argc, argv, "leap_tool_control");
    RosListener listener;
    Leap::Controller controller;

    controller.addListener(listener);
    std::cout <<"Press Enter to quit..."<<std::endl;
    std::cin.get();
    controller.removeListener(listener);
    
}
开发者ID:CityU-MBE,项目名称:leap_motion_ros,代码行数:12,代码来源:tool_control.cpp

示例6: main

int main(int argc, char** argv)
{
	glutInit(&argc, argv);

	int width = 500;
	int height = 500;
	unsigned int displayMode = GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH | GLUT_STENCIL;
	displayMode = defaults(displayMode, width, height);

	glutInitDisplayMode (displayMode);
	glutInitContextVersion (3, 3);
	glutInitContextFlags(GLUT_FORWARD_COMPATIBLE);
	glutInitContextProfile(GLUT_CORE_PROFILE);
#ifdef DEBUG
	glutInitContextFlags(GLUT_DEBUG);
#endif
	glutInitWindowSize (width, height); 
	glutInitWindowPosition (300, 200);
	int window = glutCreateWindow (argv[0]);

	glload::LoadFunctions();

	glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_CONTINUE_EXECUTION);

	if(!glload::IsVersionGEQ(3, 3))
	{
		printf("Your OpenGL version is %i, %i. You must have at least OpenGL 3.3 to run this tutorial.\n",
			glload::GetMajorVersion(), glload::GetMinorVersion());
		glutDestroyWindow(window);
		return 0;
	}

	if(glext_ARB_debug_output)
	{
		glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
		glDebugMessageCallbackARB(DebugFunc, (void*)15);
	}

	init();

	UserListener listener;
	Leap::Controller controller;
	controller.addListener(listener);

	glutDisplayFunc(display); 
	glutReshapeFunc(reshape);
	glutKeyboardFunc(keyboard);
	glutMainLoop();

	controller.removeListener(listener);

	return 0;
}
开发者ID:emdeha,项目名称:random-code,代码行数:53,代码来源:framework.cpp

示例7: setup

void LeapCinderRainApp::setup()
{
	m_LeapController.addListener( m_LeapListener );

	/** timing data */
	m_fLastTime = getElapsedSeconds();
	m_fFrameTime = 0;

	/** background image */

	/** vector field */
	m_Rain = new RainController();
}
开发者ID:seanfoo73,项目名称:LeapExperiments,代码行数:13,代码来源:LeapCinderRainApp.cpp

示例8: main

void main()
{
  // リスナーを登録する
  // リスナーとのやり取りは別スレッドにて行われる
  SampleListener listener;
  Leap::Controller leap;
  leap.addListener( listener );

  leap.setPolicyFlags( Leap::Controller::PolicyFlag::POLICY_BACKGROUND_FRAMES );

  std::cout << "終了するには何かキーを押してください" << std::endl;
  std::cin.get();

  leap.removeListener( listener );
}
开发者ID:LeapBookCpp,项目名称:LeapBookCpp,代码行数:15,代码来源:main.cpp

示例9: setup

void LeapFishyApp::setup()
{
	m_LeapController.addListener( m_LeapListener );

	/** timing data */
	m_fLastTime = getElapsedSeconds();
	m_fFrameTime = 0;

	/** player setup */
	m_pPlayer = new PlayerFish();

	/** enemy fish setup */
	m_pEnemyFishes = new std::list<EnemyFish*>();
	m_nMinNumFishes = 10;

	SpawnEnemyFish( m_nMinNumFishes );
}
开发者ID:seanfoo73,项目名称:LeapExperiments,代码行数:17,代码来源:LeapFishyApp.cpp

示例10: main

int main() {
    // create instance of our Listener subclass
    Quickstart listener;
    
    // create generic Controller to interface with the Leap device
    Leap::Controller controller;
    
    // tell the Controller to start sending events to our Listener
    controller.addListener(listener);
    
    // run until user presses a key
    cin.get();
    
    // clean up
    controller.removeListener(listener);
    
    return 0;
}
开发者ID:revmischa,项目名称:leapbook,代码行数:18,代码来源:quickstart.cpp

示例11: main

int main(int argc, char **argv){

	Leap::Listener *leaplistener = new FracListener();
	fracListener = ((FracListener *) (leaplistener));
	Leap::Controller controller;
	controller.addListener(*leaplistener);



	sf::RenderWindow window(sf::VideoMode(WIDTH, HEIGHT), "SFML works!", sf::Style::Fullscreen);

	std::vector<Effect*> effects;

	Quaternion quaternion;
	effects.push_back(&quaternion);

	for (std::size_t i = 0; i < effects.size(); ++i)
		effects[i]->load();

	window.setVerticalSyncEnabled(true);

	while (window.isOpen()){
		sf::Event event;

		while (window.pollEvent(event))
		{
			if (event.type == sf::Event::Closed)
				window.close();
			if(event.type == sf::Event::KeyPressed)
			{
				if(event.key.code == sf::Keyboard::Escape)
					window.close();
			}

		}

		float mult = 1;
		if(sf::Keyboard::isKeyPressed(sf::Keyboard::LShift))
			mult = -1;
		else
			mult = 1;

		if(sf::Keyboard::isKeyPressed(sf::Keyboard::A))
			fracListener->a -= mult * 0.05;
		if(sf::Keyboard::isKeyPressed(sf::Keyboard::S))
			fracListener->b += mult * 0.05;
		if(sf::Keyboard::isKeyPressed(sf::Keyboard::D))
			fracListener->c += mult * 0.05;
		if(sf::Keyboard::isKeyPressed(sf::Keyboard::F))
			fracListener->d += mult * 0.05;

		if(sf::Keyboard::isKeyPressed(sf::Keyboard::R)){
			fracListener->a = .5f;
			fracListener->b = .5f;
			fracListener->c = .5f;
			fracListener->d = .5f;
		}

		window.clear();

		for (int i = 0; i < effects.size(); ++i){
			effects[i]->update();
		}



		for (int i = 0; i < effects.size(); ++i){
			window.draw(*(effects[i]));
		}

		window.display();
	}

	return 0;
}
开发者ID:angelazhu96,项目名称:Fractl,代码行数:75,代码来源:Main.cpp

示例12: main


//.........这里部分代码省略.........
	lut->SetRange(0, 2);
	lut->SetTableValue((vtkIdType)NOT_ACTIVE, 0, 0, 0, 0.0);
	lut->SetTableValue((vtkIdType)FOREGROUND, 1, 0, 0, 0.5);
	lut->SetTableValue((vtkIdType)BACKGROUND, 0, 0, 1, 0.3);
	lut->Build();
	mapperSel->SetLookupTable(lut);
	mapperSel->SetInputData(selection);
	mapperSel->Update();
	vtkSmartPointer<vtkImageGaussianSmooth> smoothed = vtkSmartPointer<vtkImageGaussianSmooth>::New();
	smoothed->SetInputConnection(reader->GetOutputPort());
	smoothed->SetDimensionality(3);
	smoothed->SetRadiusFactors(SMOOTHING_FACTOR_XY, SMOOTHING_FACTOR_XY, SMOOTHING_FACTOR_Z);
	//smoothed->SetStandardDeviations(0.0,0.0,0.0);
	smoothed->Update();
	//First of all set the input for the viewer!
	viewer->SetInputConnection(reader->GetOutputPort());
	// make imageviewer2 and sliceTextMapper visible to our interactorstyle
	// to enable slice status message updates when scrolling through the slices
	vtkSmartPointer<vtkImageActor> selectionA = vtkSmartPointer<vtkImageActor>::New();
	selectionA->GetMapper()->SetInputConnection(mapperSel->GetOutputPort());
	selectionA->InterpolateOff();

	// slice status message
	vtkSmartPointer<vtkTextProperty> sliceTextProp = vtkSmartPointer<vtkTextProperty>::New();
	sliceTextProp->SetFontFamilyToCourier();
	sliceTextProp->SetFontSize(20);
	sliceTextProp->SetVerticalJustificationToBottom();
	sliceTextProp->SetJustificationToLeft();

	vtkSmartPointer<vtkTextMapper> sliceTextMapper = vtkSmartPointer<vtkTextMapper>::New();
	std::string msg = StatusMessage::Format(viewer->GetSliceMin(), viewer->GetSliceMax(), viewer->GetSliceOrientation());
	sliceTextMapper->SetInput(msg.c_str());
	sliceTextMapper->SetTextProperty(sliceTextProp);

	vtkSmartPointer<vtkActor2D> sliceTextActor = vtkSmartPointer<vtkActor2D>::New();
	sliceTextActor->SetMapper(sliceTextMapper);
	sliceTextActor->SetPosition(15, 10);

	// usage hint message
	vtkSmartPointer<vtkTextProperty> usageTextProp = vtkSmartPointer<vtkTextProperty>::New();
	usageTextProp->SetFontFamilyToCourier();
	usageTextProp->SetFontSize(14);
	usageTextProp->SetVerticalJustificationToTop();
	usageTextProp->SetJustificationToLeft();

	vtkSmartPointer<vtkTextMapper> usageTextMapper = vtkSmartPointer<vtkTextMapper>::New();
	usageTextMapper->SetInput("Options:\n - Hold Shift to scroll between slices.\n - Hold Ctrl"
		" to draw segmentation.\n - Hold Alt to mark background.\n\n -- Press '1' and '2' to change"
		" brush's size\n -- Press 'o' to toggle orientation\n -- Press 's' to save segmentation\n --"
		"  Press 'l' to load segmentation\n --  Press 'r' to reset selection\n -- Press 'h' for hands-free mode.");
	usageTextMapper->SetTextProperty(usageTextProp);

	vtkSmartPointer<vtkActor2D> usageTextActor = vtkSmartPointer<vtkActor2D>::New();
	usageTextActor->SetMapper(usageTextMapper);
	usageTextActor->GetPositionCoordinate()->SetCoordinateSystemToNormalizedDisplay();
	usageTextActor->GetPositionCoordinate()->SetValue(0.05, 0.95);
	//Segmenter
	//Segmenter* _segmenter = new Segmenter((vtkStructuredPoints*)(((vtkImageMapToColors*)selectionA->GetMapper()->GetInputAlgorithm()))->GetInput(), reader->GetOutput());
	myInteractorStyle->SetImageViewer(viewer, outputName, inputFilename, selectionA, (vtkStructuredPoints*)smoothed->GetOutput()/*reader->GetOutput()*/);
	myInteractorStyle->SetStatusMapper(sliceTextMapper);
	viewer->SetupInteractor(renderWindowInteractor);
	//mapperSel->SetScalarModeToUseCellData();


	// make the interactor use our own interactorstyle
	// cause SetupInteractor() is defining it's own default interatorstyle 
	// this must be called after SetupInteractor()
	renderWindowInteractor->Initialize();
	renderWindowInteractor->SetInteractorStyle(myInteractorStyle);
	renderWindowInteractor->CreateRepeatingTimer(UPDATE_SLICE_TIMER);
	viewer->GetRenderer()->AddActor2D(sliceTextActor);
	viewer->GetRenderer()->AddActor2D(usageTextActor);
	viewer->GetRenderer()->AddActor(selectionA);
	viewer->GetRenderer()->AddActor(crosshair);
	int displayExtent[6];
	viewer->GetImageActor()->GetDisplayExtent(displayExtent);
	selectionA->SetDisplayExtent(displayExtent);
	viewer->GetRenderWindow()->SetPosition(0, 0);
	viewer->GetRenderWindow()->SetSize(viewer->GetRenderWindow()->GetScreenSize()[0] / 2, viewer->GetRenderWindow()->GetScreenSize()[1]-50);
	viewer->GetRenderWindow()->SetWindowName("Slicer");

	// Have the sample listener receive events from the controller
	cout << "passed all creations " << endl;
	controller.addListener(listener);
	LeapAbstractionLayer* lal = LeapAbstractionLayer::getInstance();
	listener.SetInterface(lal);
	cout << "set viewer on listener" << endl;
	viewer->Render();
	viewer->GetRenderer()->ResetCamera();
	cout << "Camera reset" << endl;
	viewer->Render();

	//set focus
	SetForegroundWindow(FindWindow(NULL, "Slicer"));

	renderWindowInteractor->Start();
	controller.removeListener(listener);

	return EXIT_SUCCESS;
}
开发者ID:mosheshlomo,项目名称:Engineering-Project-2014-15,代码行数:101,代码来源:ReadImageData.cpp

示例13: Impl

 Impl()
 {
     m_Controller.addListener(*this);
 }
开发者ID:IrmatDen,项目名称:sfge,代码行数:4,代码来源:controller_leap_metalpad.cpp


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