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


C++ LList::ValidIndex方法代码示例

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


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

示例1: EclRemoveAllWindows

void EclRemoveAllWindows()
{
    while( windows.ValidIndex(0) )
    {
        EclRemoveWindow( windows[0]->m_name );
    }
}
开发者ID:cahocachi,项目名称:DEFCON,代码行数:7,代码来源:eclipse.cpp

示例2: ClickNewsButton

void NewsScreenInterface::ClickNewsButton ( Button *button )
{

	int index;
	sscanf ( button->name, "news_story %d", &index );

	index += baseoffset;

	// Dirty the old button

	char oldname [128];
	UplinkSnprintf ( oldname, sizeof ( oldname ), "news_story %d", currentselect - baseoffset );
	EclDirtyButton ( oldname );

	CompanyUplink *cu = (CompanyUplink *) game->GetWorld ()->GetCompany ( "Uplink" );
	UplinkAssert ( cu );

	if ( cu->GetNews (index) ) {

		currentselect = index;
        
	    // Reset the offset so the player can read it from line 1
        ScrollBox *scrollBox = ScrollBox::GetScrollBox( "news_details" );
        if ( scrollBox ) {
            scrollBox->SetCurrentIndex( 0 );

            char *newDetails = cu->GetNews (index)->GetDetails();
            Button *detailsButton = EclGetButton ( "news_details box" );
            UplinkAssert (detailsButton);
        	LList <char *> *wrappedtext = wordwraptext ( newDetails, detailsButton->width );
			if ( wrappedtext ) {
				scrollBox->SetNumItems( wrappedtext->Size() );
				if ( wrappedtext->ValidIndex (0) && wrappedtext->GetData (0) )
					delete [] wrappedtext->GetData(0);
				delete wrappedtext;
			}
			else {
				scrollBox->SetNumItems( 0 );
			}
        }

		EclRegisterCaptionChange ( "news_details box", cu->GetNews (index)->GetDetails (), 2000 );

	}
	
}
开发者ID:gene9,项目名称:uplink-source-code,代码行数:46,代码来源:newsscreen_interface.cpp

示例3: EclRemoveAllWindowsExclude

void EclRemoveAllWindowsExclude( char *exclude){
	while( windows.ValidIndex(0) )
    {
        EclRemoveWindow( windows[0]->m_name );
    }
}
开发者ID:cahocachi,项目名称:DEFCON,代码行数:6,代码来源:eclipse.cpp

示例4: DrawDetails

void NewsScreenInterface::DrawDetails ( Button *button, bool highlighted, bool clicked )
{

	UplinkAssert (button);

	int screenheight = app->GetOptions ()->GetOptionValue ( "graphics_screenheight" );
	glScissor ( button->x, screenheight - (button->y + button->height), button->width, button->height );	
	glEnable ( GL_SCISSOR_TEST );

	// Get the offset

	char name_base [128];
	sscanf ( button->name, "%s", name_base );
    ScrollBox *scrollBox = ScrollBox::GetScrollBox( name_base );
    if ( !scrollBox ) return;
    int offset = scrollBox->currentIndex;
	
	// Draw the button

	glBegin ( GL_QUADS );
		SetColour ( "PanelBackgroundA" );       glVertex2i ( button->x, button->y + button->height );
		SetColour ( "PanelBackgroundB" );       glVertex2i ( button->x, button->y );
		SetColour ( "PanelBackgroundA" );       glVertex2i ( button->x + button->width, button->y );
		SetColour ( "PanelBackgroundB" );       glVertex2i ( button->x + button->width, button->y + button->height );
	glEnd ();

	SetColour ( "PanelBorder" );
	border_draw ( button );


	// Draw the text

	int maxnumlines = (button->height - 10 ) / 15;

	SetColour ( "DefaultText" );

	LList <char *> *wrappedtext = wordwraptext ( button->caption, button->width );

	if ( wrappedtext ) {

		for ( int i = offset; i < wrappedtext->Size (); ++i ) {

			if ( i > maxnumlines + offset )
				break;

			int xpos = button->x + 10;
			int	ypos = button->y + 10 + (i-offset) * 15;

			GciDrawText ( xpos, ypos, wrappedtext->GetData (i), HELVETICA_10 );

		}

		//DeleteLListData ( wrappedtext );							// Only delete first entry - since there is only one string really
		if ( wrappedtext->ValidIndex (0) && wrappedtext->GetData (0) )
			delete [] wrappedtext->GetData (0);
		delete wrappedtext;

	}

	glDisable ( GL_SCISSOR_TEST );
	
}
开发者ID:gene9,项目名称:uplink-source-code,代码行数:62,代码来源:newsscreen_interface.cpp


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