//! called during the initialization of the entity
	void TrailEntity::Init()
	{
		GraphicComponent* gc = GetComponent<GraphicComponent>();
		if (!gc)
		{
			gc = snew GraphicComponent();
			gc->SetRenderingPass(GraphicComponent::RP_3DTransparent);
			AddComponent(gc, true);
		}

		auto numTriangles = (m_NumEdges - 1) * 2;
		auto numVertices = numTriangles * 3;
		auto vb = GraphicsDriver::Instance()->CreateVertexBuffer();
		vb->SetName(GetClassName());
		vb->SetDynamic(true);
		vb->SetVertices(snew Vertex3D[numVertices], numVertices, Vertex3D::VF_Pos | Vertex3D::VF_UV | Vertex3D::VF_Color);
		vb->SetNumVertices(0);
		vb->SetApplyWorldTransforms(false);
		gc->SetVertexBuffer(vb);

		auto startingPos = GetAbsolutePosition();
		for (uint i = 0; i < m_NumEdges; ++i)
			m_Points.push_back(startingPos);

		super::Init();
	}
Exemple #2
0
	void NetMessage::MakeSpace(size_t size)
	{
		if (Writeable() + Prependable() < size)
		{
			if (!IsDynamic())
			{
				SetDynamic();
			}
			dynamic_data_->resize(writer_pos_ + size);
		}
		else
		{
			const size_t readable_size = Readable();
			if (!IsDynamic())
			{
				memcpy(static_data_.data(), static_data_.data() + reader_pos_, readable_size);
			}
			else
			{
				memcpy(dynamic_data_->data(), dynamic_data_->data() + reader_pos_, readable_size);
			}
			reader_pos_ = 0;
			writer_pos_ = readable_size;
			assert(readable_size == Readable());
		}
	}
Exemple #3
0
static void GetVariableVals( gui_window *gui,
                             a_dialog_header *curr_dialog, bool closing )
/***********************************************************************/
/* Get the input variable values. Decide how to set these */
/* default values based on edit control type. */
{
    char                *text;
    int                 i;
    int                 is_checked;
    gui_control_class   a_control_class;
    vhandle             *pVariable;
    vhandle             var_handle;
    bool                drive_checked;

    drive_checked = FALSE;
    pVariable = curr_dialog->pVariables;
    for( i = 0; pVariable[i] != NO_VAR; i++ ) {
        var_handle = pVariable[i];
        a_control_class = ControlClass( VarGetId( var_handle ), curr_dialog );
        switch( a_control_class ) {
        case GUI_STATIC:
            if( !closing ) {
                SetDynamic( gui, var_handle, &drive_checked );
            }
            break;
        case GUI_RADIO_BUTTON:
        case GUI_CHECK_BOX:
            is_checked = (int)GUIIsChecked( gui, VarGetId( var_handle ) );
            if( is_checked ) {
                if( VarIsRestrictedFalse( var_handle ) ) {
                    if( !closing ) {
                        MsgBox( gui, "IDS_NODISKFOROPTION", GUI_OK );
                        GUISetChecked( gui, VarGetId( var_handle ), 0 );
                        if( var_handle == FullInstall ) {
                            GUISetChecked( gui, VarGetId( SelectiveInstall ), 1 );
                        }
                    }
                    SetVariableByHandle( var_handle, "0" );
                    if( var_handle == FullInstall ) {
                        SetVariableByHandle( SelectiveInstall, "1" );
                    }
                } else {
                    SetVariableByHandle( var_handle, "1" );
                }
            } else {
                SetVariableByHandle( var_handle, "0" );
            }
            break;
        case GUI_EDIT:
            text = GUIGetText( gui, VarGetId( var_handle ) );
            if( text != NULL ) {
                SetVariableByHandle( var_handle, text );
                GUIMemFree( text );
            }
            break;
        default:
            break;
        }
    }
}
AUI_ERRCODE aui_TipWindow::InitCommon( void )
{
	m_allocatedTip = FALSE;
	m_staticTip = NULL;

	SetDynamic( TRUE );

	return AUI_ERRCODE_OK;
}
AUI_ERRCODE c3_HyperTipWindow::InitCommon( void )
{
	m_allocatedHyperTip = FALSE;
	m_hyperTip = NULL;

	SetDynamic( TRUE );

	return AUI_ERRCODE_OK;
}
Exemple #6
0
	void NetMessage::Reserve(size_t size)
	{
		if (!IsDynamic())
		{
			if (size <= static_data_.size())
			{
				return;
			}
			SetDynamic();
		}
		dynamic_data_->reserve(size);
	}
Exemple #7
0
static void SetDefaultVals( gui_window *gui, a_dialog_header *curr_dialog )
/*************************************************************************/
/* Set the default variable values. Decide how to set these  */
/* default values based on edit control type. */
{
    int                 i;
    gui_control_class   a_control_class;
    vhandle             var_handle;
    char                *cond;
    bool                drive_checked;

    drive_checked = FALSE;
    for( i = 0; curr_dialog->pVariables[i] != NO_VAR; ++i ) {
        var_handle = curr_dialog->pVariables[i];
        cond = curr_dialog->pConditions[i];
        if( !curr_dialog->defaults_set &&
            cond != NULL && VarGetIntVal( var_handle ) == 0 ) {
            if( isdigit( *cond ) ) {
                SetVariableByHandle( var_handle, cond );
            } else if( EvalCondition( cond ) ) {
                SetVariableByHandle( var_handle, "1" );
            }
        }
        a_control_class = ControlClass( VarGetId( var_handle ), curr_dialog );
        switch( a_control_class ) {
        case GUI_STATIC:
            SetDynamic( gui, var_handle, &drive_checked );
            break;
        case GUI_RADIO_BUTTON:
        case GUI_CHECK_BOX:
            GUISetChecked( gui, VarGetId( var_handle ), VarGetIntVal( var_handle ) != 0 );
            break;
        case GUI_EDIT_MLE:
        case GUI_EDIT:
            GUISetText( gui, VarGetId( var_handle ), VarGetStrVal( var_handle ) );
            break;
        default:
            break;
        }
    }
    curr_dialog->defaults_set = TRUE;
}