Exemplo n.º 1
0
void Box2DDebugDraw::DrawTransform(const b2Transform& xf)
{
    b2Vec2 p1 = xf.p, p2;
    const float32 k_axisScale = 0.8f;

    p2 = p1 + b2Vec2(k_axisScale * xf.q.c, k_axisScale * xf.q.s);
    DrawSegment(p1, p2, b2Color(1.0f, 0.0f, 0.0f));

    p2 = p1 + b2Vec2(-k_axisScale * xf.q.s, k_axisScale * xf.q.c);
    DrawSegment(p1, p2, b2Color(0.0f, 1.0f, 0.0f));

	/*b2Vec2 p1 = xf.position, p2;
	const float32 k_axisScale = 0.4f;
	glBegin(GL_LINES);
	
	glColor3f(1.0f, 0.0f, 0.0f);
	glVertex2f(p1.x, p1.y);
	p2 = p1 + k_axisScale * xf.R.col1;
	glVertex2f(p2.x, p2.y);

	glColor3f(0.0f, 1.0f, 0.0f);
	glVertex2f(p1.x, p1.y);
	p2 = p1 + k_axisScale * xf.R.col2;
	glVertex2f(p2.x, p2.y);

	glEnd();*/
}
Exemplo n.º 2
0
// back-end
static void
DrawHistograms ()
{
    VisualizationData vd;
    int i; double step = 1;

    if( InitVisualization( &vd ) ) {
        if( vd.hist_width < MIN_HIST_WIDTH ) {
            DrawHistogramAsDiagram( vd.cy, vd.paint_width, vd.hist_count );
            step = 0.5*vd.paint_width / (((vd.hist_count | 7) + 1)/2 + 1.);
        }
        else {
            DrawHistogramFull( vd.cy, step = vd.hist_width, vd.hist_count );
        }
    }
    if(!differentialView) return;
    differentialView = 0;
    DrawSegment( MarginX + MarginW, vd.cy, NULL, NULL, PEN_NONE );
    for( i=0; i<vd.hist_count; i++ ) {
        int index = currFirst + i;
        int x = MarginX + MarginW + index * step + step/2;
        DrawSegment((int) x, GetValueY( GetPvScore(index) ), NULL, NULL, PEN_ANY );
    }
    differentialView = 1;
}
Exemplo n.º 3
0
// back-end
static void
DrawLineEx (int x1, int y1, int x2, int y2, int penType)
{
    int savX, savY;
    DrawSegment( x1, y1, &savX, &savY, PEN_NONE );
    DrawSegment( x2, y2, NULL, NULL, penType );
    DrawSegment( savX, savY, NULL, NULL, PEN_NONE );
}
Exemplo n.º 4
0
DebugRenderer::~DebugRenderer ()
{
#ifndef NO_DEBUG_RENDERER
	const float32 k_impulseScale = 0.1f;
	const float32 k_axisScale = 0.3f;

	const bool drawFrictionImpulse = true;
	const bool drawContactNormals = true;
	const bool drawContactImpulse = true;

	for (int i = 0; i < _pointCount; ++i) {
		const ContactPoint* point = &_points[i];

		if (point->state == b2_addState) {
			DrawPoint(point->position, 0.2f, b2Color(0.3f, 0.95f, 0.3f));
		} else if (point->state == b2_persistState) {
			DrawPoint(point->position, 0.1f, b2Color(0.3f, 0.3f, 0.95f));
		}

		if (drawContactNormals) {
			const b2Vec2& p1 = point->position;
			const b2Vec2 p2 = p1 + k_axisScale * point->normal;
			DrawSegment(p1, p2, b2Color(0.9f, 0.9f, 0.9f));
		}

		if (drawContactImpulse) {
			const b2Vec2& p1 = point->position;
			const b2Vec2 p2 = p1 + k_impulseScale * point->normalImpulse * point->normal;
			DrawSegmentWithAlpha(p1, p2, b2Color(0.9f, 0.9f, 0.3f), 0.5f);
		}

		if (drawFrictionImpulse) {
			const b2Vec2 tangent = b2Cross(point->normal, 1.0f);
			const b2Vec2& p1 = point->position;
			const b2Vec2 p2 = p1 + k_impulseScale * point->tangentImpulse * tangent;
			DrawSegment(p1, p2, b2Color(0.9f, 0.9f, 0.3f));
		}
	}
	for (int i = 0; i < _traceCount; ++i) {
		const TraceData* data = &_traceData[i];
		DrawSegment(data->start, data->end, b2Color(0.9f, 0.0f, 0.0f));
		DrawPoint(data->start, 0.2f, b2Color(0.0f, 0.95f, 0.3f));
		DrawPoint(data->end, 0.2f, b2Color(0.3f, 0.7f, 0.0f));
	}

	if (!_waterIntersectionPoints.empty())
		DrawPolygon(&_waterIntersectionPoints[0], _waterIntersectionPoints.size(), b2Color(0.0f, 1.0f, 1.0f));

	if (_enableTextureArray)
		glEnableClientState(GL_TEXTURE_COORD_ARRAY);
	glEnable(GL_TEXTURE_2D);
	glPopMatrix();
	GL_checkError();
	if (_activeProgram != 0)
		GLContext::get().ctx_glUseProgram(_activeProgram);
#endif
}
Exemplo n.º 5
0
//------------------------------------------------------------------------------
void
DebugDraw::DrawPolygon( const b2Vec2 * vertices, int32 vertexCount,
                        const b2Color & color )
{
    for ( int32 i = 0; i < vertexCount - 1; ++i )
    {
        DrawSegment( vertices[i], vertices[i + 1], color );
    }
    DrawSegment( vertices[vertexCount - 1], vertices[0], color );
}
Exemplo n.º 6
0
void GLESDebugDraw::DrawTransform(const b2Transform& xf)
{
    b2Vec2 p1 = xf.p, p2;
    const float32 k_axisScale = 0.4f;
    p2 = p1 + k_axisScale * xf.q.GetXAxis();
    DrawSegment(p1, p2, b2Color(1,0,0));
    
    p2 = p1 + k_axisScale * xf.q.GetYAxis();
    DrawSegment(p1,p2,b2Color(0,1,0));
}
Exemplo n.º 7
0
void DebugRenderer::DrawTransform (const b2Transform& xf)
{
	const b2Vec2& p1 = xf.p;
	const float32 k_axisScale = 0.4f;

	const b2Vec2 p2 = p1 + k_axisScale * xf.q.GetXAxis();
	DrawSegment(p1, p2, b2Color(1.0f, 0.0f, 0.0f));

	const b2Vec2 p3 = p1 + k_axisScale * xf.q.GetYAxis();
	DrawSegment(p1, p3, b2Color(0.0f, 1.0f, 0.0f));
}
Exemplo n.º 8
0
	void Render::DrawShape(b2Fixture* fixture, const b2Transform& xf, const b2Color& color) {
		switch (fixture->GetType()) {
			case b2Shape::e_circle: {
				b2CircleShape* circle = (b2CircleShape*) fixture->GetShape();

				b2Vec2 center = b2Mul(xf, circle->m_p);
				float32 radius = circle->m_radius;
				b2Vec2 axis = b2Mul(xf.q, b2Vec2(1.0f, 0.0f));

				DrawSolidCircle(center, radius, axis, color);
			}
				break;

			case b2Shape::e_edge: {
				b2EdgeShape* edge = (b2EdgeShape*) fixture->GetShape();
				b2Vec2 v1 = b2Mul(xf, edge->m_vertex1);
				b2Vec2 v2 = b2Mul(xf, edge->m_vertex2);
				DrawSegment(v1, v2, color);
			}
				break;

			case b2Shape::e_chain: {
				b2ChainShape* chain = (b2ChainShape*) fixture->GetShape();
				int32 count = chain->m_count;
				const b2Vec2* vertices = chain->m_vertices;

				b2Vec2 v1 = b2Mul(xf, vertices[0]);
				for (int32 i = 1; i < count; ++i) {
					b2Vec2 v2 = b2Mul(xf, vertices[i]);
					DrawSegment(v1, v2, color);
					DrawCircle(v1, 0.05f, color);
					v1 = v2;
				}
			}
				break;

			case b2Shape::e_polygon: {
				b2PolygonShape* poly = (b2PolygonShape*) fixture->GetShape();
				int32 vertexCount = poly->m_vertexCount;
				b2Assert(vertexCount <= b2_maxPolygonVertices);
				b2Vec2 vertices[b2_maxPolygonVertices];

				for (int32 i = 0; i < vertexCount; ++i) {
					vertices[i] = b2Mul(xf, poly->m_vertices[i]);
				}

				DrawSolidPolygon(vertices, vertexCount, color);
			}
				break;

			default:
				break;
		}
	}
Exemplo n.º 9
0
void GLESDebugDraw::DrawTransform(const b2Transform& xf)
{
	b2Vec2 p1 = xf.p, p2;
   const float32 k_axisScale = 0.4f;
    p2=b2Vec2(0,0);
   //p2 = p1 + k_axisScale * xf.R.col1;
   DrawSegment(p1,p2,b2Color(1,0,0));
   
   //p2 = p1 + k_axisScale * xf.R.col2;
   DrawSegment(p1,p2,b2Color(0,1,0));
}
Exemplo n.º 10
0
void EggAvatar::DrawCurve(IFTImage* pImage, int firstPoint, int numberPoints, bool shouldClose, UINT32 color)
{
    for (int i = 1; i < numberPoints; ++i)
    {
        DrawSegment(pImage, firstPoint + i - 1, firstPoint + i, color);
    }
    if (shouldClose)
    {
        DrawSegment(pImage, firstPoint + numberPoints - 1, firstPoint, color);
    }
}
Exemplo n.º 11
0
    void DrawTransform( const b2Transform &xf, const b2Colors &colors )
    {
        b2Vec2 p1 = xf.position, p2;
        const float k_axisScale = 0.4f;

        p2 = p1 + k_axisScale * xf.R.col1;
        DrawSegment(p1,p2,colors[0]);
        
        p2 = p1 + k_axisScale * xf.R.col2;
        DrawSegment(p1,p2,colors[1]);
    }
Exemplo n.º 12
0
void FrameBuffer::DrawCircle(float h, float k, float rx, float ry, unsigned int color, bool fill) {
	vector center(h, k, 0.0f);
	vector edge(rx, ry, 0.0f);

	float a = .01f;
	int steps = 360/a;
	vector oldEdge = edge;
	for (int i = 0; i < steps; i++) {
		edge.rotatePoint(center, vector(h,k,1.0f), a);	
		DrawSegment(oldEdge, edge, color);
		if(fill)DrawSegment(center, edge, color);
		oldEdge = edge;
	}  
}
Exemplo n.º 13
0
void CDebugDraw::DrawSolidPolygon(const b2Vec2* vertices, int32 vertexCount, const b2Color& color)
{
	for (int i=0;i<vertexCount;i++)
	{
		if (i < vertexCount-1)
		{
			DrawSegment(vertices[i],vertices[i+1],color);
		}
		else
		{
			DrawSegment(vertices[i],vertices[0],color);
		}
	}
}
Exemplo n.º 14
0
void DebugDraw::DrawForce(const b2Vec2& point, const b2Vec2& force, const b2Color& color)
{
	const float32 k_forceScale = 0.1f;
	b2Vec2 p1 = point;
	b2Vec2 p2 = point + k_forceScale * force;
	DrawSegment(p1, p2, color);
}
Exemplo n.º 15
0
void GLESDebugDraw::DrawSolidCircle(const b2Vec2& center, float32 radius, const b2Vec2& axis, const b2Color& color)
{

    const float32 k_segments = 16.0f;
    int vertexCount=16;
    const float32 k_increment = 2.0f * b2_pi / k_segments;
    float32 theta = 0.0f;

    GLfloat				glVertices[vertexCount*2];
    for (int32 i = 0; i < k_segments; ++i)
    {
        b2Vec2 v = center + radius * b2Vec2(cosf(theta), sinf(theta));
        glVertices[i*2]=v.x * mRatio;
        glVertices[i*2+1]=v.y * mRatio;
        theta += k_increment;
    }

   glUniform4f(shaderProgram->locationOfUniform("color"), color.r, color.g, color.b, 1.0);
   glVertexAttribPointer(shaderProgram->indexForAttribute("position"), 2, GL_FLOAT, 0, 0, glVertices);
    glDrawArrays(GL_TRIANGLE_FAN, 0, vertexCount);
    glDrawArrays(GL_LINE_LOOP, 0, vertexCount);

    // Draw the axis line
    DrawSegment(center,center+radius*axis,color);
}
Exemplo n.º 16
0
void GLESDebugDraw::DrawSolidCircle(const b2Vec2& center, float32 radius, const b2Vec2& axis, const b2Color& color)
{
   const float32 k_segments = 16.0f;
   const int vertexCount=16;
   const float32 k_increment = 2.0f * b2_pi / k_segments;
   float32 theta = 0.0f;
   
   GLfloat            glVertices[vertexCount*2];
   for (int32 i = 0; i < k_segments; ++i)
   {
      b2Vec2 v = center + radius * b2Vec2(cosf(theta), sinf(theta));
      glVertices[i*2]=v.x;
      glVertices[i*2+1]=v.y;
      theta += k_increment;
   }
   
   glColor4f(color.r, color.g, color.b,0.5f);
   glVertexPointer(2, GL_FLOAT, 0, glVertices);
   glDrawArrays(GL_TRIANGLE_FAN, 0, vertexCount);
   glColor4f(color.r, color.g, color.b,1);
   glDrawArrays(GL_LINE_LOOP, 0, vertexCount);
   
   // Draw the axis line
   DrawSegment(center,center+radius*axis,color);
}
Exemplo n.º 17
0
void FXElectricity::Draw( void )
{
	float	scale, incr = 0, detail = 0, tcStart = 0 , tcEnd = m_stScale;

	//Check for tapering
	if ( m_flags & FXF_TAPER )
	{
		// This overrides the default of zero
		incr = m_scale / MAX_BOLT_SEGMENTS;
	}

	scale	= m_scale;
	m_init	= false;

	// Set up to calculate the texture coords so the texture can be mapped across the length of the bolt
	if ( m_flags & FXF_WRAP )
	{
		detail = m_stScale / MAX_BOLT_SEGMENTS;
	}

	//Do all segments
	for ( int i = 0; i < MAX_BOLT_SEGMENTS - 1 ; i++ )
	{
		if ( m_flags & FXF_WRAP )
		{
			// This will override the defaults if necessary
			tcStart = detail * i;
			tcEnd = detail * (i+ 1);
		}

		scale -= incr;
		
		DrawSegment( m_boltVerts[i], m_boltVerts[i+1], scale, tcStart, tcEnd );
	}
}
Exemplo n.º 18
0
void DebugRenderer::DrawSolidCircle (const b2Vec2& center, float32 radius, const b2Vec2& axis, const b2Color& color)
{
#ifndef NO_DEBUG_RENDERER
	const float32 k_segments = 16.0f;
	const int vertexCount = 16;
	const float32 k_increment = 2.0f * b2_pi / k_segments;
	float32 theta = 0.0f;

	GLfloat glVertices[vertexCount * 2];
	for (int i = 0; i < k_segments; ++i) {
		const b2Vec2 v = center + radius * b2Vec2(cosf(theta), sinf(theta));
		glVertices[i * 2] = v.x;
		glVertices[i * 2 + 1] = v.y;
		theta += k_increment;
	}

	setColorPointer(color, 0.5f, vertexCount);
	glVertexPointer(2, GL_FLOAT, 0, glVertices);
	glDrawArrays(GL_TRIANGLE_FAN, 0, vertexCount);
	setColorPointer(color, 1.0f, vertexCount);
	glDrawArrays(GL_LINE_LOOP, 0, vertexCount);
	GL_checkError();

	// Draw the axis line
	DrawSegment(center, center + radius * axis, color);
#endif
}
Exemplo n.º 19
0
void LHBox2dDebug::DrawSolidCircle(const b2Vec2& center, float32 radius, const b2Vec2& axis, const b2Color& color)
{
    const float32 k_segments = 16.0f;
	int vertexCount=16;
	const float32 k_increment = 2.0f * b2_pi / k_segments;
	float32 theta = 0.0f;
	
    Vec2* vertices = new Vec2[vertexCount];
	for (int32 i = 0; i < k_segments; ++i)
	{
		b2Vec2 v = center + radius * b2Vec2(cosf(theta), sinf(theta));
        vertices[i] = Vec2(v.x*mRatio, v.y*mRatio);
		theta += k_increment;
	}
    
    Color4F fillColor = Color4F(color.r, color.g, color.b, 0.5);
    Color4F borderColor = Color4F(color.r, color.g, color.b, 1);
    
    drawNode->drawPolygon(vertices, vertexCount, fillColor, 1, borderColor);
    
    delete[] vertices;
    
	// Draw the axis line
	DrawSegment(center,center+radius*axis,color);
}
Exemplo n.º 20
0
/* Initialize the drawing of a segment of type other than trace.
 */
DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, STROKE_T shape, wxDC* DC )
{
    int          lineWidth;
    DRAWSEGMENT* DrawItem;

    lineWidth = GetDesignSettings().GetLineThickness( GetActiveLayer() );

    if( Segment == NULL )        // Create new segment.
    {
        SetCurItem( Segment = new DRAWSEGMENT( GetBoard() ) );
        Segment->SetFlags( IS_NEW );
        Segment->SetLayer( GetActiveLayer() );
        Segment->SetWidth( lineWidth );
        Segment->SetShape( shape );
        Segment->SetAngle( 900 );
        Segment->SetStart( GetCrossHairPosition() );
        Segment->SetEnd( GetCrossHairPosition() );
        m_canvas->SetMouseCapture( DrawSegment, Abort_EditEdge );
    }
    else
    {
        // The ending point coordinate Segment->m_End was updated by the function
        // DrawSegment() called on a move mouse event during the segment creation
        if( Segment->GetStart() != Segment->GetEnd() )
        {
            if( Segment->GetShape() == S_SEGMENT )
            {
                SaveCopyInUndoList( Segment, UR_NEW );
                GetBoard()->Add( Segment );

                OnModify();
                Segment->ClearFlags();

                Segment->Draw( m_canvas, DC, GR_OR );

                DrawItem = Segment;

                SetCurItem( Segment = new DRAWSEGMENT( GetBoard() ) );

                Segment->SetFlags( IS_NEW );
                Segment->SetLayer( DrawItem->GetLayer() );
                Segment->SetWidth( lineWidth );
                Segment->SetShape( DrawItem->GetShape() );
                Segment->SetType( DrawItem->GetType() );
                Segment->SetAngle( DrawItem->GetAngle() );
                Segment->SetStart( DrawItem->GetEnd() );
                Segment->SetEnd( DrawItem->GetEnd() );
                DrawSegment( m_canvas, DC, wxDefaultPosition, false );
            }
            else
            {
                End_Edge( Segment, DC );
                Segment = NULL;
            }
        }
    }

    return Segment;
}
Exemplo n.º 21
0
void LiquidFunDebugDraw::DrawSolidCircle(const b2Vec2& center, float32 radius, const b2Vec2& axis,
        const b2Color& color) {
    Renderer::getCurrent()->getDebugRenderer()->queueFilledCircle(center, radius, CIRCLE_SEGMENTS,
            b2ColorToRgba(color, 0x60));
    Renderer::getCurrent()->getDebugRenderer()->queueCircle(center, radius, CIRCLE_SEGMENTS,
            b2ColorToRgba(color, 0xFF));
    DrawSegment(center, center + radius * axis, color);
}
Exemplo n.º 22
0
//----------------------------
void CBezier::Draw( void )	
{
	vec3_t	pos, old_pos;
    float	mu, mum1;
	float	incr = 1.0f / BEZIER_RESOLUTION, tex = 1.0f, tc1, tc2;
	int		i;

	VectorCopy( mOrigin1, old_pos );

	mInit = false;	//Signify a new batch for vert gluing

	// Calculate the texture coords so the texture can stretch along the whole bezier
//	if ( mFlags & FXF_WRAP )
//	{
//		tex = m_stScale / 1.0f;
//	}

	float mum13, mu3, group1, group2;

	tc1 = 0.0f;

	for ( mu = incr; mu <= 1.0f; mu += incr )
	{
		//Four point curve
		mum1	= 1 - mu;
		mum13	= mum1 * mum1 * mum1;
		mu3		= mu * mu * mu;
		group1	= 3 * mu * mum1 * mum1;
		group2	= 3 * mu * mu *mum1;

		for ( i = 0; i < 3; i++ )
		{
			pos[i] = mum13 * mOrigin1[i] + group1 * mControl1[i] + group2 * mControl2[i] + mu3 * mOrigin2[i];
		}

//		if ( m_flags & FXF_WRAP ) 
//		{
			tc2 = mu * tex;
//		}
//		else
//		{
//			// Texture will get mapped onto each segement
//			tc1 = 0.0f;
//			tc2 = 1.0f;
//		}

		//Draw it
		DrawSegment( old_pos, pos, tc1, tc2 );

		VectorCopy( pos, old_pos );
		tc1 = tc2;
	}

	drawnFx++;
	mLines++; // NOT REALLY A LINE
}
Exemplo n.º 23
0
void Slice::Update(double dt)
{
    if (touchId >= 0)
    {
        cpDataPointer data = this;
        DrawSegment(sliceStart, lastTouchPoint, RGBAColor(1, 0, 0, 1), data);
    }

    ChipmunkDemo::Update(dt);
}
Exemplo n.º 24
0
void FrameBuffer::Draw3DSegment(vector p0, vector p1, PPC *ppc, unsigned int color) {

	vector pp0, pp1;
	if (!ppc->Project(p0, pp0))
		return;
	if (!ppc->Project(p1, pp1))
		return;
	DrawSegment(pp0, pp1, color);  

}
Exemplo n.º 25
0
void SimpleChimneyDraw::drawSegment( AcGiWorldDraw* mode, const AcGePoint3d& spt, const AcGePoint3d& ept )
{
    AcGeVector3d v = ept - spt;
    int n = ( int )( ( v.length() + m_space ) / ( m_length + m_space ) );
    //acutPrintf(_T("\n可绘制的个数:%d"), n);
    v.normalize();

    AcGePoint3d pt = spt;
    for( int i = 0; i < n; i++ )
    {
        DrawSegment( mode, pt, v, m_length, m_width, m_lineWidth );
        pt = pt + v * ( m_length + m_space );
    }
    double ll = ( ept - pt ).length();
    if( ll > m_length * 0.5 ) // 如果有长度的50%,则绘制一小段
    {
        DrawSegment( mode, pt, v, ll, m_width, m_lineWidth );
    }
}
Exemplo n.º 26
0
/* Actually draw histogram as a diagram, cause there's too much data */
static void
DrawHistogramAsDiagram (int cy, int paint_width, int hist_count)
{
    double step;
    int i;

    /* Rescale the graph every few moves (as opposed to every move) */
    hist_count -= hist_count % 8;
    hist_count += 8;
    hist_count /= 2;

    step = (double) paint_width / (hist_count + 1);

    for( i=0; i<2; i++ ) {
        int index = currFirst;
        int side = (currCurrent + i + 1) & 1; /* Draw current side last */
        double x = MarginX + MarginW;

        if( (index & 1) != side ) {
            x += step / 2;
            index++;
        }

        DrawSegment( (int) x, cy, NULL, NULL, PEN_NONE );

        index += 2;

        while( index < currLast ) {
            x += step;

            DrawSeparator( index, (int) x );

            /* Extend line up to current point */
            if( currPvInfo[index].depth > 0 ) {
                DrawSegment((int) x, GetValueY( GetPvScore(index) ), NULL, NULL, (side==0 ? PEN_BOLDWHITE: PEN_BOLDBLACK) );
            }

            index += 2;
        }
    }
}
Exemplo n.º 27
0
    void DebugDraw::DrawSolidCircle(const b2Vec2& center,float32 radius,const b2Vec2& axis,const b2Color& color)
    {
        sf::CircleShape circle(converter::metersToPixels(radius),30);
        circle.setOrigin(converter::metersToPixels(radius),converter::metersToPixels(radius));
        circle.setPosition(converter::metersToPixels(center.x),converter::metersToPixels(center.y));

        circle.setFillColor(_b2ToSf(color,50));
        circle.setOutlineThickness(1.0f);
        circle.setOutlineColor(_b2ToSf(color));
        _render.draw(circle);

         b2Vec2 p = center + (radius * axis);
         DrawSegment(center,p,color);
    }
Exemplo n.º 28
0
/// Draw a solid circle.
void DebugRender::DrawSolidCircle(const b2Vec2& center, float32 radius, const b2Vec2& axis, const b2Color& color)
{
    cs.setFillColor(sf::Color(0,0,0,0));
    cs.setOutlineColor(sf::Color(255.f/color.r, 255.f/color.g, 255.f/color.b));
    cs.setOutlineThickness(2.f);
    cs.setPosition(center.x*pixelsPerMeter, center.y*pixelsPerMeter);
    cs.setRadius(radius*pixelsPerMeter);
    cs.setOrigin(radius*pixelsPerMeter, radius*pixelsPerMeter);
    window->draw(cs);

    b2Vec2 seg = center;
    seg.x += axis.x*radius;
    seg.y += axis.y*radius;
    DrawSegment(center, seg, color);
}
void SCH_EDIT_FRAME::DeleteCurrentSegment( wxDC* DC )
{
    SCH_SCREEN* screen = GetScreen();

    SetRepeatItem( NULL );

    if( ( screen->GetCurItem() == NULL ) || !screen->GetCurItem()->IsNew() )
        return;

    DrawSegment( m_canvas, DC, wxDefaultPosition, false );

    screen->Remove( screen->GetCurItem() );
    m_canvas->SetMouseCaptureCallback( NULL );
    screen->SetCurItem( NULL );
}
Exemplo n.º 30
0
void kwxLCDDisplay::DrawDigit( wxDC *dc, int digit, wxDigitData *data )
{
	unsigned char dec = Decode( data->value );

	if( data->value == ':' )	//scrive :
		DrawTwoDots( dc, digit );
	else
	{
		for( int c = 0; c < LCD_NUMBER_SEGMENTS - 1; c++ )
		{
			DrawSegment( dc, digit, c, ( dec >> c ) & 1 );
		}

		DrawSegment( dc, digit, 7, data->comma );	//scrive comma
	}
}