Esempio n. 1
0
void CBird::initComponent()
{
    addComponent(CAniRenderComponent::create("body", "bird"));
    addComponent(CMoveComponent::create("move"));
}
Esempio n. 2
0
bool Robot::defineRobot(){
	if(getType() == MOBILE){
		name = "Mobile Robot";
		Leaf *motor1 = new Leaf(0,0, 0,"motor0");
		Leaf *motor2 = new Leaf(1,0, 0,"motor1");
		Leaf *motor3 = new Leaf(2,0, 0,"motor2");
		Leaf *sensor1 = new Leaf(100,0, 0,"sensor1");
		Component *skeleton = new Component("Chasis");
		skeleton->add(motor1);
		skeleton->add(motor2);
		skeleton->add(motor3);
		skeleton->add(sensor1);
		addComponent(skeleton);
		printHierarchy();
		return true;
	}else if(getType() == HUMANOID){
		name = "Humanoid Robot";
		Leaf *motor1 = new Leaf(1,200, 0,"motor1");
		Leaf *motor2 = new Leaf(2,800, 0,"motor2");
		Leaf *motor3 = new Leaf(3,512, 0,"motor3");
		Leaf *motor4 = new Leaf(4,512, 0,"motor4");
		Leaf *motor5 = new Leaf(5,512, 0,"motor5");
		Leaf *motor6 = new Leaf(6,512, 0,"motor6");
		Leaf *motor7 = new Leaf(7,512, 0,"motor7");
		Leaf *motor8 = new Leaf(8,512, 0,"motor8");
		Leaf *motor9 = new Leaf(9,512, 0,"motor9");
		Leaf *motor10 = new Leaf(10,512, 0,"moto10");
		Leaf *motor11 = new Leaf(11,512, 0,"motor11");
		Leaf *motor12 = new Leaf(12,512, 0,"motor12");
		Leaf *motor13 = new Leaf(13,512, 0,"motor13");
		Leaf *motor14 = new Leaf(14,512, 0,"motor14");
		Leaf *motor15 = new Leaf(15,512, 0,"motor15");
		Leaf *motor16 = new Leaf(16,512, 0,"motor16");
		Leaf *motor17 = new Leaf(17,512, 0,"motor17");
		Leaf *motor18 = new Leaf(18,512, 0,"motor18");
		Leaf *sensor100 = new Leaf(100,512, 0,"sensor1");

		Component *chest = new Component("Arm");
		Component *right_arm = new Component("Right Arm");
		Component *left_arm = new Component("Left Arm");
		Component *torax = new Component("Torax");
		Component *right_leg = new Component("Right Leg");
		Component *left_leg = new Component("Left Leg");
		Component *head = new Component("Head");

		head->add(sensor100);
		chest->add(motor1);
		chest->add(motor2);
		right_arm->add(motor3);
		right_arm->add(motor5);
		left_arm->add(motor4);
		left_arm->add(motor6);
		torax->add(motor7);
		torax->add(motor8);
		right_leg->add(motor9);
		right_leg->add(motor11);
		right_leg->add(motor13);
		right_leg->add(motor15);
		right_leg->add(motor17);
		left_leg->add(motor10);
		left_leg->add(motor12);
		left_leg->add(motor14);
		left_leg->add(motor16);
		left_leg->add(motor18);

		addComponent(head);
		addComponent(chest);
		addComponent(right_arm);
		addComponent(left_arm);
		addComponent(torax);
		addComponent(right_leg);
		addComponent(left_leg);
		printHierarchy();
		return true;
	}
	return false;
}
Esempio n. 3
0
SkyMapComposite::SkyMapComposite(SkyComposite *parent ) :
    SkyComposite(parent), m_reindexNum( J2000 )
{
    m_skyLabeler = SkyLabeler::Instance();
    m_skyMesh = SkyMesh::Create( 3 );  // level 5 mesh = 8192 trixels
    m_skyMesh->debug( 0 );
    //  1 => print "indexing ..."
    //  2 => prints totals too
    // 10 => prints detailed lists
    // You can also set the debug level of individual
    // appendLine() and appendPoly() calls.

    //Add all components
    //Stars must come before constellation lines
#ifdef KSTARS_LITE
    addComponent( m_MilkyWay       = new MilkyWay( this ), 50);
    addComponent( m_Stars          = StarComponent::Create( this ), 10);
    addComponent( m_EquatorialCoordinateGrid = new EquatorialCoordinateGrid( this ));
    addComponent( m_HorizontalCoordinateGrid = new HorizontalCoordinateGrid( this ));

    // Do add to components.
    addComponent( m_CBoundLines = new ConstellationBoundaryLines( this ), 80);
    m_Cultures = new CultureList();
    addComponent( m_CLines     = new ConstellationLines( this, m_Cultures ), 85);
    addComponent( m_CNames     = new ConstellationNamesComponent( this, m_Cultures ), 90);
    addComponent( m_Equator    = new Equator( this ), 95);
    addComponent( m_Ecliptic   = new Ecliptic( this ), 95);
    addComponent( m_Horizon    = new HorizonComponent( this ), 100);
    addComponent( m_DeepSky    = new DeepSkyComponent( this ), 5);
    addComponent(m_ConstellationArt    = new ConstellationArtComponent( this, m_Cultures ), 100);

    addComponent( m_ArtificialHorizon = new ArtificialHorizonComponent(this), 110);

    m_internetResolvedCat = "_Internet_Resolved";
    m_manualAdditionsCat = "_Manual_Additions";
    addComponent( m_internetResolvedComponent = new SyncedCatalogComponent( this, m_internetResolvedCat, true, 0 ), 6 );
    addComponent( m_manualAdditionsComponent = new SyncedCatalogComponent( this, m_manualAdditionsCat, true, 0 ), 6 );
    m_CustomCatalogs = new SkyComposite( this );
    QStringList allcatalogs = Options::showCatalogNames();

    if(!allcatalogs.contains(m_internetResolvedCat)) {
        allcatalogs.append(m_internetResolvedCat);
    }
    if(!allcatalogs.contains(m_manualAdditionsCat)) {
        allcatalogs.append(m_manualAdditionsCat);
    }
    Options::setShowCatalogNames(allcatalogs);

    for ( int i=0; i < allcatalogs.size(); ++ i ) {
        if( allcatalogs.at(i) == m_internetResolvedCat || allcatalogs.at(i) == m_manualAdditionsCat ) // This is a special catalog
            continue;
        m_CustomCatalogs->addComponent(new CatalogComponent( this, allcatalogs.at(i), false, i ), 6 ); // FIXME: Should this be 6 or 5? See SkyMapComposite::reloadDeepSky()
    }

    addComponent( m_SolarSystem = new SolarSystemComposite( this ), 2);

    //addComponent( m_ObservingList = new TargetListComponent( this , 0, QPen(),
    //                                                       &Options::obsListSymbol, &Options::obsListText ), 120 );
    addComponent( m_StarHopRouteList = new TargetListComponent( this , 0, QPen() ), 130 );
    addComponent( m_Satellites       = new SatellitesComponent( this ), 7 );
    addComponent( m_Supernovae       = new SupernovaeComponent( this ), 7 );
    SkyMapLite::Instance()->loadingFinished();
#else
    addComponent( m_MilkyWay       = new MilkyWay( this ), 50);
    addComponent( m_Stars          = StarComponent::Create( this ), 10);
    addComponent( m_EquatorialCoordinateGrid = new EquatorialCoordinateGrid( this ));
    addComponent( m_HorizontalCoordinateGrid = new HorizontalCoordinateGrid( this ));

    // Do add to components.
    addComponent( m_CBoundLines = new ConstellationBoundaryLines( this ), 80);
    m_Cultures = new CultureList();
    addComponent( m_CLines     = new ConstellationLines( this, m_Cultures ), 85);
    addComponent( m_CNames     = new ConstellationNamesComponent( this, m_Cultures ), 90);
    addComponent( m_Equator    = new Equator( this ), 95);
    addComponent( m_Ecliptic   = new Ecliptic( this ), 95);
    addComponent( m_Horizon    = new HorizonComponent( this ), 100);
    addComponent( m_DeepSky    = new DeepSkyComponent( this ), 5);
    addComponent(m_ConstellationArt    = new ConstellationArtComponent( this, m_Cultures ), 100);

    addComponent( m_ArtificialHorizon = new ArtificialHorizonComponent(this), 110);

    m_internetResolvedCat = "_Internet_Resolved";
    m_manualAdditionsCat = "_Manual_Additions";
    addComponent( m_internetResolvedComponent = new SyncedCatalogComponent( this, m_internetResolvedCat, true, 0 ), 6 );
    addComponent( m_manualAdditionsComponent = new SyncedCatalogComponent( this, m_manualAdditionsCat, true, 0 ), 6 );
    m_CustomCatalogs = new SkyComposite( this );
    QStringList allcatalogs = Options::showCatalogNames();
    for ( int i=0; i < allcatalogs.size(); ++ i ) {
        if( allcatalogs.at(i) == m_internetResolvedCat || allcatalogs.at(i) == m_manualAdditionsCat ) // This is a special catalog
            continue;
        m_CustomCatalogs->addComponent(new CatalogComponent( this, allcatalogs.at(i), false, i ), 6 ); // FIXME: Should this be 6 or 5? See SkyMapComposite::reloadDeepSky()
    }

    addComponent( m_SolarSystem = new SolarSystemComposite( this ), 2);
    addComponent( m_Flags       = new FlagComponent( this ), 4);

    addComponent( m_ObservingList = new TargetListComponent( this , 0, QPen(),
                                                             &Options::obsListSymbol, &Options::obsListText ), 120 );
    addComponent( m_StarHopRouteList = new TargetListComponent( this , 0, QPen() ), 130 );
    addComponent( m_Satellites       = new SatellitesComponent( this ), 7 );
    addComponent( m_Supernovae       = new SupernovaeComponent( this ), 7 );
#endif
    connect( this, SIGNAL( progressText( const QString & ) ),
             KStarsData::Instance(), SIGNAL( progressText( const QString & ) ) );
}
Esempio n. 4
0
//----[  EvidyonGUIHelpDialog  ]-----------------------------------------------
EvidyonGUIHelpDialog::EvidyonGUIHelpDialog() {
  addComponent(&panel_);
  addComponent(&help_text_);
  addComponent(&ok_button_);
}
Esempio n. 5
0
void ChildWnd1::onCreate()
{
	// create the tabs
	m_tabs.create(8, 8, 400, 360);
	m_tabs.addTab("tab 1");
	m_tabs.addTab("tab 2");
	m_tabs.addTab("Buttons");
	m_tabs.addTab("Radio Buttons");
	m_tabs.addTab("Comboboxes");
	addComponent(&m_tabs);

	// create a simple push button
	m_button1.create(260, 40, "Button", 1);
	//m_button1.create(260, 40, 80, 60, "Button", 1);
	m_button1.setIcon(ResourceManager::inst()->loadImage("gears.png"), Button::NEAR_LEFT, 32,32);
	//m_button1.setFace(Button::UP, ResourceManager::inst()->loadImage("gears.png"));
	m_tabs.addComponent(&m_button1, 0);

	m_button2.create(40, 70, "Button2", 201);
	m_button2.disable();
	m_button3.create(40, 100, "Button3", 202);
	m_button3.repeatClickOnHold(true);
	m_button3.handleButtonDown(makeFunctor(*Application::inst(), &Application::onButtonDown));
	m_button4.create(40, 130, "Button4", 203, makeFunctor(*Application::inst(), &Application::onClick));
	m_button4.setFace(Button::UP, ResourceManager::inst()->loadImage("gears.png"));
	m_button4.setTextColor(Color(0.2f, 0.2f, 0.2f));
	m_button5.create(240, 130, "Button5", 203);
	m_button5.setFace(Button::UP, ResourceManager::inst()->loadImage("gears.png"));
	m_button5.setSize(100, 20);
	m_button5.setTextColor(Color(0.2f, 0.2f, 0.2f));
	//m_tabs.addComponent(&m_button1, 2);
	m_tabs.addComponent(&m_button2, 2);
	m_tabs.addComponent(&m_button3, 2);
	m_tabs.addComponent(&m_button4, 2);
	m_tabs.addComponent(&m_button5, 2);

	m_checkbox1.create(260, 70, "check here", 102);
	m_tabs.addComponent(&m_checkbox1, 0);

	m_label1.create(260, 90, "eò á !@#$%^&*()");
//	m_tabs.addComponent(&m_label1, 0);

	// create a group of radio buttons
	m_radio1.create(20, 20, "Radio Button 1", 2);
	m_radio2.create(20, 40, "Radio Button 2", 3);
	m_group.create(20, 20, 200, 80, "Radio group");
	m_group.addComponent(&m_radio1);
	m_group.addComponent(&m_radio2);
	m_tabs.addComponent(&m_group, 0);

	// create a slider (also an example of using a live
	// variable)
	m_slider.create(20, 120, 300, 4);
	m_slider.bindValue(&m_sliderPos);
	m_slider.setBounds(0, 10, 2, 20);
	m_tabs.addComponent(&m_slider, 0);

	// create a textbox
	m_textbox.create(230, 160, 130, 180, true, true);
	m_textbox.setText("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.");
	m_tabs.addComponent(&m_textbox, 0);
	
	m_listbox1.create(20, 140, 200, 200, ListBox::MULTI_SELECT_SINGLECLICK);
	m_listbox1.addItem("item 1");
	m_listbox1.addItem("disabled item 2");
	m_listbox1.addItem("item 3");
	m_listbox1.addItem("item 4");
	m_listbox1.addItem("item 5");
	for (size_t i=0; i<20; ++i)
		m_listbox1.addItem("item");
	m_listbox1.addItem("last item");
	m_listbox1.disableItem(1);
	int t1 = m_listbox1.getCurrentItem();
	m_listbox1.setCurrentItem(3);
	m_listbox1.selectItem(2, true);
	int t2 = m_listbox1.getCurrentItem();
	Console::print("%d %d\n", t1,t2);
	m_tabs.addComponent(&m_listbox1, 0);

	m_combobox1.create(230, 140, 80, 200);
	m_combobox1.addItem("item 1");
	m_combobox1.addItem("item 2");
	m_combobox1.addItem("item 3");
	m_combobox1.addItem("item 4");
	m_combobox1.disableItem(2);
	m_combobox1.setCurrentItem(1);
	/*m_combobox2.create(230, 120, 80, 200);
	m_combobox2.addItem("item 1");
	m_tabs.addComponent(&m_combobox2, 0);*/
	m_tabs.addComponent(&m_combobox1, 0);

	// create a test viewport
	Viewport vp;
	vp.setPerspectiveProj(0.1f, 100.0f, 45.0f);
	m_vp.create(40, 40, 300, 300, vp, makeFunctor(*Application::inst(), &Application::onRenderVp));
	m_tabs.addComponent(&m_vp, 1);

	// change the size of the window, so that the client area is large
	// enough to hold the contents
	setClientAreaSize(416, 410);
}
Esempio n. 6
0
int RenderHandler::addComponent(Component &componentReference)
{
    int index = addComponent(componentReference, 0);

    return index;
}
Esempio n. 7
0
void ComponentContainer::bringComponentToFront(std::shared_ptr<GUIComponent> component)
{
    removeComponent(component);
    addComponent(component);
}
Esempio n. 8
0
Color Colors::add(Color a, Color b) {
  return Colors::rgb(
      addComponent(Colors::red(a), Colors::red(b)),
      addComponent(Colors::green(a), Colors::green(b)),
      addComponent(Colors::blue(a), Colors::blue(b)));
}
Esempio n. 9
0
SelectPlayersState::SelectPlayersState() :
_playerButtons(),
_continueButton(std::make_shared<Button>("Select Module", SDLK_RETURN))
{
    //Load background
    std::shared_ptr<Image> background = std::make_shared<Image>("mp_data/menu/menu_selectplayers");
    background->setPosition(0, 0);
    background->setSize(GFX_WIDTH, GFX_HEIGHT);
    addComponent(background);

    //Add the buttons
    int yOffset = GFX_HEIGHT - 80;
    std::shared_ptr<Button> backButton = std::make_shared<Button>("Back", SDLK_ESCAPE);
    backButton->setPosition(20, yOffset);
    backButton->setSize(200, 30);
    backButton->setOnClickFunction(
        [this]{
        endState();
    });
    addComponent(backButton);

    yOffset -= backButton->getHeight() + 10;

    _continueButton->setPosition(20, yOffset);
    _continueButton->setSize(200, 30);
    _continueButton->setOnClickFunction(
        [this]{
        //Build list of all valid selected players
        std::list<std::string> selectedPlayersResult;
        for (const std::shared_ptr<LoadPlayerElement> &player : _selectedPlayers) {
            if (player != nullptr) {
                selectedPlayersResult.push_back(player->getProfile()->getPathname());
            }
        }

        //Do the select module screen next
        _gameEngine->pushGameState(std::make_shared<SelectModuleState>(selectedPlayersResult));
    });
    addComponent(_continueButton);
    _continueButton->setEnabled(false);

    //Tell them what this screen is all about
    std::shared_ptr<Label> infoText = std::make_shared<Label>("Select a character for each player that is going ot play.");
    infoText->setPosition(150, GFX_HEIGHT - 40);
    addComponent(infoText);

    //Players Label
    std::shared_ptr<Label> playersLabel = std::make_shared<Label>("PLAYERS");
    playersLabel->setPosition(20, 20);
    addComponent(playersLabel);

    std::shared_ptr<Label> characterLabel = std::make_shared<Label>("CHARACTER");
    characterLabel->setPosition(GFX_WIDTH / 3, 20);
    addComponent(characterLabel);

    yOffset = playersLabel->getY() + playersLabel->getHeight() + 20;
    for (int i = 0; i < 4; ++i) {
        std::shared_ptr<Label> playerLabel = std::make_shared<Label>(std::string("Player ") + std::to_string(i + 1));
        playerLabel->setPosition(40, yOffset);
        addComponent(playerLabel);

        std::shared_ptr<Button> playerButton = std::make_shared<Button>("Not playing");
        playerButton->setSize(200, 42);
        playerButton->setPosition(GFX_WIDTH / 3, yOffset - 10);
        playerButton->setOnClickFunction(
            [this, i]{
            _gameEngine->pushGameState(std::make_shared<SelectCharacterState>(_selectedPlayers[i]));
        }
        );
        addComponent(playerButton);

        yOffset += playerLabel->getHeight() + 50;

        //Initially select no character for each player
        _selectedPlayers.push_back(nullptr);
        _playerButtons.push_back(playerButton);
    }

    //Mark all loadable characters initially as unselected
    for (const std::shared_ptr<LoadPlayerElement> &save : ProfileSystem::get().getSavedPlayers())
    {
        save->setSelected(false);
    }
}
Esempio n. 10
0
void PlatformDemoState::buildTerrain()
{
    m_shaderResource.preload(PlatformShaderId::SpecularSmooth2D, xy::Shader::NormalMapped::vertex, NORMAL_FRAGMENT_TEXTURED);
    m_textureResource.setFallbackColour({ 127, 127, 255 });
    const auto& normalTexture = m_textureResource.get("normalFallback");

    auto background = xy::Component::create<Plat::Background>(m_messageBus, m_textureResource);
    background->setAmbientColour(m_scene.getAmbientColour());
    auto entity = xy::Entity::create(m_messageBus);
    entity->addComponent(background);
    m_scene.addEntity(entity, xy::Scene::Layer::BackRear);

    auto drawable = xy::Component::create<xy::AnimatedDrawable>(m_messageBus);
    drawable->setTexture(m_textureResource.get("assets/images/platform/left_edge.png"));
    drawable->setNormalMap(normalTexture);
    drawable->setShader(m_shaderResource.get(PlatformShaderId::SpecularSmooth2D));

    entity = xy::Entity::create(m_messageBus);
    entity->addComponent(drawable);

    m_scene.addEntity(entity, xy::Scene::Layer::BackFront);
    //-------------------------
    drawable = xy::Component::create<xy::AnimatedDrawable>(m_messageBus);
    drawable->setTexture(m_textureResource.get("assets/images/platform/ground_section.png"));
    drawable->setNormalMap(normalTexture);
    drawable->setShader(m_shaderResource.get(PlatformShaderId::SpecularSmooth2D));

    entity = xy::Entity::create(m_messageBus);
    entity->setPosition(256.f, 1080.f - 128.f);
    entity->addComponent(drawable);

    m_scene.addEntity(entity, xy::Scene::Layer::BackFront);
    //-------------------------
    drawable = xy::Component::create<xy::AnimatedDrawable>(m_messageBus);
    drawable->setTexture(m_textureResource.get("assets/images/platform/ground_section.png"));
    drawable->setNormalMap(normalTexture);
    drawable->setShader(m_shaderResource.get(PlatformShaderId::SpecularSmooth2D));

    entity = xy::Entity::create(m_messageBus);
    entity->setPosition(1024.f, 1080.f - 128.f);
    entity->addComponent(drawable);

    m_scene.addEntity(entity, xy::Scene::Layer::BackFront);
    //-------------------------
    drawable = xy::Component::create<xy::AnimatedDrawable>(m_messageBus);
    drawable->setTexture(m_textureResource.get("assets/images/platform/ground_section.png"));
    drawable->setNormalMap(normalTexture);
    drawable->setShader(m_shaderResource.get(PlatformShaderId::SpecularSmooth2D));

    entity = xy::Entity::create(m_messageBus);
    entity->setPosition(1792.f, 1080.f - 128.f);
    entity->addComponent(drawable);

    m_scene.addEntity(entity, xy::Scene::Layer::BackFront);
    //-------------------------
    drawable = xy::Component::create<xy::AnimatedDrawable>(m_messageBus);
    drawable->setTexture(m_textureResource.get("assets/images/platform/right_edge.png"));
    drawable->setNormalMap(normalTexture);
    drawable->setShader(m_shaderResource.get(PlatformShaderId::SpecularSmooth2D));

    entity = xy::Entity::create(m_messageBus);
    entity->setPosition(2560.f, 0.f);
    entity->addComponent(drawable);

    m_scene.addEntity(entity, xy::Scene::Layer::BackFront);
    //-------------------------
    auto model = m_meshRenderer.createModel(MeshID::Platform, m_messageBus);
    model->rotate(xy::Model::Axis::X, 90.f);
    model->rotate(xy::Model::Axis::Z, 180.f);
    model->setPosition({ 384.f, 158.f, 0.f });
    model->setBaseMaterial(m_meshRenderer.getMaterial(MatId::Platform01));

    entity = xy::Entity::create(m_messageBus);
    entity->setPosition(400.f, 700.f);
    entity->addComponent(model);

    m_scene.addEntity(entity, xy::Scene::Layer::BackFront);
    //-------------------------
    drawable = xy::Component::create<xy::AnimatedDrawable>(m_messageBus);
    drawable->setTexture(m_textureResource.get("assets/images/platform/plat_03.png"));
    drawable->setNormalMap(normalTexture);
    drawable->setShader(m_shaderResource.get(PlatformShaderId::SpecularSmooth2D));

    entity = xy::Entity::create(m_messageBus);
    entity->setPosition(2000.f, 550.f);
    entity->addComponent(drawable);

    m_scene.addEntity(entity, xy::Scene::Layer::BackFront);
    //-------------------------
    drawable = xy::Component::create<xy::AnimatedDrawable>(m_messageBus);
    drawable->setTexture(m_textureResource.get("assets/images/platform/plat_02.png"));
    drawable->setNormalMap(normalTexture);
    drawable->setShader(m_shaderResource.get(PlatformShaderId::SpecularSmooth2D));

    entity = xy::Entity::create(m_messageBus);
    entity->setPosition(1670.f, 450.f);
    entity->addComponent(drawable);

    m_scene.addEntity(entity, xy::Scene::Layer::BackFront);
    //-------------------------

    model = m_meshRenderer.createModel(MeshID::Platform, m_messageBus);
    model->rotate(xy::Model::Axis::X, 90.f);
    model->rotate(xy::Model::Axis::Z, 180.f);
    model->setPosition({ 384.f, 158.f, 0.f });
    model->setBaseMaterial(m_meshRenderer.getMaterial(MatId::Platform04));

    entity = xy::Entity::create(m_messageBus);
    entity->setPosition(1210.f, 600.f);
    entity->addComponent(model);

    m_scene.addEntity(entity, xy::Scene::Layer::BackFront);

    //------some shadow receivers-------//
    model = m_meshRenderer.createModel(MeshID::Quad, m_messageBus);
    model->setPosition({ 0.f, 0.f, -250.f });

    entity = xy::Entity::create(m_messageBus);
    entity->setPosition(1000.f, 702.f);
    entity->addComponent(model);
    m_scene.addEntity(entity, xy::Scene::Layer::BackFront);

    model = m_meshRenderer.createModel(MeshID::Quad, m_messageBus);
    model->rotate(xy::Model::Axis::X, 90.f);

    entity = xy::Entity::create(m_messageBus);
    entity->setPosition(1000.f, 952.f);
    entity->addComponent(model);
    m_scene.addEntity(entity, xy::Scene::Layer::BackFront);
}
Esempio n. 11
0
QgsPolygon3DSymbolEntityNode::QgsPolygon3DSymbolEntityNode( const Qgs3DMapSettings &map, QgsVectorLayer *layer, const QgsPolygon3DSymbol &symbol, const QgsFeatureRequest &req, Qt3DCore::QNode *parent )
  : Qt3DCore::QEntity( parent )
{
  addComponent( renderer( map, symbol, layer, req ) );
}
Esempio n. 12
0
//private
void PlatformDemoState::cacheMeshes()
{
    xy::CubeBuilder cb(100.f);
    m_meshRenderer.loadModel(MeshID::Cube, cb);

    xy::IQMBuilder ib("assets/models/mrfixit.iqm");
    m_meshRenderer.loadModel(MeshID::Fixit, ib);

    xy::IQMBuilder ib2("assets/models/platform_01.iqm");
    m_meshRenderer.loadModel(MeshID::Platform, ib2);

    xy::IQMBuilder ib3("assets/models/batcat.iqm");
    m_meshRenderer.loadModel(MeshID::Batcat, ib3);

    xy::QuadBuilder qb({ 1500.f, 550.f });
    m_meshRenderer.loadModel(MeshID::Quad, qb);

    xy::SphereBuilder sb(34.f, 6u);
    m_meshRenderer.loadModel(MeshID::Sphere, sb);

    auto& demoMaterial = m_meshRenderer.addMaterial(MatId::Demo, xy::Material::TexturedBumped, true);
    demoMaterial.addProperty({ "u_diffuseMap", m_textureResource.get("assets/images/platform/cube_diffuse.png") });
    demoMaterial.addProperty({ "u_normalMap", m_textureResource.get("assets/images/platform/cube_normal.png") });
    demoMaterial.addProperty({ "u_maskMap", m_textureResource.get("assets/images/platform/cube_mask.png") });
    demoMaterial.getRenderPass(xy::RenderPass::ID::ShadowMap)->setCullFace(xy::CullFace::Front);
  
    auto& fixitMaterialBody = m_meshRenderer.addMaterial(MatId::MrFixitBody, xy::Material::TexturedSkinnedBumped, true);
    fixitMaterialBody.addProperty({ "u_diffuseMap", m_textureResource.get("assets/images/fixit/fixitBody.png") });
    fixitMaterialBody.addProperty({ "u_normalMap", m_textureResource.get("assets/images/fixit/fixitBody_normal.png") });
    fixitMaterialBody.addProperty({ "u_maskMap", m_textureResource.get("assets/images/fixit/fixitBody_mask.tga") });
    fixitMaterialBody.getRenderPass(xy::RenderPass::ID::ShadowMap)->setCullFace(xy::CullFace::Front);

    auto& fixitMaterialHead = m_meshRenderer.addMaterial(MatId::MrFixitHead, xy::Material::TexturedSkinnedBumped, true);
    fixitMaterialHead.addProperty({ "u_diffuseMap", m_textureResource.get("assets/images/fixit/fixitHead.png") });
    fixitMaterialHead.addProperty({ "u_normalMap", m_textureResource.get("assets/images/fixit/fixitHead_normal.png") });
    fixitMaterialHead.addProperty({ "u_maskMap", m_textureResource.get("assets/images/fixit/fixitHead_mask.png") });
    fixitMaterialHead.getRenderPass(xy::RenderPass::ID::ShadowMap)->setCullFace(xy::CullFace::Front);

    auto& platformMaterial01 = m_meshRenderer.addMaterial(MatId::Platform01, xy::Material::Textured, true, true);
    platformMaterial01.addProperty({ "u_diffuseMap", m_textureResource.get("assets/images/platform/plat_01.png") });


    auto& platformMaterial04 = m_meshRenderer.addMaterial(MatId::Platform04, xy::Material::Textured, true, true);
    platformMaterial04.addProperty({ "u_diffuseMap", m_textureResource.get("assets/images/platform/plat_04.png") });

    auto& catMat = m_meshRenderer.addMaterial(MatId::BatcatMat, xy::Material::TexturedSkinnedBumped, true);
    auto& tex = m_textureResource.get("assets/images/platform/batcat_diffuse.png");
    tex.setRepeated(true);
    catMat.addProperty({ "u_diffuseMap", tex });
    auto& tex2 = m_textureResource.get("assets/images/platform/batcat_normal.png");
    tex2.setRepeated(true);
    catMat.addProperty({ "u_normalMap", tex2 });
    auto& tex3 = m_textureResource.get("assets/images/platform/batcat_mask.png");
    tex3.setRepeated(true);
    catMat.addProperty({ "u_maskMap", tex3 });
    catMat.getRenderPass(xy::RenderPass::ID::ShadowMap)->setCullFace(xy::CullFace::Front);


    m_textureResource.setFallbackColour(sf::Color(230, 120, 0));
    auto& sphereMat = m_meshRenderer.addMaterial(MatId::SphereTest, xy::Material::TexturedBumped, true);
    sphereMat.addProperty({ "u_diffuseMap", m_textureResource.get("assets/images/sphere_test.png") });
    sphereMat.addProperty({ "u_normalMap", m_textureResource.get("assets/images/sphere_normal.png") });
    sphereMat.addProperty({ "u_maskMap", m_textureResource.get("I don't want a mask texture!!") });
    sphereMat.getRenderPass(xy::RenderPass::ID::ShadowMap)->setCullFace(xy::CullFace::Front);

    auto& lightMaterial = m_meshRenderer.addMaterial(MatId::LightSource, xy::Material::Coloured);
    lightMaterial.addProperty({ "u_colour", sf::Color(135, 135, 80) });
    lightMaterial.addProperty({ "u_maskColour", sf::Color::Blue });

    auto light = xy::Component::create<xy::PointLight>(m_messageBus, 800.f, 500.f, sf::Color(255, 255, 100));
    light->setDepth(400.f);
    light->enableShadowCasting(true);

    auto model = m_meshRenderer.createModel(MeshID::Cube, m_messageBus);
    model->setPosition({ 0.f, 0.f, light->getWorldPosition().z });
    model->setSubMaterial(lightMaterial, 0);

    auto entity = xy::Entity::create(m_messageBus);
    entity->setPosition(xy::DefaultSceneSize / 2.f);
    entity->setScale(0.25f, 0.25f);
    entity->addComponent(light);
    entity->addComponent(model);
    m_scene.addEntity(entity, xy::Scene::Layer::FrontFront);


    //---------------
    light = xy::Component::create<xy::PointLight>(m_messageBus, 600.f, 500.f, sf::Color(255, 255, 100));
    light->setDepth(300.f);
    light->setIntensity(2.5f);
    light->enableShadowCasting(true);

    model = m_meshRenderer.createModel(MeshID::Cube, m_messageBus);
    model->setPosition({ 0.f, 0.f, light->getWorldPosition().z });
    model->setSubMaterial(lightMaterial, 0);

    entity = xy::Entity::create(m_messageBus);
    entity->setPosition(2000.f, 200.f);
    entity->setScale(0.35f, 0.35f);
    entity->addComponent(light);
    entity->addComponent(model);
    m_scene.addEntity(entity, xy::Scene::Layer::FrontFront);
}
Esempio n. 13
0
CookingTile::CookingTile(MapScreen* mapScreen) : MapDynamicTile(mapScreen) {
	addComponent(new LightComponent(LightData(
		sf::Vector2f(TILE_SIZE_F * 0.5f, TILE_SIZE_F * 0.5f),
		sf::Vector2f(100.f, 100.f)), this));
	addComponent(new TooltipComponent(g_textProvider->getText("Fireplace"), this));
}
TEST_F(OsgSkeletonRepresentationRenderTests, BasicTest)
{
	auto graphics = std::make_shared<SurgSim::Graphics::OsgSkeletonRepresentation>("Skeleton");
	graphics->loadModel("OsgSkeletonRepresentationRenderTests/rigged_cylinder.osgt");
	graphics->setSkinningShaderFileName("Shaders/skinning.vert");
	auto sceneElement = std::make_shared<SurgSim::Framework::BasicSceneElement>("Rigged Cylinder");
	sceneElement->addComponent(graphics);
	scene->addSceneElement(sceneElement);

	viewElement->setPose(SurgSim::Math::makeRigidTransform(
							 Vector3d(-0.3, 0.3, -0.3),
							 Vector3d(0.0, 0.0, 0.0),
							 Vector3d(0.0, 0.0, 1.0)));

	runtime->start();
	boost::this_thread::sleep(boost::posix_time::milliseconds(2000));

	std::pair<RigidTransform3d, RigidTransform3d> rootTransform;
	rootTransform.first =
		makeRigidTransform(makeRotationQuaternion(0.0, Vector3d(1.0, 1.0, 1.0)), Vector3d::Zero());
	rootTransform.second =
		makeRigidTransform(makeRotationQuaternion(0.0, Vector3d(1.0, 1.0, 1.0)), Vector3d::Zero());

	std::pair<RigidTransform3d, RigidTransform3d> boneTransform;
	boneTransform.first =
		makeRigidTransform(makeRotationQuaternion(0.0, Vector3d(1.0, 0.0, 0.0)), Vector3d::Zero());
	boneTransform.second =
		makeRigidTransform(makeRotationQuaternion(0.0, Vector3d(1.0, 0.0, 0.0)), Vector3d(0.0, 4.0, 0.0));

	int numSteps = 1000;

	for (int i = 0; i < numSteps; ++i)
	{
		double t = static_cast<double>(i) / numSteps;

		RigidTransform3d pose = interpolate(rootTransform, t);
		sceneElement->setPose(pose);

		pose = interpolate(boneTransform, t / 3.0);
		graphics->setBonePose("Bone", RigidTransform3d::Identity());
		graphics->setBonePose("Bone_001", pose);
		graphics->setBonePose("Bone_002", pose);
		graphics->setBonePose("Bone_003", pose);

		/// The total number of steps should complete in 5 seconds
		boost::this_thread::sleep(boost::posix_time::milliseconds(5000 / numSteps));
	}

	rootTransform.first =
		makeRigidTransform(makeRotationQuaternion(0.0, Vector3d(1.0, 1.0, 1.0)), Vector3d::Zero());
	rootTransform.second =
		makeRigidTransform(makeRotationQuaternion(M_2_PI, Vector3d(1.0, 1.0, 1.0)), Vector3d::Zero());

	boneTransform.first =
		makeRigidTransform(makeRotationQuaternion(0.0, Vector3d(1.0, 0.0, 0.0)), Vector3d::Zero());
	boneTransform.second =
		makeRigidTransform(makeRotationQuaternion(M_PI, Vector3d(1.0, 0.0, 0.0)), Vector3d::Zero());

	for (int i = 0; i < numSteps; ++i)
	{
		double t = static_cast<double>(i) / numSteps;

		RigidTransform3d pose = interpolate(rootTransform, t);
		sceneElement->setPose(pose);

		pose = interpolate(boneTransform, t / 3.0);
		graphics->setBonePose("Bone", pose);
		graphics->setBonePose("Bone_001", pose);
		graphics->setBonePose("Bone_002", pose);
		graphics->setBonePose("Bone_003", pose);

		/// The total number of steps should complete in 5 seconds
		boost::this_thread::sleep(boost::posix_time::milliseconds(5000 / numSteps));
	}

	runtime->stop();
}
DebugObjectLoadingState::DebugObjectLoadingState() :
#ifdef _MSC_VER
    _finishedLoading( {
    0
}),
#else
    _finishedLoading(false),
#endif
_loadingThread(),
_scrollableList(),
_moduleList(),
_toLoad(),
_currentLoader()
{
    const int SCREEN_WIDTH = _gameEngine->getUIManager()->getScreenWidth();
    const int SCREEN_HEIGHT = _gameEngine->getUIManager()->getScreenHeight();

    _scrollableList = std::make_shared<ScrollableList>();
    _scrollableList->setPosition(8, 8);
    _scrollableList->setSize(SCREEN_WIDTH - 16, SCREEN_HEIGHT - 56);

    _moduleList.emplace_back(new GlobalLoader());

    vfs_search_context_t *context = vfs_findFirst("/modules", "mod", VFS_SEARCH_DIR | VFS_SEARCH_BARE);

    while (context)
    {
        std::string moduleName = vfs_search_context_get_current(context);
        auto module = std::make_shared<ModuleLoader>(moduleName);
        _moduleList.emplace_back(module);
        vfs_findNext(&context);
    }
    vfs_findClose(&context);

    for (const auto &loader : _moduleList) {
        auto button = std::make_shared<Button>(loader->getModuleName());
        std::weak_ptr<ModuleLoader> loaderPtr = loader;
        button->setWidth(SCREEN_WIDTH - 72);
        button->setOnClickFunction([this, loaderPtr] { addToQueue(loaderPtr.lock()); });
        _scrollableList->addComponent(button);

        _currentLoader = loader;
        loader->loadObjectList();

        for (const auto &object : loader->getObjectList()) {
            std::weak_ptr<ObjectGUIContainer> objectPtr = object;
            object->setOnClick([this, objectPtr] { addToQueue(objectPtr.lock()); });
            _scrollableList->addComponent(object);
        }
    }
    _scrollableList->forceUpdate();
    addComponent(_scrollableList);

    std::shared_ptr<Button> back = std::make_shared<Button>("Back");
    back->setPosition(8, SCREEN_HEIGHT - 30 - 8);
    back->setSize(150, 30);
    back->setOnClickFunction([this] { endState(); });
    addComponent(back);

    std::shared_ptr<Button> loadAll = std::make_shared<Button>("Load All");
    loadAll->setPosition(SCREEN_WIDTH - 150 - 8, SCREEN_HEIGHT - 30 - 8);
    loadAll->setSize(150, 30);
    loadAll->setOnClickFunction([this] { for (const auto &a : _moduleList) addToQueue(a); });
    addComponent(loadAll);
}
Esempio n. 16
0
void Steinhardt::calculateVector(){
  double dfunc, dpoly_ass, md, tq6, itq6, real_z, imag_z; 
  Vector distance, dz, myrealvec, myimagvec, real_dz, imag_dz;
  // The square root of -1
  std::complex<double> ii( 0.0, 1.0 ), dp_x, dp_y, dp_z;

  double sw, poly_ass, dlen, nbond=0.0; std::complex<double> powered;
  for(unsigned i=1;i<getNAtoms();++i){
     distance=getSeparation( getPosition(0), getPosition(i) );
     dlen=distance.modulo(); sw = switchingFunction.calculate( dlen, dfunc );
     if( sw>=getTolerance() ){   
         nbond += sw;  // Accumulate total number of bonds
         double dlen3 = dlen*dlen*dlen;

         // Store derivatives of weight
         MultiColvarBase::addAtomsDerivatives( 0, getAtomIndex(0), (-dfunc)*distance );
         MultiColvarBase::addAtomsDerivatives( 0, getAtomIndex(i), (+dfunc)*distance );
         MultiColvarBase::addBoxDerivatives( 0, (-dfunc)*Tensor( distance,distance ) ); 

         // Do stuff for m=0
         poly_ass=deriv_poly( 0, distance[2]/dlen, dpoly_ass );
         // Derivatives of z/r wrt x, y, z
         dz = -( distance[2] / dlen3 )*distance; dz[2] += (1.0 / dlen);
         // Derivative wrt to the vector connecting the two atoms
         myrealvec = (+sw)*dpoly_ass*dz + poly_ass*(+dfunc)*distance;
         // Accumulate the derivatives
         addAtomsDerivative( tmom, 0, -myrealvec );      
         addAtomsDerivative( tmom, i, myrealvec ); 
         addBoxDerivatives( tmom, Tensor( -myrealvec,distance ) );
         // And store the vector function
         addComponent( tmom, sw*poly_ass );

         // The complex number of which we have to take powers
         std::complex<double> com1( distance[0]/dlen ,distance[1]/dlen );

         // Do stuff for all other m values
         for(unsigned m=1;m<=tmom;++m){
             // Calculate Legendre Polynomial
             poly_ass=deriv_poly( m, distance[2]/dlen, dpoly_ass );
             // Calculate powe of complex number
             powered=pow(com1,m-1); md=static_cast<double>(m);
             // Real and imaginary parts of z
             real_z = real(com1*powered); imag_z = imag(com1*powered );
 
             // Calculate steinhardt parameter
             tq6=poly_ass*real_z;   // Real part of steinhardt parameter
             itq6=poly_ass*imag_z;  // Imaginary part of steinhardt parameter

             // Derivatives wrt ( x/r + iy )^m
             dp_x = md*powered*( (1.0/dlen)-(distance[0]*distance[0])/dlen3-ii*(distance[0]*distance[1])/dlen3 );
             dp_y = md*powered*( ii*(1.0/dlen)-(distance[0]*distance[1])/dlen3-ii*(distance[1]*distance[1])/dlen3 );
             dp_z = md*powered*( -(distance[0]*distance[2])/dlen3-ii*(distance[1]*distance[2])/dlen3 );

             // Derivatives of real and imaginary parts of above
             real_dz[0] = real( dp_x ); real_dz[1] = real( dp_y ); real_dz[2] = real( dp_z );
             imag_dz[0] = imag( dp_x ); imag_dz[1] = imag( dp_y ); imag_dz[2] = imag( dp_z );  

             // Complete derivative of steinhardt parameter
             myrealvec = (+sw)*dpoly_ass*real_z*dz + (+dfunc)*distance*tq6 + (+sw)*poly_ass*real_dz; 
             myimagvec = (+sw)*dpoly_ass*imag_z*dz + (+dfunc)*distance*itq6 + (+sw)*poly_ass*imag_dz;

             // Real part
             addComponent( tmom+m, sw*tq6 );
             addAtomsDerivative( tmom+m, 0, -myrealvec );
             addAtomsDerivative( tmom+m, i, myrealvec );
             addBoxDerivatives( tmom+m, Tensor( -myrealvec,distance ) );
             // Imaginary part 
             addImaginaryComponent( tmom+m, sw*itq6 );
             addImaginaryAtomsDerivative( tmom+m, 0, -myimagvec );
             addImaginaryAtomsDerivative( tmom+m, i, myimagvec );
             addImaginaryBoxDerivatives( tmom+m, Tensor( -myimagvec,distance ) );
             // Store -m part of vector
             double pref=pow(-1.0,m); 
             // -m part of vector is just +m part multiplied by (-1.0)**m and multiplied by complex
             // conjugate of Legendre polynomial
             // Real part
             addComponent( tmom-m, pref*sw*tq6 );
             addAtomsDerivative( tmom-m, 0, -pref*myrealvec );
             addAtomsDerivative( tmom-m, i, pref*myrealvec );
             addBoxDerivatives( tmom-m, pref*Tensor( -myrealvec,distance ) );
             // Imaginary part
             addImaginaryComponent( tmom-m, -pref*sw*itq6 );
             addImaginaryAtomsDerivative( tmom-m, 0, pref*myimagvec );
             addImaginaryAtomsDerivative( tmom-m, i, -pref*myimagvec );
             addImaginaryBoxDerivatives( tmom-m, pref*Tensor( myimagvec,distance ) );
         }
     } else {
         removeAtomRequest( i, sw );
     }
  } 

  // Normalize 
  setElementValue(0, nbond ); updateActiveAtoms();
  for(unsigned i=0;i<2*getNumberOfComponentsInVector();++i) quotientRule( 5+i, 0, 5+i ); 
  // Clear tempory stuff
  clearDerivativesAfterTask(0);
}
void UnplacedComponentsDock::on_btnAdd_clicked()
{
    if (mBoard && mSelectedGenComp && mSelectedComponent)
        addComponent(*mSelectedGenComp, mSelectedComponent->getUuid());
    updateComponentsList();
}
Esempio n. 18
0
 void
 Path::addComponent(const std::string & component)
 {
   addComponent(component.c_str());
 }
Esempio n. 19
0
int RenderHandler::addComponent(sf::Sprite &sprRef)
{
    return addComponent(sprRef, 0);
}
Esempio n. 20
0
RandomPolygonMenu::RandomPolygonMenu( App* app ) : Menu( app ){
	seedSlider = new SliderComponent( vec2(200, 20), this );
	polygonSidesSlider = new SliderComponent( vec2(200, 40), this );
	polygonPointsSlider = new SliderComponent( vec2(200, 60), this );
	polygonNumTriesSlider = new SliderComponent( vec2(200, 80), this );
	polygonScaleSlider = new SliderComponent( vec2(200, 100), this );
	polygonHolesSlider = new SliderComponent( vec2(200, 120), this );

	seedLabel = new LabelComponent( "0", vec2(260, 16), this );
	polygonSidesLabel = new LabelComponent( "5", vec2(260, 36), this );
	polygonPointsLabel = new LabelComponent( "5", vec2(260, 56), this );
	polygonNumTriesLabel = new LabelComponent( "10", vec2(260, 76), this );
	polygonScaleLabel = new LabelComponent( "8", vec2(260, 96), this );
	polygonHolesLabel = new LabelComponent( "0", vec2(260, 116), this );

	polygonTypeCheckbox = new CheckboxComponent( {"Smooth random polygon", "Random polygon"}, vec2(320, 20), this );
	polygonTypeCheckbox->setSelected( 0 );

	startButton = new ButtonComponent( "START", vec2( 650, 50), [=](){
		srand( seedSlider->getPercent() * RAND_MAX );
		app->setWorld( new GameWorld( cueTable ) );
		app->setMenu( 0 );
	}, this );

	errorLabel = new LabelComponent( "", vec2(320,90), this );

	world = new RandomTableWorld();

	addComponent( new LabelComponent( "Seed:", vec2(50, 16), this ) );
	addComponent( new LabelComponent( "Sides:", vec2(50, 36), this ) );
	addComponent( new LabelComponent( "Points", vec2(50, 56), this ) );
	addComponent( new LabelComponent( "NumTries:", vec2(50, 76), this ) );
	addComponent( new LabelComponent( "Scale:", vec2(50, 96), this ) );
	addComponent( new LabelComponent( "Holes:", vec2(50, 116), this ) );

	addComponent( seedSlider );
	addComponent( polygonSidesSlider );
	addComponent( polygonPointsSlider );
	addComponent( polygonNumTriesSlider );
	addComponent( polygonScaleSlider );
	addComponent( polygonHolesSlider );

	addComponent( seedLabel );
	addComponent( polygonSidesLabel );
	addComponent( polygonPointsLabel );
	addComponent( polygonNumTriesLabel );
	addComponent( polygonScaleLabel );
	addComponent( polygonHolesLabel );

	addComponent( polygonTypeCheckbox );
	addComponent( startButton );
	addComponent( errorLabel );

	seedSlider->setValue( 0 );
	polygonSidesSlider->setValue( 0 );
	polygonPointsSlider->setValue( 0 );
	polygonNumTriesSlider->setValue( 0 );
	polygonScaleSlider->setValue( 0 );
	polygonHolesSlider->setValue( 0 );

	generateTable();
}
Esempio n. 21
0
		template<typename T> void addComponent(T* component) { addComponent(component, T::getStaticClassID()); }
Esempio n. 22
0
SelectModuleState::SelectModuleState(const std::list<std::string> &playersToLoad) :
	_onlyStarterModules(playersToLoad.empty()),
	_validModules(),
	_background(std::make_shared<Ego::GUI::Image>()),
	_filterButton(std::make_shared<Ego::GUI::Button>("All Modules", SDLK_TAB)),
	_chooseModule(std::make_shared<Ego::GUI::Button>("Choose Module", SDLK_RETURN)),
	_moduleSelector(std::make_shared<Ego::GUI::ModuleSelector>(_validModules)),
	_moduleFilter(FILTER_OFF),
	_selectedPlayerList(playersToLoad)
{
	const int SCREEN_WIDTH = _gameEngine->getUIManager()->getScreenWidth();
	const int SCREEN_HEIGHT = _gameEngine->getUIManager()->getScreenHeight();

	//Set default filter
	if(_onlyStarterModules)
	{
		setModuleFilter(FILTER_STARTER);
	}
	else
	{
		setModuleFilter(FILTER_OFF);
	}
	addComponent(_background);

	//Add the buttons
	_chooseModule = std::make_shared<Ego::GUI::Button>("Choose Module", SDLK_RETURN);
	_chooseModule->setPosition(Point2f(_moduleSelector->getX() + _moduleSelector->getWidth() + 20, SCREEN_HEIGHT / 2 + 20));
	_chooseModule->setSize(Vector2f(200, 30));
	_chooseModule->setEnabled(false);
    _connections.push_back(_chooseModule->Clicked.subscribe(
	[this]{
		if(_moduleSelector->getSelectedModule())
		{
			_gameEngine->setGameState(std::make_shared<LoadingState>(_moduleSelector->getSelectedModule(), _selectedPlayerList));
		}
	}));
	addComponent(_chooseModule);

	_backButton = std::make_shared<Ego::GUI::Button>("Back", SDLK_ESCAPE);
	_backButton->setPosition(Point2f(_moduleSelector->getX() + _moduleSelector->getWidth() + 20, _chooseModule->getY() + 50));
	_backButton->setSize(Vector2f(200, 30));
    _connections.push_back(_backButton->Clicked.subscribe(
		[this]{
			this->endState();
		}));
	addComponent(_backButton);

	//Add the module selector
	addComponent(_moduleSelector);

	//Only draw module filter for non-starter games
	if(!_onlyStarterModules)
	{
		_filterButton->setPosition(Point2f(10 + SCREEN_WIDTH/2, 30));
		_filterButton->setSize(Vector2f(200, 30));
        _connections.push_back(_filterButton->Clicked.subscribe(
			[this]{
				//Set next module filter (wrap around using modulo)
				setModuleFilter(static_cast<ModuleFilter>( (_moduleFilter+1) % NR_OF_MODULE_FILTERS) );
			}));
		addComponent(_filterButton);		
	}

	//Help text
	auto infoText = std::make_shared<Ego::GUI::Label>("Press an icon to select a game.\n"
		  								              "Use the mouse wheel or the <- and -> buttons to scroll.");
	infoText->setPosition(Point2f(200, SCREEN_HEIGHT - 70));
	addComponent(infoText);

}
Esempio n. 23
0
bool JucerDocumentEditor::perform (const InvocationInfo& info)
{
    ComponentLayout* const currentLayout = getCurrentLayout();
    PaintRoutine* const currentPaintRoutine = getCurrentPaintRoutine();

    document->beginTransaction();

    if (info.commandID >= JucerCommandIDs::newComponentBase
         && info.commandID < JucerCommandIDs::newComponentBase + ObjectTypes::numComponentTypes)
    {
        addComponent (info.commandID - JucerCommandIDs::newComponentBase);
        return true;
    }

    if (info.commandID >= JucerCommandIDs::newElementBase
         && info.commandID < JucerCommandIDs::newElementBase + ObjectTypes::numElementTypes)
    {
        addElement (info.commandID - JucerCommandIDs::newElementBase);
        return true;
    }

    switch (info.commandID)
    {
        case StandardApplicationCommandIDs::undo:
            document->getUndoManager().undo();
            document->dispatchPendingMessages();
            break;

        case StandardApplicationCommandIDs::redo:
            document->getUndoManager().redo();
            document->dispatchPendingMessages();
            break;

        case JucerCommandIDs::test:
            TestComponent::showInDialogBox (*document);
            break;

        case JucerCommandIDs::enableSnapToGrid:
            document->setSnappingGrid (document->getSnappingGridSize(),
                                       ! document->isSnapActive (false),
                                       document->isSnapShown());
            break;

        case JucerCommandIDs::showGrid:
            document->setSnappingGrid (document->getSnappingGridSize(),
                                       document->isSnapActive (false),
                                       ! document->isSnapShown());
            break;

        case JucerCommandIDs::editCompLayout:
            showLayout();
            break;

        case JucerCommandIDs::editCompGraphics:
            showGraphics (0);
            break;

        case JucerCommandIDs::zoomIn:      setZoom (snapToIntegerZoom (getZoom() * 2.0)); break;
        case JucerCommandIDs::zoomOut:     setZoom (snapToIntegerZoom (getZoom() / 2.0)); break;
        case JucerCommandIDs::zoomNormal:  setZoom (1.0); break;

        case JucerCommandIDs::spaceBarDrag:
            if (EditingPanelBase* panel = dynamic_cast <EditingPanelBase*> (tabbedComponent.getCurrentContentComponent()))
                panel->dragKeyHeldDown (info.isKeyDown);

            break;

        case JucerCommandIDs::compOverlay0:
        case JucerCommandIDs::compOverlay33:
        case JucerCommandIDs::compOverlay66:
        case JucerCommandIDs::compOverlay100:
            {
                int amount = 0;

                if (info.commandID == JucerCommandIDs::compOverlay33)
                    amount = 33;
                else if (info.commandID == JucerCommandIDs::compOverlay66)
                    amount = 66;
                else if (info.commandID == JucerCommandIDs::compOverlay100)
                    amount = 100;

                document->setComponentOverlayOpacity (amount * 0.01f);
            }
            break;

        case JucerCommandIDs::bringBackLostItems:
            if (EditingPanelBase* panel = dynamic_cast <EditingPanelBase*> (tabbedComponent.getCurrentContentComponent()))
            {
                int w = panel->getComponentArea().getWidth();
                int h = panel->getComponentArea().getHeight();

                if (currentPaintRoutine != nullptr)
                    currentPaintRoutine->bringLostItemsBackOnScreen (panel->getComponentArea());
                else if (currentLayout != nullptr)
                    currentLayout->bringLostItemsBackOnScreen (w, h);
            }

            break;

        case JucerCommandIDs::toFront:
            if (currentLayout != nullptr)
                currentLayout->selectedToFront();
            else if (currentPaintRoutine != nullptr)
                currentPaintRoutine->selectedToFront();

            break;

        case JucerCommandIDs::toBack:
            if (currentLayout != nullptr)
                currentLayout->selectedToBack();
            else if (currentPaintRoutine != nullptr)
                currentPaintRoutine->selectedToBack();

            break;

        case JucerCommandIDs::group:
            if (currentPaintRoutine != nullptr)
                currentPaintRoutine->groupSelected();
            break;

        case JucerCommandIDs::ungroup:
            if (currentPaintRoutine != nullptr)
                currentPaintRoutine->ungroupSelected();
            break;

        case StandardApplicationCommandIDs::cut:
            if (currentLayout != nullptr)
            {
                currentLayout->copySelectedToClipboard();
                currentLayout->deleteSelected();
            }
            else if (currentPaintRoutine != nullptr)
            {
                currentPaintRoutine->copySelectedToClipboard();
                currentPaintRoutine->deleteSelected();
            }

            break;

        case StandardApplicationCommandIDs::copy:
            if (currentLayout != nullptr)
                currentLayout->copySelectedToClipboard();
            else if (currentPaintRoutine != nullptr)
                currentPaintRoutine->copySelectedToClipboard();

            break;

        case StandardApplicationCommandIDs::paste:
            {
                ScopedPointer<XmlElement> doc (XmlDocument::parse (SystemClipboard::getTextFromClipboard()));

                if (doc != nullptr)
                {
                    if (doc->hasTagName (ComponentLayout::clipboardXmlTag))
                    {
                        if (currentLayout != nullptr)
                            currentLayout->paste();
                    }
                    else if (doc->hasTagName (PaintRoutine::clipboardXmlTag))
                    {
                        if (currentPaintRoutine != nullptr)
                            currentPaintRoutine->paste();
                    }
                }
            }
            break;

        case StandardApplicationCommandIDs::del:
            if (currentLayout != nullptr)
                currentLayout->deleteSelected();
            else if (currentPaintRoutine != nullptr)
                currentPaintRoutine->deleteSelected();
            break;

        case StandardApplicationCommandIDs::selectAll:
            if (currentLayout != nullptr)
                currentLayout->selectAll();
            else if (currentPaintRoutine != nullptr)
                currentPaintRoutine->selectAll();
            break;

        case StandardApplicationCommandIDs::deselectAll:
            if (currentLayout != nullptr)
            {
                currentLayout->getSelectedSet().deselectAll();
            }
            else if (currentPaintRoutine != nullptr)
            {
                currentPaintRoutine->getSelectedElements().deselectAll();
                currentPaintRoutine->getSelectedPoints().deselectAll();
            }

            break;

        default:
            return false;
    }

    document->beginTransaction();
    return true;
}
void EvidyonGUIModule_Bazaar::create(GUICanvas* source_canvas,
    GUIFont* button_font,
    const Item::ItemClientDescription* item_descriptions,
    size_t number_of_item_descriptions,
    const ClientAvatarInventoryItem* inventory,
    EvidyonGUITooltipBox* tooltip) {

  items_in_category_.create(this,
                            source_canvas,
                            button_font,
                            item_descriptions,
                            number_of_item_descriptions,
                            tooltip);
  inventory_.create(this,
                    source_canvas,
                    button_font,
                    item_descriptions,
                    number_of_item_descriptions,
                    inventory,
                    tooltip);

  create_listing_prompt_.create(source_canvas, this, button_font);

  addSubmodule(&items_in_category_);

  // Categories only shown if not listing own items
  for (int i = 0; i < CATEGORY_COUNT; ++i) {
    BazaarCategory category = BazaarCategory(i);
    EvidyonGUIButton* button = getCategoryButton(category);
    button->setText(BazaarCategoryString(category));
    button->setFont(button_font);
    alignButton(source_canvas, button, i);
  }

  {
    EvidyonGUIButton* button = getCreateListingButton();
    button->setText("Create Listing");
    button->setFont(button_font);
    alignButton(source_canvas, button, -1);
  }

  {
    EvidyonGUIButton* button = getCategoryButton(CATEGORY_OWNITEMS);
    button->setText("Listed Items");
    button->setFont(button_font);
    alignButton(source_canvas, button, -2);
  }

  {
    EvidyonGUIButton* button = getExitButton();
    button->setText("Leave the Bazaar");
    button->setFont(button_font);
    GUICanvas* canvas = button->getCanvas();
    canvas->setSourceCanvas(items_in_category_.getListCanvas());
    canvas->alignYBottomOutside(+10);
    canvas->alignXCenter(0);
    canvas->relativeWidth(-50);
    canvas->absoluteHeight(35);
    canvas->relativeDepth(0.0f);
  }

  for (int i = 0; i < CATEGORY_COUNT + 3; ++i) {
    addComponent(getButton(i));
  }


  memset(own_items_, 0, sizeof(ItemInBazaar) * MAX_ITEMS_PER_BAZAAR_CATEGORY);
  number_of_own_items_ = 0;
}
Esempio n. 25
0
void STEntity::addScriptComponent(const std::string &script) {
    addComponent(typeid(STScriptComponent*), new STScriptComponent(this, script));
}
Esempio n. 26
0
bool MonsterRush::init()
{
	if (!BaseComponent::init())
	{
		return false;
	}

	m_Type = OT_MONSTER_RUSH;

	//물리 초기화

	auto meterial = cocos2d::PhysicsMaterial(0, 0, 0);
	m_Body = cocos2d::PhysicsBody::createBox(cocos2d::Size(RUSH_WIDTH, RUSH_HEIGHT), meterial, cocos2d::Point(0, 0));
	m_Body->setContactTestBitmask(PHYC_BLOCK | PHYC_PLAYER | PHYC_MISSILE);
	m_Body->setCategoryBitmask(PHYC_MONSTER);
	m_Body->setCollisionBitmask(PHYC_BLOCK | PHYC_FLOOR | PHYC_MISSILE);
	m_Body->setMass(10);
	m_Body->setRotationEnable(false);
	m_Body->setVelocityLimit(1000);
	m_Body->setVelocity(cocos2d::Vec2(0, 0));
	m_Body->setDynamic(true);
	m_Body->retain();
	setPhysicsBody(m_Body);

	//FSM 초기화
	initFSM(1);
	m_States[0] = STAT_IDLE;

	m_FSMs[0].resize(STAT_NUM);
	m_FSMs[0][STAT_IDLE] = nullptr;
	m_FSMs[0][STAT_MOVE] = move;
	m_FSMs[0][STAT_KNOCKBACK] = CommonState::knockback;

	m_Transitions[0].resize(STAT_NUM);
	m_Transitions[0][STAT_IDLE] = idleTransition;
	m_Transitions[0][STAT_MOVE] = moveTransition;
	m_Transitions[0][STAT_KNOCKBACK] = FSM_CALLBACK(MonsterRush::knockbackTransition, this);


	m_Renders[0].resize(STAT_NUM);
	m_Renders[0][STAT_IDLE] = GET_COMPONENT_MANAGER()->createComponent<AnimationComponent>();
	( (AnimationComponent*) m_Renders[0][STAT_IDLE] )->setAnimation(AT_MONSTER_RUSH_IDLE, this);
	m_Renders[0][STAT_MOVE] = GET_COMPONENT_MANAGER()->createComponent<AnimationComponent>();
	( (AnimationComponent*) m_Renders[0][STAT_MOVE] )->setAnimation(AT_MONSTER_RUSH_MOVE, this);
	m_Renders[0][STAT_KNOCKBACK] = GET_COMPONENT_MANAGER()->createComponent<AnimationComponent>();
	((AnimationComponent*)m_Renders[0][STAT_KNOCKBACK])->setAnimation(AT_MONSTER_RUSH_IDLE, this);

	for(int i = 0; i < m_Renders[0].size(); i++)
	{
		addComponent(m_Renders[0][i]);
	}

	//info 설정
	auto data = GET_DATA_MANAGER()->getMonsterInfo(OT_MONSTER_RUSH);

	if (data != nullptr)
	{
		m_Info = *GET_DATA_MANAGER()->getMonsterInfo(OT_MONSTER_RUSH);
	}

	m_Info.m_CurrentHp = m_Info.m_MaxHp;

	return true;
}
Esempio n. 27
0
SkyMapComposite::SkyMapComposite(SkyComposite *parent ) :
        SkyComposite(parent), m_reindexNum( J2000 )
{
    m_skyLabeler = SkyLabeler::Instance();
    m_skyMesh = SkyMesh::Create( 3 );  // level 5 mesh = 8192 trixels
    m_skyMesh->debug( 0 );
    //  1 => print "indexing ..."
    //  2 => prints totals too
    // 10 => prints detailed lists
    // You can also set the debug level of individual
    // appendLine() and appendPoly() calls.

    //Add all components
    //Stars must come before constellation lines
    addComponent( m_MilkyWay       = new MilkyWay( this ), 50);
    addComponent( m_Stars          = StarComponent::Create( this ), 10);
    addComponent( m_EquatorialCoordinateGrid = new EquatorialCoordinateGrid( this ));
    addComponent( m_HorizontalCoordinateGrid = new HorizontalCoordinateGrid( this ));

    // Do add to components.
    addComponent( m_CBoundLines = new ConstellationBoundaryLines( this ), 80);
    m_Cultures = new CultureList();
    addComponent( m_CLines     = new ConstellationLines( this, m_Cultures ), 85);
    addComponent( m_CNames     = new ConstellationNamesComponent( this, m_Cultures ), 90);    
    addComponent( m_Equator    = new Equator( this ), 95);
    addComponent( m_Ecliptic   = new Ecliptic( this ), 95);
    addComponent( m_Horizon    = new HorizonComponent( this ), 100);
    addComponent( m_DeepSky    = new DeepSkyComponent( this ), 5);
    addComponent(m_ConstellationArt    = new ConstellationArtComponent( this, m_Cultures ), 100);

    addComponent( m_ArtificialHorizon = new ArtificialHorizonComponent(this), 110);

    m_CustomCatalogs = new SkyComposite( this );
    QStringList allcatalogs = Options::showCatalogNames();
    for ( int i=0; i < allcatalogs.size(); ++ i ) {
        m_CustomCatalogs->addComponent(
                                       new CatalogComponent( this, allcatalogs.at(i), false, i ), 6
            );
    }

    addComponent( m_SolarSystem = new SolarSystemComposite( this ), 2);
    addComponent( m_Flags       = new FlagComponent( this ), 4);

    addComponent( m_ObservingList = new TargetListComponent( this , 0, QPen(),
                                                             &Options::obsListSymbol, &Options::obsListText ), 120 );
    addComponent( m_StarHopRouteList = new TargetListComponent( this , 0, QPen() ), 130 );
    addComponent( m_Satellites       = new SatellitesComponent( this ), 7 );
    addComponent( m_Supernovae       = new SupernovaeComponent( this ), 7 );

    connect( this, SIGNAL( progressText( const QString & ) ),
             KStarsData::Instance(), SIGNAL( progressText( const QString & ) ) );
}
Esempio n. 28
0
void Main::onInitialize() {
    mScore1 = 0;
    mScore2 = 0;

    auto scene = addScene(new dt::Scene("testscene"));
    OgreProcedural::Root::getInstance()->sceneManager = scene->getSceneManager();

    dt::ResourceManager::get()->addResourceLocation("","FileSystem", true);
    Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
    Ogre::FontManager::getSingleton().load("DejaVuSans", "General");

    auto camnode = scene->addChildNode(new dt::Node("camnode"));
    camnode->setPosition(Ogre::Vector3(0, 0, 30));
    camnode->addComponent(new dt::CameraComponent("cam"))->lookAt(Ogre::Vector3(0, 0, 0));

    auto lightnode = scene->addChildNode(new dt::Node("lightnode"));
    lightnode->setPosition(Ogre::Vector3(-20, 20, 10));
    lightnode->addComponent(new dt::LightComponent("light"));

    // generate meshes
    OgreProcedural::BoxGenerator().setSizeX(FIELD_WIDTH + 1).setSizeY(FIELD_HEIGHT).setSizeZ(1.f).realizeMesh("Field");
    OgreProcedural::BoxGenerator().setSizeX(1.0).setSizeY(1.f).setSizeZ(1.f).realizeMesh("Ball");
    OgreProcedural::BoxGenerator().setSizeX(1.0).setSizeY(3.f).setSizeZ(1.f).realizeMesh("Paddle");

    mGameNode = scene->addChildNode(new dt::Node("game"));

    mFieldNode = mGameNode->addChildNode(new dt::Node("field"));
    mFieldNode->setPosition(Ogre::Vector3(0, 0, -1));
    mFieldNode->addComponent(new dt::MeshComponent("Field", "SimplePongField", "mesh"));

    mBallNode = mGameNode->addChildNode(new dt::Node("ball"));
    mBallNode->setPosition(Ogre::Vector3(0, 0, 0));
    mBallNode->addComponent(new dt::MeshComponent("Ball", "SimplePongBall", "mesh"));

    mPaddle1Node = mGameNode->addChildNode(new dt::Node("paddle1"));
    mPaddle1Node->setPosition(Ogre::Vector3(- FIELD_WIDTH / 2 - 0.5, 0, 0));
    mPaddle1Node->addComponent(new dt::MeshComponent("Paddle", "SimplePongPaddle", "mesh"));

    mPaddle2Node = mGameNode->addChildNode(new dt::Node("paddle2"));
    mPaddle2Node->setPosition(Ogre::Vector3(FIELD_WIDTH / 2 + 0.5, 0, 0));
    mPaddle2Node->addComponent(new dt::MeshComponent("Paddle", "SimplePongPaddle", "mesh"));

    auto score1_node = mGameNode->addChildNode(new dt::Node("score1"));
    score1_node->setPosition(Ogre::Vector3(-10, FIELD_HEIGHT / 2 + 2, 0));
    mScore1Text = score1_node->addComponent(new dt::TextComponent("0", "text"));
    mScore1Text->setFont("DejaVuSans");
    mScore1Text->setFontSize(64);

    auto score2_node = mGameNode->addChildNode(new dt::Node("score2"));
    score2_node->setPosition(Ogre::Vector3(10, FIELD_HEIGHT / 2 + 2, 0));
    mScore2Text = score2_node->addComponent(new dt::TextComponent("0", "text"));
    mScore2Text->setFont("DejaVuSans");
    mScore2Text->setFontSize(64);

    auto info_node = scene->addChildNode(new dt::Node("info"));
    info_node->setPosition(Ogre::Vector3(0, - FIELD_HEIGHT / 2 - 3, 0));
    auto info_text = info_node->addComponent(new dt::TextComponent("Left player: W/S -- Right player: Up/Down", "text"));
    info_text->setFont("DejaVuSans");
    info_text->setFontSize(20);

    resetBall();
}
int LogisticsVariant::init( CSVFile* file, LogisticsChassis* pChassis, int Variant )
{
	bDesignerMech = true;
	
	int offset = 97 * Variant;

	fileID = Variant;
	
	gosASSERT( pChassis );
	chassis = pChassis;
	
	ID = (pChassis->refCount << 16) | pChassis->ID;\
	pChassis->refCount++;

	file->readBoolean( 21 + offset, 4, bHidden );

	char buffer[256];
	if ( NO_ERR == file->readString( 23 + offset, 2, buffer, 256 ) )
	{
		variantName = buffer;
	}

	LogisticsComponent*  pComps[128];
	long xLocs[128];
	long yLocs[128];
	memset( pComps, 0, sizeof( LogisticsComponent* ) * 128 );
	long componentCount = 0;
	
	for ( int i =26; i < 97; i++ )
	{
		long componentID;
		if ( NO_ERR == file->readLong( offset + i, 5, componentID ) && componentID != 0xff )
		{
			LogisticsComponent* pComp = LogisticsData::instance->getComponent(componentID );
			if ( pComp )
			{
				file->readLong( offset + i, 4, yLocs[componentCount] );
				file->readLong( offset + i, 3, xLocs[componentCount] );
				pComps[componentCount++] = pComp;
			}
		}
	}

	for ( int j = 4; j > 0; j-- )
	{
		for ( int k = 3; k >0; k-- )
		{
			for ( i = 0; i < componentCount; i++ )
			{
				LogisticsComponent*
				pComponent = pComps[i];

				if ( pComponent&& pComponent->getComponentWidth() == k 
					&& pComponent->getComponentHeight() == j )
				{
					if ( !addComponent( pComps[i]->getID(), xLocs[i], yLocs[i] ) )
					{
						char errorString[256];
						sprintf( errorString, "Couldn't add component with id %ld", 
							pComponent->getID() );
					}
				}
			}
		}

	}

	
	return 0;


}
Esempio n. 30
0
int main() {
    // --------------------- Opensim model.
    OpenSim::Model model{};
    model.setUseVisualizer(true);
    
    auto slab = new OpenSim::Body{"slab", 
                                  1, 
                                  SimTK::Vec3{0}, 
                                  SimTK::Inertia{0}};

    auto balljoint = new OpenSim::BallJoint{"balljoint",
                                            model.getGround(),
                                            SimTK::Vec3{0, 1, 0},
                                            SimTK::Vec3{0},
                                            *slab,
                                            SimTK::Vec3{0},
                                            SimTK::Vec3{0}};

    OpenSim::Brick brick{};
    brick.setFrame(*slab);
    brick.set_half_lengths(SimTK::Vec3{0.5, 0.05, 0.25});
    slab->addComponent(brick.clone());

    model.addBody(slab);
    model.addJoint(balljoint);

    auto& state = model.initSystem();

    model.updMatterSubsystem().setShowDefaultGeometry(false);
    SimTK::Visualizer& viz = model.updVisualizer().updSimbodyVisualizer();
    viz.setBackgroundType(viz.GroundAndSky);
    viz.setShowSimTime(true);
    viz.drawFrameNow(state);

    // -------------------------- UDP Socket.
    constexpr unsigned BUFFSIZE{8192};

    auto sock = openUdpSocket();

    // ------------------------- Kalman filter.
    Kalman kalman_roll{};
    Kalman kalman_pitch{};
    double oldtimestamp{};
    bool firstrow{true};

    // ------------------------ Streaming.
    while(true) {
        char buffer[BUFFSIZE];
        auto bytes = recvfrom(sock, buffer, BUFFSIZE, 0, 0, 0);

        if(bytes > 0) {
            auto data = parseImuData(buffer, BUFFSIZE);

            auto& timestamp = std::get<0>(data);
            auto& gravity   = std::get<1>(data);
            auto& omega     = std::get<2>(data);

            // If omega is (0, 0, 0), skip over because there was no data.
            // All three components are never equal except when they are 0.
            if(omega[0] == omega[1] && omega[1] == omega[2])
                continue;

            // Compute change in time and record the timestamp.
            auto deltat = timestamp - oldtimestamp;
            oldtimestamp = timestamp;
            if(firstrow) {
                firstrow = false;
                continue;
            }

            auto tilt = computeRollPitch(gravity);
            auto roll  = radToDeg(tilt.first);
            auto pitch = radToDeg(tilt.second);

            omega[0] = radToDeg(omega[0]);
            omega[1] = radToDeg(omega[1]);
            omega[2] = radToDeg(omega[2]);

            // Angular velocity about axis y is roll.
            // Angular velocity about axis x is pitch.
            auto roll_hat  =  kalman_roll.getAngle( roll, omega[1], deltat);
            auto pitch_hat = kalman_pitch.getAngle(pitch, omega[0], deltat);

            // Multiplying -1 to roll just for display. This way visualizaiton moves
            // like the physical phone.
            model.getCoordinateSet()[0].setValue(state, -1 * degToRad( roll_hat));
            model.getCoordinateSet()[2].setValue(state, degToRad(pitch_hat));
            
            viz.drawFrameNow(state);
            
            //std::cout << buffer << std::endl;
        } else
            std::cout << "skipping....." << std::endl;
    }

    return 0;
}