Hi,
I’m trying to call c++ function definied in my Application class from javascript, but with no success.
My application class definition is:
SharedPtr helloText;
public: SampleApplication(Context * context) : Application(context) {}
void CreateText()
{
helloText=new Text(context_);
helloText->SetText("Hello!");
helloText->SetFont(cache->GetResource("Fonts/Anonymous Pro.ttf"), 30);
helloText->SetColor(Color(0.0f, 1.0f, 0.0f));
helloText->SetHorizontalAlignment(HA_CENTER);
helloText->SetVerticalAlignment(VA_CENTER);
GetSubsystem()->GetRoot()->AddChild(helloText);
}
public: void ChangeTextFromJs()
{
helloText->SetText("Hello from JS!");
}
I want to call public function ChangeTextFromJs in my javascript code (after click some html button).
var Module = {
preRun: [],
postRun: [],
print: (function() {
.....