KDvoid GestureShapeLayer::draw ( KDvoid ) { // Set line width. ccLineWidth ( 4.0f ); // Set point size ccPointSize ( 16 ); // Set color to blue ccDrawColor4B ( 255, 0, 0, 255 ); // We either draw a circle or a series of lines if ( m_bDrawCircle ) { // Draw a circle using circleRect information ccDrawCircle ( m_tCircleRect.origin, m_tCircleRect.size.cx, 0.0f, 100, KD_FALSE ); } else if ( m_bDrawLines ) { // Draw all lines for ( KDuint i = 0; i < m_pLines->count ( ); i++ ) { GestureLine* pLine = (GestureLine*) m_pLines->objectAtIndex ( i ); ccDrawLine ( pLine->getPoint1 ( ), pLine->getPoint2 ( ) ); } } // Restore original values ccLineWidth ( 1 ); ccDrawColor4B ( 255, 255, 255, 255 ); ccPointSize ( 1 ); }
virtual void draw() { ccDrawColor4B(m_TouchColor.r, m_TouchColor.g, m_TouchColor.b, 255); ccLineWidth(10); ccDrawLine( ccp(0, m_pTouchPoint.y), ccp(getContentSize().width, m_pTouchPoint.y) ); ccDrawLine( ccp(m_pTouchPoint.x, 0), ccp(m_pTouchPoint.x, getContentSize().height) ); ccLineWidth(1); ccPointSize(30); ccDrawPoint(m_pTouchPoint); }
virtual KDvoid draw ( KDvoid ) { ccDrawColor4B ( m_tTouchColor.r, m_tTouchColor.g, m_tTouchColor.b, 200 ); ccLineWidth ( 10 ); ccDrawLine ( ccp ( 0, m_tTouchPoint.y ), ccp ( getContentSize ( ).cx, m_tTouchPoint.y ) ); ccDrawLine ( ccp ( m_tTouchPoint.x, 0 ), ccp ( m_tTouchPoint.x, getContentSize ( ).cy ) ); glLineWidth ( 1 ); ccPointSize ( 30 ); ccDrawPoint ( m_tTouchPoint ); }