Ejemplo n.º 1
0
void __cdecl ColorFlags(ObjectMaster* _this)
{
	ObjectMaster* chao = GetChaoObject(0, ((EntityData1*)_this->Data1)->Rotation.x);
	EntityData1* debug = (EntityData1*)_this->Data1;
	ChaoDataBase* data = ((ChaoData1*)chao->Data1)->ChaoDataBase_ptr;

	int buttons = ControllerPointers[2]->PressedButtons;

	if (buttons & Buttons_B)
	{
		ChaoDebug_MenuBack(_this);
		return;
	}

	if (buttons & Buttons_Up && --debug->NextAction < 0)
		debug->NextAction = 0;
	if (buttons & Buttons_Down)
		++debug->NextAction %= 2;

	SetSelectColor(debug->NextAction, 0);
	DisplayDebugStringFormatted(NJM_LOCATION(16, 16), "MONOTONE: %s", GetOnOff(data->MonotoneHighlights));
	SetSelectColor(debug->NextAction, 1);
	DisplayDebugStringFormatted(NJM_LOCATION(16, 17), "SHINY: %s", GetOnOff(data->Shiny));
	SetDebugFontColor(0xFFFFFFFF);

	if (buttons & Buttons_A)
	{
		switch (debug->NextAction)
		{
			case 0:
				data->MonotoneHighlights = !data->MonotoneHighlights;
				break;

			case 1:
				data->Shiny = !data->Shiny;
				break;

			default:
				break;
		}

		ResetChao(chao, data->Type);
	}
}
void InteractiveWidget::DrawWidget() const
{

    glPushAttrib( GL_LIGHTING_BIT | GL_ENABLE_BIT );
    glEnable( GL_LIGHTING );

    glPushMatrix();

    glMultMatrixd( &m_matTrans(0,0) );
    glMultMatrixd( &m_matTransDelta(0,0) );
    glMultMatrixd( &m_matRot(0,0) );
    glMultMatrixd( &m_matRotDelta(0,0) );
    glMultMatrixd( &m_matScale(0,0) );
    glMultMatrixd( &m_matScaleDelta(0,0) );

    // ToDo: use sphere class to draw widget center
    //static Sphere sphere(2);
    SetSelectColor( TRANS );
    glPushMatrix();
    glScaled(0.1, 0.1, 0.1);
    //sphere.draw();
    glPopMatrix();

    if ( m_typeTransform == NONE || m_typeTransform == TRANS_X ) {
        SetSelectColor( TRANS_X );
        glPushMatrix();
        glRotated( -90, 0,0,1 );
        DrawArrow( 1.0, 0.075, 10 );
        glPopMatrix();
    }

    if ( m_typeTransform == NONE || m_typeTransform == TRANS_Y ) {
        SetSelectColor( TRANS_Y );
        DrawArrow( 1.0, 0.075, 10 );
    }

    if ( m_typeTransform == NONE || m_typeTransform == TRANS_Z ) {
        SetSelectColor( TRANS_Z );
        glPushMatrix();
        glRotated( 90, 1,0,0 );
        DrawArrow( 1.0, 0.075, 10 );
        glPopMatrix();
    }

    if ( m_typeTransform == NONE || m_typeTransform == SCALE_X ) {
        SetSelectColor( SCALE_X );
        glPushMatrix();
        glRotated( -90, 0,0,1 );
        DrawSceptre( 0.5, 0.1, 10, 4 );
        glPopMatrix();
    }

    if ( m_typeTransform == NONE || m_typeTransform == SCALE_Y ) {
        SetSelectColor( SCALE_Y );
        DrawSceptre( 0.5, 0.1, 10, 4 );
    }

    if ( m_typeTransform == NONE || m_typeTransform == SCALE_Z ) {
        SetSelectColor( SCALE_Z );
        glPushMatrix();
        glRotated( 90, 1,0,0 );
        DrawSceptre( 0.5, 0.1, 10, 4 );
        glPopMatrix();
    }

    SetSelectColor( ROTATE_X );
    glPushMatrix();
    glRotated( -90, 0,0,1 );
    DrawSceptre(1.5, 0.05, 10, 4 );
    if ( m_typeMove == ROTATE_X ) {
        glRotated( 90, 0,0,1 );
        SetSelectColor( ROTATE_X, 1 );
        DrawCylinderOpen( Point3(0,-0.1,0), 0.2, 1.5, 40 );
        glRotated( 90, 1,0,0 );
        SetSelectColor( ROTATE_X, 2 );
        DrawCylinderOpen( Point3(0,-0.1,0), 0.2, 1.5, 40 );
    }
    glPopMatrix();

    glPushMatrix();
    SetSelectColor( ROTATE_Y );
    DrawSceptre( 1.5, 0.05, 10, 4 );
    if ( m_typeMove == ROTATE_Y ) {
        glRotated( 90, 0,0,1 );
        SetSelectColor( ROTATE_Y, 0 );
        DrawCylinderOpen( Point3(0,-0.1,0), 0.2, 1.5, 40 );
        glRotated( 90, 1,0,0 );
        SetSelectColor( ROTATE_Y, 2 );
        DrawCylinderOpen( Point3(0,-0.1,0), 0.2, 1.5, 40 );
    }
    glPopMatrix();

    SetSelectColor( ROTATE_Z );
    glPushMatrix();
    glRotated( 90, 1,0,0 );
    DrawSceptre( 1.5, 0.05, 10, 4 );
    if ( m_typeMove == ROTATE_Z ) {
        glRotated( 90, 0,0,1 );
        SetSelectColor( ROTATE_Z, 0 );
        DrawCylinderOpen( Point3(0,-0.1,0), 0.2, 1.5, 40 );
        glRotated( 90, 1,0,0 );
        SetSelectColor( ROTATE_Z, 1 );
        DrawCylinderOpen( Point3(0,-0.1,0), 0.2, 1.5, 40 );
    }
    glPopMatrix();    

    if ( m_typeTransform == NONE || m_typeTransform == SCALE ) {
        SetSelectColor( SCALE );
        glPushMatrix();
        glRotated( 90, 0,0,1 );
        glRotated( -45, 1,0,0 );
        DrawSceptre( sqrt(2.0) * 0.5, 0.075, 10, 4 );
        glPopMatrix();
    }

    glPopMatrix();

    glPopAttrib();
}