Example #1
0
void CCLabelNode::draw()
{
    CCNode::draw();

    if ( m_Label->debugDraw)
    {
        // Render the text box
        float width = m_Label->GetCalculatedWidth();
        float height = m_Label->GetCalculatedHeight();

        QVec2 vertices[4]={
            QVec2(0,0),
            QVec2(0,height),
            QVec2(width,height),
            QVec2(width,0),
        };
        QDirector::DrawColor4F(1, 1, 1, 1);
        QDirector::DrawPolyVert2F((const ccVertex2F*)vertices, 4, true);

        // Render the border box
        vertices[0].x += m_Label->textBorderLeft;
        vertices[1].x += m_Label->textBorderLeft;
        vertices[2].x -= m_Label->textBorderRight;
        vertices[3].x -= m_Label->textBorderRight;

        vertices[0].y += m_Label->textBorderBottom;
        vertices[1].y -= m_Label->textBorderTop;
        vertices[2].y -= m_Label->textBorderTop;
        vertices[3].y += m_Label->textBorderBottom;

        QDirector::DrawColor4F(1, 1, 0, 1);
        QDirector::DrawPolyVert2F((const ccVertex2F*)vertices, 4, true);
    }
}
Example #2
0
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

#include "QDefines.h"
#include "QVec2.h"

QUICK_NAMESPACE_BEGIN;

QVec2 QVec2::g_Zero = QVec2(0.0f, 0.0f);

//------------------------------------------------------------------------------
// QVec2
//------------------------------------------------------------------------------
QVec2::QVec2(float _x, float _y)
{
    x = _x;
    y = _y;
}
//------------------------------------------------------------------------------
QVec2 QVec2::GetNormal()
{
    QVec2 n;
	n.x =  y;
	n.y = -x;