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


C++ CGuiLayout::getWidget方法代码示例

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


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

示例1: Menu_Net_NETShutdown

///////////////////
// Shutdown the internet menu
void Menu_Net_NETShutdown()
{
	if (tLXOptions)  {

		// Save the list
		if( iNetMode == net_internet )  {
			SvrList_Save();

			CListview* l = (CListview *)cInternet.getWidget(mi_ServerList);
			if(l) {
				// Save the column widths
				for (int i=0;i<7;i++)
					tLXOptions->iInternetList[i] = l->GetColumnWidth(i);

				// Save the sorting column
				tLXOptions->iInternetSortColumn = l->GetSortColumn();
			}
		}

		// Save the selected player
		GuiListItem::Pt item = ((CCombobox*)cInternet.getWidget(mi_PlayerSelection)) ? ((CCombobox*)cInternet.getWidget(mi_PlayerSelection))->getSelectedItem() : NULL;
		if (item.get())
			tLXOptions->sLastSelectedPlayer = item->index();
	}

	cInternet.Shutdown();
}
开发者ID:iamnilay3,项目名称:openlierox,代码行数:29,代码来源:Menu_Net_Internet.cpp

示例2: Dnr_ChallengeOpponent

///////////////////
// Challenge the opponent
void Dnr_ChallengeOpponent(int nLevel, int nType)
{
    psDiner->bOppClicked = true;
    psDiner->bGoodOffer = false;

    // Setup the racing gui
    cDinerLayout.Initialize();

    // Level 1
    // Top level choice
    if(nLevel == 0) {
        cDinerLayout.Add( new CButton("Drag race",-1),          dng_drag,   335,230,0,  0);
        cDinerLayout.Add( new CButton("Road race",-1),          dng_road,   335,280,0,  0);
        cDinerLayout.Add( new CButton("Forget it",-1),          dng_cancel, 335,330,0,  0);
        cDinerLayout.Add( new CDialog("Race", dlgs_small),      dng_dlg,    0,  0,  230,200);
    }

    // Level 2
    // Location
    if(nLevel == 1) {
        // Drag
        if(nType == 0) {
            for(int i=0; i<psDiner->nNumDragTracks; i++) {
                cDinerLayout.Add(new CButton(psDiner->sDragTracks[i].szName,-1),   dng_dragtrk1+i,   335,230+i*5,0,  0);

                CButton *b = ((CButton *)cDinerLayout.getWidget(dng_dragtrk1+i));
                if(b)
                    b->setSize(10);
            }

            cDinerLayout.Add( new CButton("Forget it",-1),          dng_cancel, 335,330,0,  0);
            cDinerLayout.Add( new CDialog("Race", dlgs_small),      dng_dlg,    0,  0,  230,200);
        }
    }

    // Level 3
    // Bet
    if(nLevel == 2) {
        // Drag
        if(nType == 0) {
            cDinerLayout.Add( new CButton("For kicks",-1),          dng_dragkicks,   335,220,0,  0);
            cDinerLayout.Add( new CButton("$10",-1),                dng_drag10,      335,260,0,  0);
            cDinerLayout.Add( new CButton("$50",-1),                dng_drag50,      335,300,0,  0);

            cDinerLayout.Add( new CButton("Back",-1),               dng_dragback,    335,350,0,  0);
            cDinerLayout.Add( new CDialog("Race", dlgs_small),      dng_dlg,    0,  0,  230,200);
        }

    }

    cDinerLayout.moveWidgets(-270, 180);
}
开发者ID:tecan,项目名称:StreetRod3,代码行数:54,代码来源:Diner.cpp

示例3: Menu_Net_NETJoinServer

///////////////////
// Join a server
void Menu_Net_NETJoinServer(const std::string& sAddress, const std::string& sName)
{
	// Fill in the game structure
	CCombobox* combo = (CCombobox *) cInternet.getWidget(mi_PlayerSelection);
	const GuiListItem::Pt item = combo->getSelectedItem();
	if(!item.get()) {
		errors << "no player selected" << endl;
		return;
	}
		
	tLXOptions->sLastSelectedPlayer = item->index();

	if(!JoinServer(sAddress, sName, item->index()))
		return;

	// Shutdown
	cInternet.Shutdown();
	
	iNetMode = net_join;
	tMenu->iReturnTo = net_internet;
	
	// Connect to the server
	Menu_Net_JoinConnectionInitialize(sAddress);
}
开发者ID:iamnilay3,项目名称:openlierox,代码行数:26,代码来源:Menu_Net_Internet.cpp

示例4: Menu_Net_NETInitialize

///////////////////
// Initialize the Internet menu
bool Menu_Net_NETInitialize()
{
	iNetMode = net_internet;
    szNetCurServer = "";

	cInternet.Shutdown();
	cInternet.Initialize();

	cInternet.Add( new CListview(),								mi_ServerList, 40, 180, 560, 242);
	cInternet.Add( new CButton(BUT_BACK, tMenu->bmpButtons),    mi_Back,       25, 440, 50,  15);
	cInternet.Add( new CButton(BUT_ADD, tMenu->bmpButtons),		mi_AddServer,  140,440, 40,  15);
	cInternet.Add( new CButton(BUT_REFRESH, tMenu->bmpButtons), mi_Refresh,	250,440, 83,  15);
	cInternet.Add( new CButton(BUT_UPDATELIST, tMenu->bmpButtons),	mi_UpdateList,  390,440, 125,  15);
	cInternet.Add( new CButton(BUT_JOIN, tMenu->bmpButtons),    mi_Join,		570,440, 43,  15);
	cInternet.Add( new CLabel("Select player:",tLX->clNormalLabel),-1,		125, 152, 180,15);
	cInternet.Add( new CCombobox(),								mi_PlayerSelection,		225,150, 170,  19);
	if( tLXOptions->bEnableChat && tLXOptions->bEnableMiniChat )
		cInternet.Add( new CChatWidget(),						-1,	25, 15, 585, 85 );


	/*
	  Server list columns

      Connection speed
	  Name
	  State
	  Players
	  Ping
	  Address
    */

	// Add players to the list
	profile_t *p = GetProfiles();
	bool validName = false;
	for(;p;p=p->tNext) {
		if(p->iType == PRF_COMPUTER->toInt())
			continue;

		int i = ((CCombobox*) cInternet.getWidget( mi_PlayerSelection ))->addItem(p->sName, p->sName);
		((CCombobox*) cInternet.getWidget( mi_PlayerSelection ))->setImage(p->cSkin.getPreview(), i);
		if( p->sName == tLXOptions->sLastSelectedPlayer )
			validName=true;
	}

	if( ! validName )
		tLXOptions->sLastSelectedPlayer = GetProfiles()->sName;

	((CCombobox*) cInternet.getWidget( mi_PlayerSelection ))->setCurSIndexItem( tLXOptions->sLastSelectedPlayer );

    Menu_redrawBufferRect(0, 0, 640, 480);

	cInternet.SendMessage( mi_ServerList, LVS_ADDCOLUMN, "", tLXOptions->iInternetList[0]);
	cInternet.SendMessage( mi_ServerList, LVS_ADDCOLUMN, "Server Name", tLXOptions->iInternetList[1]);
	cInternet.SendMessage( mi_ServerList, LVS_ADDCOLUMN, "State", tLXOptions->iInternetList[2]);
	cInternet.SendMessage( mi_ServerList, LVS_ADDCOLUMN, "Players", tLXOptions->iInternetList[3]);
	cInternet.SendMessage( mi_ServerList, LVS_ADDCOLUMN, "Ping", tLXOptions->iInternetList[4]);

	if (tLXOptions->bUseIpToCountry)
	{	// Too lazy to update tLXOptions, so I'll calculate last column width from width of listview
		//int CountryColumnWidth = 21; // TODO: not used

		// HINT: because this column is optional, it is at the end of the array from options
		cInternet.SendMessage( mi_ServerList, LVS_ADDCOLUMN, "Country", tLXOptions->iInternetList[5]);
	}

	cInternet.SendMessage( mi_ServerList, LVS_ADDCOLUMN, "Address", tLXOptions->iInternetList[6]);

	((CListview*) cInternet.getWidget( mi_ServerList ))->SetSortColumn( tLXOptions->iInternetSortColumn, true ); // Sorting

    // Load the list
	Menu_Net_NET_ServerList_Refresher();
	SvrList_UpdateUDPList();
	
	Timer("Menu_Net_NETInitialize serverlist timeout", null, NULL, SVRLIST_TIMEOUT, true).startHeadless();
	
	return true;
}
开发者ID:iamnilay3,项目名称:openlierox,代码行数:79,代码来源:Menu_Net_Internet.cpp

示例5: Menu_Net_NET_ServerList_Refresher

void Menu_Net_NET_ServerList_Refresher() {
	Menu_SvrList_FillList( (CListview *)cInternet.getWidget( mi_ServerList ), SLFT_CustomSettings, SvrListSettingsFilter::Load(tLXOptions->sSvrListSettingsFilterCfg) );
}
开发者ID:iamnilay3,项目名称:openlierox,代码行数:3,代码来源:Menu_Net_Internet.cpp

示例6: Menu_Net_NETShowServer

///////////////////
// Show a server's details
void Menu_Net_NETShowServer(const std::string& szAddress)
{
    CGuiLayout  cDetails;

    // Create the buffer
    DrawImage(tMenu->bmpBuffer.get(),tMenu->bmpMainBack_common,0,0);
    Menu_DrawBox(tMenu->bmpBuffer.get(), 15,130, 625, 465);
	Menu_DrawSubTitle(tMenu->bmpBuffer.get(),SUB_NETWORK);
	cInternet.Draw(tMenu->bmpBuffer.get());

	//for(ushort i=1;i<4;i++)
	//	cNetButtons[i].Draw(tMenu->bmpBuffer.get());

	Menu_RedrawMouse(true);

	int center = VideoPostProcessor::videoSurface()->w/2;
	int y = VideoPostProcessor::videoSurface()->h/2 - INFO_H/2;
	
    cDetails.Initialize();
	cDetails.Add( new CButton(BUT_REFRESH, tMenu->bmpButtons),  nd_Refresh,	center - 105, y+INFO_H-20, 85,15);
    cDetails.Add( new CButton(BUT_JOIN, tMenu->bmpButtons),	    nd_Join,    center, y+INFO_H-20, 40,45);
	cDetails.Add( new CButton(BUT_OK, tMenu->bmpButtons),	    nd_Ok,      center + 60, y+INFO_H-20, 40,15);
	((CButton *)cDetails.getWidget(nd_Refresh))->setRedrawMenu(false);
	((CButton *)cDetails.getWidget(nd_Ok))->setRedrawMenu(false);
	((CButton *)cDetails.getWidget(nd_Join))->setRedrawMenu(false);

	bGotDetails = false;
	bOldLxBug = false;
	nTries = 0;
	fStart = AbsTime();

    while(!WasKeyboardEventHappening(SDLK_ESCAPE,false) && tMenu->bMenuRunning) {
		tLX->currentTime = GetTime();

		Menu_RedrawMouse(true);
		ProcessEvents();
		//DrawImageAdv(VideoPostProcessor::videoSurface(),tMenu->bmpBuffer, 200,220, 200,220, 240, 240);

		Menu_SvrList_DrawInfo(szAddress, INFO_W, INFO_H);

        cDetails.Draw(VideoPostProcessor::videoSurface());
        gui_event_t *ev = NULL;

		ev = cDetails.Process();
        if(ev) {

			// Ok
            if(ev->iControlID == nd_Ok && ev->iEventMsg == BTN_CLICKED) {
                break;
			// Refresh
            } else if (ev->iControlID == nd_Refresh && ev->iEventMsg == BTN_CLICKED)  {
				fStart = AbsTime();
				bGotDetails = false;
				bOldLxBug = false;
				nTries = 0;
			} else if (ev->iControlID == nd_Join && ev->iEventMsg == BTN_CLICKED)  {
                // Save the list
                SvrList_Save();

				lv_subitem_t *sub = ((CListview *)cInternet.getWidget(mi_ServerList))->getCurSubitem(1);

				// Join
				if (sub)
					Menu_Net_NETJoinServer(szAddress, sub->sText);

				break;
			}
        }

        DrawCursor(VideoPostProcessor::videoSurface());
		doVideoFrameInMainThread();
		CapFPS();
    }

	cDetails.Shutdown();


    // Redraw the background
	DrawImage(tMenu->bmpBuffer.get(),tMenu->bmpMainBack_common,0,0);
	if (tMenu->tFrontendInfo.bPageBoxes)
		Menu_DrawBox(tMenu->bmpBuffer.get(), 15,130, 625, 465);
	Menu_DrawSubTitle(tMenu->bmpBuffer.get(),SUB_NETWORK);
	Menu_RedrawMouse(true);
}
开发者ID:iamnilay3,项目名称:openlierox,代码行数:86,代码来源:Menu_Net_Internet.cpp

示例7: Menu_Net_NETFrame

///////////////////
// Net Internet frame
void Menu_Net_NETFrame(int mouse)
{
	gui_event_t *ev = NULL;
	std::string	addr;


	// Process & Draw the gui
	ev = cInternet.Process();
	cInternet.Draw( VideoPostProcessor::videoSurface() );


	// Process the server list
	static bool wasLoadedBefore = false;
	if( SvrList_Process() || (tIpToCountryDB->Loaded() && !wasLoadedBefore) ) {
		// Add the servers to the listview
		Menu_Net_NET_ServerList_Refresher();
		wasLoadedBefore = tIpToCountryDB->Loaded();
	}



	// Process any events
	if(ev) {

		switch(ev->iControlID) {

			// Add Server
			case mi_AddServer:
				if(ev->iEventMsg == BTN_CLICKED) {
					// Click!
					PlaySoundSample(sfxGeneral.smpClick);

					Menu_Net_NETAddServer();
				}
				break;

			// Back
			case mi_Back:
				if(ev->iEventMsg == BTN_CLICKED) {

					// Shutdown
					Menu_Net_NETShutdown();

					// Click!
					PlaySoundSample(sfxGeneral.smpClick);

					// Back to main menu
					Menu_MainInitialize();
				}
				break;

			// Refresh
			case mi_Refresh:
				if(ev->iEventMsg == BTN_CLICKED) {

					// Click!
					PlaySoundSample(sfxGeneral.smpClick);

					// Refresh the currently visible servers
					SvrList_RefreshList();
					Menu_Net_NET_ServerList_Refresher();
				}
				break;

			// Join
			case mi_Join:
                if(ev->iEventMsg == BTN_CLICKED) {

					addr = "";
					int result = cInternet.SendMessage(mi_ServerList, LVS_GETCURSINDEX, &addr, 0);
					if(result != -1 && addr != "") {

                        // Save the list
                        SvrList_Save();

						// Click!
						PlaySoundSample(sfxGeneral.smpClick);

						lv_subitem_t *sub = ((CListview *)cInternet.getWidget(mi_ServerList))->getCurSubitem(1);

						// Join
						if (sub)
							Menu_Net_NETJoinServer(addr,sub->sText);
						return;
					}
				}
				break;

			// Serverlist
			case mi_ServerList:

                // Double click
				if(ev->iEventMsg == LV_DOUBLECLK) {

					/*
					  Now.... Should a double click refresh the server (like tribes)?
					  Or should it join the server like other games???
					*/
//.........这里部分代码省略.........
开发者ID:iamnilay3,项目名称:openlierox,代码行数:101,代码来源:Menu_Net_Internet.cpp

示例8: Menu_Net_ChatFrame

///////////////////
// The net news menu frame
void Menu_Net_ChatFrame(int mouse)
{
	gui_event_t *ev = NULL;


	// Process & Draw the gui
	ev = cChat.Process();
	cChat.Draw( VideoPostProcessor::videoSurface() );


	// Process any events
	if(ev) {

		switch(ev->iControlID) {

			// Back
			case nc_Back:
				if(ev->iEventMsg == BTN_CLICKED) {

					// Click!
					PlaySoundSample(sfxGeneral.smpClick);

					// Shutdown
					Menu_Net_ChatShutdown();

					// Back to main menu
					Menu_MainInitialize();
				}
				break;


			case nc_EnableChat:
				if(ev->iEventMsg == CHK_CHANGED) {
					
					PlaySoundSample(sfxGeneral.smpClick);
					tLXOptions->bEnableChat = cChat.SendMessage(nc_EnableChat, CKM_GETCHECK, 1, 1) != 0;
					if (!tLXOptions->bEnableChat)
					{
						((CChatWidget *)cChat.getWidget(nc_Chat))->DisableChat();
						ShutdownIRC();
					}
					else
					{
						InitializeIRC();
						((CChatWidget *)cChat.getWidget(nc_Chat))->EnableChat();
					}
				}
				break;

			case nc_EnableMiniChat:
				if(ev->iEventMsg == CHK_CHANGED) {
					PlaySoundSample(sfxGeneral.smpClick);
					tLXOptions->bEnableMiniChat = cChat.SendMessage(nc_EnableMiniChat, CKM_GETCHECK, 1, 1) != 0;
				}
				break;
		}

	}


	// Draw the mouse
	DrawCursor(VideoPostProcessor::videoSurface());
}
开发者ID:iamnilay3,项目名称:openlierox,代码行数:65,代码来源:Menu_Net_Chat.cpp


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