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


C++ shared_ptr::Clear方法代码示例

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


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

示例1: GetRenderQuery

	void OcTree::GetRenderQuery(const Collidable &collider, const std::shared_ptr<RenderQuery> &renderQuery) const
	{
		renderQuery->Clear();

		WalkScene(collider, [&](const SceneNode::Ptr &sceneNode)
		{
			if (sceneNode->GetComponent<Light>() != nullptr)
				renderQuery->AddLight(sceneNode);
			
			if (auto render = sceneNode->GetComponent<MeshRender>())
			{
				if (render->GetRenderable())
					renderQuery->AddRenderable(sceneNode);
			}
		});
	}
开发者ID:colinchen1984,项目名称:fury3d,代码行数:16,代码来源:OcTree.cpp

示例2: RemoveChannelOpened

void PlotWindowOpened::RemoveChannelOpened(std::shared_ptr<ChannelOpened> channel)
{
	auto SThis = dynamic_pointer_cast<PlotWindowOpened, AsyncObject>(shared_from_this());

	channel->Clear();

	TaskQueue()->QueueTask([SThis, channel](){	

		int chId = channel->Id();

		auto iterCh = SThis->_chMap.find(channel);
		if (iterCh != SThis->_chMap.end())
		{
			SThis->_chMap.erase(iterCh);
			SThis->OnChannelClosed(channel);
			channel->SetOpenState(false);
		}

		auto iterNewCh = SThis->_newChSet.find(chId);
		if (iterNewCh != SThis->_newChSet.end())
		{
			SThis->_newChSet.erase(chId);
		}

		if (SThis->_chMap.size() == 0)
		{
			HWND hWnd = SThis->_plotWnd->m_hWnd;
			if (hWnd)
				::PostMessage(hWnd, WM_CLOSE, 0, 0);
			SThis->_bWndValid = false;
		}
		else
		{
			SThis->UpdateWndCaption();
		}

	});
}
开发者ID:PaulJing,项目名称:Sora,代码行数:38,代码来源:PlotWindowOpened.cpp

示例3: DrawImageData

void DrawImageData(uint32_t cam_id)
{
    if (cam_id == 0) {
        gui_vars.handler->track_centers.clear();
    }

    line_strip->Clear();
    for (uint32_t ii = 0; ii < poses.size() ; ++ii) {
        axes[ii]->SetPose(poses[ii]->t_wp.matrix());
        Eigen::Vector3f vertex = poses[ii]->t_wp.translation().cast<float>();
        line_strip->AddVertex(vertex);
    }

    // Draw the tracks
    for (std::shared_ptr<sdtrack::DenseTrack>& track : *current_tracks) {
        Eigen::Vector2d center;
        if (track->keypoints.back()[cam_id].tracked || is_manual_mode) {
            DrawTrackData(track, image_width, image_height, center,
                          gui_vars.handler->selected_track == track, cam_id);
        }
        if (cam_id == 0) {
            gui_vars.handler->track_centers.push_back(
                std::pair<Eigen::Vector2d, std::shared_ptr<sdtrack::DenseTrack>>(
                    center, track));
        }
    }

    // Populate the first column with the reference from the selected track.
    if (gui_vars.handler->selected_track != nullptr) {
        DrawTrackPatches(gui_vars.handler->selected_track, gui_vars.patches);
    }

    for (uint32_t cam_id = 0; cam_id < rig.cameras_.size(); ++cam_id) {
        gui_vars.camera_view[cam_id]->RenderChildren();
    }
}
开发者ID:ConfusedReality,项目名称:pkg_augmented-reality_sdtrack,代码行数:36,代码来源:sd_vtracker.cpp

示例4: CleanUp

void CleanUp()
{
	gScenario.reset();
	gArgParser->Clear();
}
开发者ID:saadmahboob,项目名称:DeepLoco,代码行数:5,代码来源:Main.cpp

示例5: Update

    void Update()
    {
        if(m_text==m_ss.str()){
            return;
        }

        m_text=m_ss.str();

        m_image->Clear();
        BYTE *data=m_image->GetSample();
        int pitch=m_image->GetWidth()*4;

        // フォントの生成
        LOGFONT lf = {m_fontsize, 0, 0, 0, 0, 0, 0, 0, 
            SHIFTJIS_CHARSET, OUT_TT_ONLY_PRECIS,
            CLIP_DEFAULT_PRECIS, PROOF_QUALITY, FIXED_PITCH | FF_MODERN, _T("MS 明朝")};
        HFONT hFont=CreateFontIndirect(&lf);
        if(!(hFont)){
            return;
        }

        // デバイスコンテキスト取得
        // デバイスにフォントを持たせないとGetGlyphOutline関数はエラーとなる
        HDC hdc = GetDC(NULL);
        HFONT oldFont = (HFONT)SelectObject(hdc, hFont);

        std::vector<BYTE> gryph;
        int x_pos=0;
        int y_pos=0;
        int col_size=m_fontsize/2;
        for(auto c=m_text.begin(); c!=m_text.end(); ++c){

            if(y_pos>=m_row*m_fontsize){
                break;
            }

            if(*c==L'\n'){
                y_pos+=m_fontsize+5;
                x_pos=0;
                continue;
            }

            if(x_pos+col_size>=m_col*col_size){
                y_pos+=m_fontsize+5;
                x_pos=0;
            }

            // フォントビットマップ取得
            TEXTMETRIC TM;
            GetTextMetrics( hdc, &TM );
            GLYPHMETRICS GM;
            CONST MAT2 Mat = {{0,1},{0,0},{0,0},{0,1}};
            DWORD size = GetGlyphOutline(hdc, *c, GGO_GRAY4_BITMAP, &GM, 0, NULL, &Mat);

            if(size>0){
                gryph.resize(size);
                GetGlyphOutline(hdc, *c, GGO_GRAY4_BITMAP, &GM, gryph.size(), &gryph[0], &Mat);

                // フォント情報の書き込み
                // iOfs_x, iOfs_y : 書き出し位置(左上)
                // iBmp_w, iBmp_h : フォントビットマップの幅高
                // Level : α値の段階 (GGO_GRAY4_BITMAPなので17段階)
                int iOfs_x = x_pos+GM.gmptGlyphOrigin.x;
                int iOfs_y = y_pos+TM.tmAscent - GM.gmptGlyphOrigin.y;
                int iBmp_w = GM.gmBlackBoxX + (4-(GM.gmBlackBoxX%4))%4;
                int iBmp_h = GM.gmBlackBoxY;
                int Level = 17;
                DWORD Alpha, Color;
                for(int y=iOfs_y; y<iOfs_y+iBmp_h; y++){
                    for(size_t x=iOfs_x; x<iOfs_x+GM.gmBlackBoxX; x++){
                        Alpha = (255 * gryph[x-iOfs_x + iBmp_w*(y-iOfs_y)]) / (Level-1);
                        Color = 0x00ffffff | (Alpha<<24);
                        memcpy((BYTE*)data + pitch*y + 4*x, &Color, sizeof(DWORD));
                    }
                }
                x_pos+=iBmp_w;
            }
            else{
                x_pos+=col_size;
            }
        }

        // デバイスコンテキストとフォントハンドルの開放
        SelectObject(hdc, oldFont);
        DeleteObject(hFont);
        ReleaseDC(NULL, hdc);
    }
开发者ID:ousttrue,项目名称:dscvd3d,代码行数:87,代码来源:HUD.cpp

示例6: Update

	void Pacman::Update(const SDLInput& input, Tilemap& tilemap, float deltaTime, const std::shared_ptr<SDLRenderTarget>& tileSurface, const std::vector<SDLSurface>& gridSurf)
	{
		if (m_State == PacState::PowerUp) // if powered up
		{
			float currentTime = Timer::GetTime();
			if ((currentTime - m_powerDuration) > 5.f) // if powered up for more tha 5 seconds
			{
				m_State = PacState::Normal;// return to normal
			}
		}

		//set our speed
		float speed = 5.5f * deltaTime;

		// clamp position
		size_t cX = (size_t)(clamp(m_Position.x, 0.f, 18.f) + 0.5f);
		size_t cY = (size_t)(clamp(m_Position.y, 0.f, 22.f) + 0.5f);

		switch (m_CurrentDirection) // move in direction
		{
		case Direction::Left:
			m_Position.x -= speed;
			break;
		case Direction::Right:
			m_Position.x += speed;
			break;
		case Direction::Up:
			m_Position.y -= speed;
			break;
		case Direction::Down:
			m_Position.y += speed;
			break;
		}

		//make the side wall let us trough
		if (m_Position.x < 0.f)
		{
			m_Position.x = 19.f;
		}

		if (m_Position.x > 19.0f)
		{
			m_Position.x = 0.f;
		}

		if (m_CurrentDirection == Direction::None && m_NextDirection != Direction::None && tilemap.GetDirectionFlag(cX, cY, (size_t)m_NextDirection))
		{// if the current direction is None and the next input direction is not none and we can go in that direction
			m_CurrentDirection = m_NextDirection; // switch directions
			m_NextDirection = Direction::None; // set next to none
		}

		if (m_CurrentDirection != Direction::None) // if our  current direction is not None ( we are not at base)
		{
			m_DistanceLeft -= speed; // reduce the distance of travel

			if (m_DistanceLeft <= 0.f) //if we have traveled 1 tile
			{
				if (!tilemap.GetDirectionFlag(cX, cY, (size_t)m_CurrentDirection)) // if the tile we are on dosent have the current direction direction flag set
				{
					m_CurrentDirection = Direction::None;// make curent dir none
				}

				if (m_NextDirection != Direction::None) // if we have a pending direction command
				{
					if (tilemap.GetDirectionFlag(cX, cY, (size_t)m_NextDirection)) // and if the tile we are one has the next direction tag set
					{
						m_CurrentDirection = m_NextDirection;// go in that direction
					}
				}
				m_DistanceLeft += 1.0f;// add distace to travel
			}
		}

		Rect rect(m_Position.x + 0.05f, m_Position.y + 0.05f, 0.9f, 0.9f);//construct a collision rect;

		//get all intersections
		auto intersections = tilemap.Intersect(rect);

		for (auto &i : intersections) // go trough them
		{
			if (i.type == Coin) // if its a coin
			{
				m_Points += 1; // increase points
				tilemap.Set(i.x, i.y, Empty); //remove coin 
				tileSurface->Clear(); // clear tilemap render
				tileSurface->RenderTileset(gridSurf, tilemap.GetGrid(), 19, 32.0f);// re - render the grid without the coin.
			}
		}

		//set directions accortind to input keys
		if (input.GetKey(Left))
		{
			m_NextDirection = Direction::Left;
		}

		if (input.GetKey(Right))
		{
			m_NextDirection = Direction::Right;
		}

//.........这里部分代码省略.........
开发者ID:AlexanderMladenov,项目名称:Pacman,代码行数:101,代码来源:Pacman.cpp


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