• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ WP类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中WP的典型用法代码示例。如果您正苦于以下问题:C++ WP类的具体用法?C++ WP怎么用?C++ WP使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: weak_shared

void weak_shared(
    WP & first,
    SP & second
){
    const char * testfile = boost::archive::tmpnam(NULL);
    BOOST_REQUIRE(NULL != testfile);
    int firstm = first.lock()->m_x;
    int secondm = second->m_x;
    save2(testfile, first, second);

    // Clear the pointers, thereby destroying the objects they contain
    first.reset();
    second.reset();

    load2(testfile, first, second);

    // Check data member
    BOOST_CHECK(firstm == first.lock()->m_x);
    BOOST_CHECK(secondm == second->m_x);
    // Check pointer to vtable
    BOOST_CHECK(::dynamic_pointer_cast<Sub>(first.lock()));
    BOOST_CHECK(::dynamic_pointer_cast<Sub>(second));

    std::remove(testfile);
}
开发者ID:cooparation,项目名称:caffe-android,代码行数:25,代码来源:test_shared_ptr_multi_base.cpp


示例2: while

void CGuiCom::doSizeGUI(EnumeratorWidgetPtr widgets)
{
	while (widgets.next())
	{
		WP wp = widgets.current();
		std::string relativeTo = wp->getUserString("RelativeTo");

		if (relativeTo != "")
		{
			//  position & size relative to the widget specified in "RelativeTo" property (or full screen)
			IntSize relSize;
			if (relativeTo == "Screen")
				relSize = IntSize(app->mWindow->getWidth(), app->mWindow->getHeight());
			else
			{	WP window = fWP(relativeTo);
				relSize = window->getSize();  }
			
			//  retrieve original size & pos
			IntPoint origPos;  IntSize origSize;
			origPos.left = s2i(wp->getUserString("origPosX"));
			origPos.top  = s2i(wp->getUserString("origPosY"));
			origSize.width  = s2i(wp->getUserString("origSizeX"));
			origSize.height = s2i(wp->getUserString("origSizeY"));
			
			//  calc & apply new size & pos
			float sx = relSize.width / 800.f, sy = relSize.height / 600.f;
			wp->setPosition(IntPoint( int(origPos.left * sx), int(origPos.top * sy) ));
			wp->setSize(IntSize(    int(origSize.width * sx), int(origSize.height * sy) ));
		}
		
		doSizeGUI(wp->getEnumerator());
	}
}
开发者ID:dhwanivakhariya,项目名称:stuntrally,代码行数:33,代码来源:GuiCom_Util.cpp


示例3: FindSubTab

TabPtr CGuiCom::FindSubTab(WP tab)
{
	TabPtr  sub = 0;  // 0 for not found
	size_t s = tab->getChildCount();
	for (size_t n = 0; n < s; ++n)
	{
		WP wp = tab->getChildAt(n);
		if (StringUtil::startsWith(wp->getName(), "SubTab"))
			sub = (TabPtr)wp;
	}
	return sub;
}
开发者ID:Mixone-FinallyHere,项目名称:stuntrally,代码行数:12,代码来源:GuiCom_Util.cpp


示例4: notifyToolTip

void CGuiCom::notifyToolTip(WP wp, const ToolTipInfo &info)
{
	if (!mToolTip)  return;

	#ifndef SR_EDITOR
	if (!app->isFocGui)
	#else
	if (!app->bGuiFocus)
	#endif
	{	mToolTip->setVisible(false);
		return;
	}
	if (info.type == ToolTipInfo::Show)
	{
		mToolTip->setSize(320, 128);  // start size for wrap
		mToolTipTxt->setSize(320, 128);

		String s = TR(wp->getUserString("tip"));
		mToolTipTxt->setCaption(s);
		const IntSize &si = mToolTipTxt->getTextSize();

		mToolTip->setSize(si.width +8, si.height +8);
		mToolTipTxt->setSize(si.width, si.height);
		mToolTip->setVisible(true);
		boundedMove(mToolTip, info.point);
	}
	else if (info.type == ToolTipInfo::Hide)
		mToolTip->setVisible(false);
}
开发者ID:Mixone-FinallyHere,项目名称:stuntrally,代码行数:29,代码来源:GuiCom_Util.cpp


示例5: setOrigPos

void CGuiCom::setOrigPos(WP wp, const char* relToWnd)
{
	if (!wp)  return;
	wp->setUserString("origPosX", toStr(wp->getPosition().left));
	wp->setUserString("origPosY", toStr(wp->getPosition().top));
	wp->setUserString("origSizeX", toStr(wp->getSize().width));
	wp->setUserString("origSizeY", toStr(wp->getSize().height));
	wp->setUserString("RelativeTo", relToWnd);
}
开发者ID:dhwanivakhariya,项目名称:stuntrally,代码行数:9,代码来源:GuiCom_Util.cpp


示例6: save_and_load3

void save_and_load3(
    SP & first,
    SP & second,
    WP & third
) {
    const char * testfile = boost::archive::tmpnam(NULL);
    BOOST_REQUIRE(NULL != testfile);

    save3(testfile, first, second, third);

    // Clear the pointers, thereby destroying the objects they contain
    first.reset();
    second.reset();
    third.reset();

    load3(testfile, first, second, third);

    BOOST_CHECK(first == second);
    BOOST_CHECK(first == third.lock());
    std::remove(testfile);
}
开发者ID:OggYiu,项目名称:rag-engine,代码行数:21,代码来源:test_shared_ptr.cpp


示例7: btnNpreset

void CGui::btnNpreset(WP wp)
{
    int l = bRn2->getStateSelected() ? 1 : 0;
    String s = wp->getName();  //"TerLN_"
    int i = s2i(s.substr(6));

    TerLayer& t = sc->td.layersAll[idTerLay];
    t.nFreq[l] = ns[i][0];
    t.nOct[l]  = int(ns[i][1]);
    t.nPers[l] = ns[i][2];
    t.nPow[l]  = ns[i][3];
    SldUpd_TerL();
    app->scn->UpdBlendmap();
}
开发者ID:martinkg,项目名称:stuntrally,代码行数:14,代码来源:Gui_EventsTer.cpp


示例8: btnClrSet

///  Color tool window
//...............................................................................
void CGui::btnClrSet(WP w)
{
	SColor* v;  // rgb
	if (w == clrAmb)   v = &sc->lAmb;   else
	if (w == clrDiff)  v = &sc->lDiff;  else
	if (w == clrSpec)  v = &sc->lSpec;
	bool oth = wpClrSet != w;  wpClrSet = w;

	svAlp.setVisible(false);
	svHue.UpdF(&v->h);  svSat.UpdF(&v->s);  svVal.UpdF(&v->v);
	svNeg.UpdF(&v->n);

	IntPoint p = w->getAbsolutePosition();  p.left += 100;  p.top -= 50;
	wndColor->setPosition(p);
	if (!(wndColor->getVisible() && oth))  // dont hide if changed
		wndColor->setVisible(!wndColor->getVisible());
}
开发者ID:ddxxpp,项目名称:stuntrally,代码行数:19,代码来源:Gui_Util.cpp


示例9: btnClrSetA

void CGui::btnClrSetA(WP w)
{
	SColor* v;  // rgba
	if (w == clrFog)   v = &sc->fogClr;   else
	if (w == clrFog2)  v = &sc->fogClr2;  else
	if (w == clrFogH)  v = &sc->fogClrH;  else
	if (w == clrTrail) {
		TerLayer* l = GetTerRdLay();
		v = &l->tclr;  }
	bool oth = wpClrSet != w;  wpClrSet = w;

	svAlp.setVisible(true);
	svHue.UpdF(&v->h);  svSat.UpdF(&v->s);  svVal.UpdF(&v->v);
	svAlp.UpdF(&v->a);  svNeg.UpdF(&v->n);

	IntPoint p = w->getAbsolutePosition();  p.left += 100;  p.top -= 50;
	wndColor->setPosition(p);
	if (!(wndColor->getVisible() && oth))
		wndColor->setVisible(!wndColor->getVisible());
}
开发者ID:ddxxpp,项目名称:stuntrally,代码行数:20,代码来源:Gui_Util.cpp


示例10: fWnd


//.........这里部分代码省略.........
		ml->addColumn("#C0FFC0"+TR("#{Game name}"), 160);  ++c;
		ml->addColumn("#50FF50"+TR("#{Track}"), 120);  ++c;
		ml->addColumn("#80FFC0"+TR("#{Laps}"), 60);  ++c;
		ml->addColumn("#FFFF00"+TR("#{Players}"), 60);  ++c;
		ml->addColumn("#80FFFF"+TR("#{Collis.}"), 70);  ++c;
		ml->addColumn("#A0D0FF"+TR("#{Simulation}"), 80);  ++c;
		ml->addColumn("#A0D0FF"+TR("#{Boost}"), 90);  ++c;
		ml->addColumn("#FF6060"+TR("#{Locked}"), 60);  iColLock = c;  ++c;
		ml->addColumn("#FF9000"+TR("#{NetHost}"), 140);  iColHost = c;  ++c;
		ml->addColumn("#FFB000"+TR("#{NetPort}"), 80);  iColPort = c;  ++c;

	Btn("btnNetRefresh",evBtnNetRefresh); btnNetRefresh = btn;
	Btn("btnNetJoin",   evBtnNetJoin);    btnNetJoin = btn;
	Btn("btnNetCreate", evBtnNetCreate);  btnNetCreate = btn;
	Btn("btnNetDirect", evBtnNetDirect);  btnNetDirect = btn;

	//  game, players
	Edt(edNetGameName, "edNetGameName", evEdNetGameName);  edNetGameName->setCaption(pSet->netGameName);
	valNetPassword = fTxt("valNetPassword");
	Edt(edNetPassword, "edNetPassword", evEdNetPassword);

	listPlayers = fMli("MListPlayers");
	ml = listPlayers;
		ml->addColumn("#80C0FF"+TR("#{Player}"), 140);
		ml->addColumn("#F08080"+TR("#{Car}"), 60);
		ml->addColumn("#C0C060"+TR("#{Peers}"), 60);
		ml->addColumn("#60F0F0"+TR("#{Ping}"), 60);
		ml->addColumn("#40F040"+TR("#{NetReady}"), 60);

	Btn("btnNetReady", evBtnNetReady);  btnNetReady = btn;
	Btn("btnNetLeave", evBtnNetLeave);	btnNetLeave = btn;

	//  panels to hide tabs
	panNetServer = fWP("panelNetServer");  panNetServer->setVisible(false);
	panNetGame = fWP("panelNetGame");      panNetGame->setVisible(true);

    //  chat
    edNetChat = fEd("edNetChat");  // chat area
    edNetChatMsg = fEd("edNetChatMsg");  // user text
    //  track,game text
    valNetGameInfo = fTxt("valNetGameInfo");

	//  settings
	Edt(edNetNick,		"edNetNick",		evEdNetNick);		edNetNick->setCaption(		pSet->nickname);
	Edt(edNetServerIP,	"edNetServerIP",	evEdNetServerIP);	edNetServerIP->setCaption(	pSet->master_server_address);
	Edt(edNetServerPort,"edNetServerPort",	evEdNetServerPort);	edNetServerPort->setCaption(toStr(pSet->master_server_port));
	Edt(edNetLocalPort,	"edNetLocalPort",	evEdNetLocalPort);	edNetLocalPort->setCaption(	toStr(pSet->local_port));

	
	//  quick help text  ----
	Ed edHelp = fEd("QuickHelpText");
	String s = TR("#{QuickHelpText}");
	s = StringUtil::replaceAll(s, "@", "\n");
	edHelp->setCaption(s);

	//  user dir
    Ed edUserDir = fEd("EdUserDir");
	edUserDir->setCaption(PATHMANAGER::UserConfigDir());

	
	///  graphs  ----
	sv= &svTC_r;	sv->Init("TC_r",	&pSet->tc_r,  0.5f, 2.f, 1.5f, 1,4);	sv->DefaultF(1.f);
	sv= &svTC_xr;	sv->Init("TC_xr",	&pSet->tc_xr, 0.f, 5.f,  1.5f, 1,4);	sv->DefaultF(1.f);

	sv= &svTE_yf;	sv->Init("TE_yf",	&pSet->te_yf, 5000.f, 10000.f, 1.f, 0,4);	sv->DefaultF(7000.f);
	sv= &svTE_xfx;	sv->Init("TE_xfx",	&pSet->te_xfx, 4.f, 42.f,  2.f, 1,4);	sv->DefaultF(12.f);
开发者ID:HaohaoLau,项目名称:stuntrally,代码行数:67,代码来源:Gui_Init.cpp


示例11: btnTerGenerate

///  Terrain  generate
///--------------------------------------------------------------------------------------------------------------------------
void CGui::btnTerGenerate(WP wp)
{
	const std::string& n = wp->getName();
	bool add = false, sub = false;
	if (n == "TerrainGenAdd")  add = true;  else
	if (n == "TerrainGenSub")  sub = true;/*else
	if (n == "TerrainGenMul")  mul = true;*/

	float* hfData = sc->td.hfHeight, *hfAng = sc->td.hfAngle;
	const int sx = sc->td.iVertsX;  // sx=sy
	const float s = sx * 0.5f, s1 = 1.f/s;
	const float ox = pSet->gen_ofsx, oy = pSet->gen_ofsy;

	//)  road test
	bool bRoad = pSet->gen_roadsm > 0.1f;
	float rdPow = pSet->gen_roadsm;  //-
	int r = 0;
	Image imgRoad;
	if (bRoad)
	{
		try {	imgRoad.load(String("roadDensity.png"),"General");  }
		catch(...)
			{	imgRoad.load(String("grassDensity.png"),"General");  }
		r = imgRoad.getWidth();
	}

	QTimer ti;  ti.update();  /// time

	//  generate noise terrain hmap
	register int a,x,y;  register float c;

	for (y=0; y < sx; ++y)  {  a = y * sx;
	for (x=0; x < sx; ++x,++a)
	{	float fx = ((float)x - s)*s1, fy = ((float)y - s)*s1;  // -1..1

		c = app->Noise(y*s1-oy, x*s1+ox, pSet->gen_freq, pSet->gen_oct, pSet->gen_persist) * 0.8f;
		c = c >= 0.f ? powf(c, pSet->gen_pow) : -powf(-c, pSet->gen_pow);

		//)  check if on road - uses roadDensity.png
		//  todo: smooth depends on -smooth grass dens par, own val?
		if (bRoad)
		{
			int mx = ( fx+1.f)*0.5f*r, my = (-fy+1.f)*0.5f*r;
					
			float cr = imgRoad.getColourAt(
				std::max(0,std::min(r-1, mx)), std::max(0,std::min(r-1, my)), 0).r;

			//c = c + std::max(0.f, std::min(1.f, 2*c-cr)) * pow(cr, rdPow);
			c *= pow(cr, rdPow);
		}
		
		c *= app->linRange(hfAng[a],  pSet->gen_terMinA,pSet->gen_terMaxA, pSet->gen_terSmA);
		c *= app->linRange(hfData[a], pSet->gen_terMinH,pSet->gen_terMaxH, pSet->gen_terSmH);

		hfData[a] = add ? (hfData[a] + c * pSet->gen_scale + pSet->gen_ofsh) : (
					sub ? (hfData[a] - c * pSet->gen_scale - pSet->gen_ofsh) :
						  (hfData[a] * c * pSet->gen_mul) );
	}	}

	ti.update();  /// time
	float dt = ti.dt * 1000.f;
	LogO(String("::: Time Ter Gen: ") + fToStr(dt,0,3) + " ms");

	std::ofstream of;
	of.open(getHMapNew().c_str(), std::ios_base::binary);
	int siz = sx * sx * sizeof(float);
	of.write((const char*)&hfData[0], siz);
	of.close();

	ti.update();  /// time
	dt = ti.dt * 1000.f;
	LogO(String("::: Time Ter Gen save: ") + fToStr(dt,0,3) + " ms");

	app->bNewHmap = true;	app->UpdateTrack();
}
开发者ID:dhwanivakhariya,项目名称:stuntrally,代码行数:77,代码来源:TerrainEdit.cpp


示例12: btnBrushPreset

void CGui::btnBrushPreset(WP img)
{
	int id = 0;
	sscanf(img->getName().c_str(), "brI%d", &id);
	app->SetBrushPreset(id);
}
开发者ID:dhwanivakhariya,项目名称:stuntrally,代码行数:6,代码来源:TerrainEdit.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ WPainterPath类代码示例发布时间:2022-05-31
下一篇:
C++ WObjectFile类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap