Skip to content

Study new solution for overriding C++ invoked functions in JS #1021

Open
@zhaijialong

Description

@zhaijialong

Note

This issue is migrated from here. It was created at 2014/07/08 06:49:59 +0000

Description

There are some functions in engine which is always invoked by C++

- onEnter
- onExit
- update of Actions

So if we inherit a class from engine class, and want to rewrite these functions, we need to call the js functions directly in C++, there is an solution for onEnter/onExit today, but it is very confusing and need to modify all classes which have onEnter function.

Take onEnter as example
Maybe it's better to add a fake onEnter function to detect whether there is a js overrided implementation of onEnter, if yes, invoke the extended onEnter function, otherwise call C++ original _onEnter function. This means the original onEnter function will be renamed to _onEnter and delegate to the fake onEnter

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions