Alphabet Tracing

I think you are going to have to use and/or store a delta. Where the players finger is, if move forward, update it, if move backwards from pervious delta, act upon it and store it.

I did this a while back I called “a line forward or rewind” feature when I was trying to implement and EDM DAW in Cocos2d-x.

i am doing this in touches move.

Vec2 point = Director::getInstance()->convertToGL(touch->getLocationInView());
    
        Vec2 end = Director::getInstance()->convertToGL(touch->getPreviousLocation());
        
        
        float dist = point.getDistance(end);

        // "distance" is previous distance.
        if(distance != 0)
        {
            if (distance < dist) {
                log("low dalta");
            }
            
        }
        distance = dist;

But if user moving finger fast it gives me big distance and if then it start moving slow it gives me low delta. so it doesn’t ensure if user is going backward or not.
Is there any other approach to this. like, i can read color of the touch point. if its already filled it will have different color and if its not filled then it will have white color. But i cant figure out any way to implement this approach.

I would track your own points.

can you please explain a little bit more?

Just Wondering if this can be achieved efficiently with simple Progress bars with stencil for overlay? Looks to me it can be achieved. Simply put in onTouchMove calculate the % of node size where finger is and set progress bar fill % to it. When user needs to trace back just run in a soothing action with % of progress bar going reverse.

Worst case developer/designer needs to create/place progress bars precisely to get words shape for each words, and may needs some kind of data matrices to keep progress bars composition (One character may contain several progress bars) and properties.

Just a random thought off my head.

Regards

1 Like

This was the first solution i was thinking of but what will happen for the worlds like " O " or “S” they will start filling on both sides i think.

O is simple to make, using one single radial bar (constraining -ve %)

this is where designers precision comes in handy

S can be composed by fine arrangement of 2 progress bars going diagonally from starting point of “S” tip on top right to mid and another progress bar going from mid of “S” to tail, both arranged in mirror state.

well i have 36 characters and they are not english alphabets. They are nepali. So in that case i will be needing different algo for each character therefore i dropped the idea of progress bar.

I think you can do this with your own code. Store the points moving in one direction and the current point. If the users goes backwards, you know the points are probably less than the current one you stored.

Also, I could see ways to do this with ray casting and ways to do this with Physics Bodies and and and.

The thing about game development is that you get to decide what works for you. What you understand, what you can maintain. Just because something works for me, doesn’t mean it will for you.

1 Like

Hi i am using renderTexture to detect the color of the point where user touches. It gives me color of every sprite but i can’t get color of DrawNode even if drawNode is not NULL and right beneath the touch point. is there any way to get the drawNode color under user touch point?

Here is what i am doing right now.

RenderTexture* rt = RenderTexture::create(gs->getContentSize().width, gs->getContentSize().height, Texture2D::Pi`xelFormat::RGBA4444);

        rt->beginWithClear( 0, 0, 0, 0);

        gs->visit();
        
        ClippingNode * clip_Node = clipsNodeArray.at(clipsNodeArray.size()-1);
        if((int)drawNodeArray.size() > 0 && clip_Node != NULL)
        {
            DrawNode* d = (DrawNode*)clip_Node->getChildByTag(DRAW_NODE_TAG + (int)drawNodeArray.size());
            if(d!= NULL)
                d->visit();
        }
        auto x = point.x * (CC_CONTENT_SCALE_FACTOR());
        auto y = point.y * (CC_CONTENT_SCALE_FACTOR());


        auto buffer = (Color4B *)malloc(sizeof(Color4B));

        // Get color values of intersection area
        glReadPixels(x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, buffer);

        rt->end();

        // Read buffer
        for(unsigned int i = 0; i < 1; i++) {
            log("RGB :: %d, %d, %d ",buffer->r,buffer->g,buffer->b);