How can i find this API ---- cocos2dxv4.0rc

kmGLTranslatef(0, 0, 0);

I can’t find it… (V4)

plz help!

Why don’t you search for kmGLTranslatef in the engine code where it exists (v3.17.2 has it) to see how it’s implemented? If you did that, then you would instantly see some vital bits of information:

void CC_DLL kmGLTranslatef(float x, float y, float z)
{
    Mat4 mat;
    Mat4::createTranslation(Vec3(x, y, z), &mat);
    Director::getInstance()->multiplyMatrix(currentActiveStackType, mat);
}

You can then simply re-implement that to work with V4 of the engine.

Now, more importantly, is this golden bit of info:

CC_DEPRECATED_ATTRIBUTE void CC_DLL kmGLTranslatef(float x, float y, float z);

That function, along with all other kmXYZ functions are deprecated, and have been that way for a number of years. Deprecated functionality can be removed any point in newer versions, and as you noticed, it’s gone in V4.

Perhaps now is a good time you updated your code in order to remove all dependencies on deprecated functionality.

1 Like

Thank you. Is there a similar function? If I delete

it … :grinning::grinning::grinning::grinning::laughing::laughing::laughing::laughing:

I don’t know if there’s a replacement function for it, but perhaps someone else can answer that question. Regardless though, review the code that is using it, and figure out what it’s used for, and if you can implement it a different way. You have the original implementation of that function, so just write a new one based on the V4 code-base.

1 Like

I’ve deleted it. I’ll try to replace it.:rofl::rofl::rofl::rofl::rofl::rofl::rofl::rofl:

@zhangxm is there a replacement for kmGLTranslatef(0, 0, 0);?

As @R101 said, you can implement the logic yourself, just copy the logic.

1 Like