//--------------------------------------------------------------------------- tjs_error TJS_INTF_METHOD tTJSNativeClass::CreateNew(tjs_uint32 flag, const tjs_char * membername, tjs_uint32 *hint, iTJSDispatch2 **result, tjs_int numparams, tTJSVariant **param, iTJSDispatch2 *objthis) { // CreateNew iTJSDispatch2 *superinst = NULL; if( SuperClass != NULL && membername == NULL ) { tjs_error hr = SuperClass->CreateNew( flag, membername, hint, &superinst, numparams, param, objthis ); if(TJS_FAILED(hr)) { superinst = NULL; } } iTJSDispatch2 *dsp = CreateBaseTJSObject(); tjs_error hr; try { // set object type for debugging if(TJSObjectHashMapEnabled()) TJSObjectHashSetType(dsp, TJS_W("instance of class ") + ClassName); // instance initialization hr = FuncCall(0, NULL, NULL, NULL, 0, NULL, dsp); // add member to dsp if(TJS_FAILED(hr)) return hr; if( superinst != NULL ) { tTJSVariant param(superinst,superinst); dsp->ClassInstanceInfo( TJS_CII_SET_SUPRECLASS, 0, ¶m ); superinst->Release(); superinst = NULL; } hr = FuncCall(0, ClassName.c_str(), ClassName.GetHint(), NULL, numparams, param, dsp); // call the constructor if(hr == TJS_E_MEMBERNOTFOUND) hr = TJS_S_OK; // missing constructor is OK ( is this ugly ? ) } catch(...) { dsp->Release(); if( superinst ) superinst->Release(); throw; } if(TJS_SUCCEEDED(hr)) { *result = dsp; } else if( superinst ) { superinst->Release(); } return hr; }
/*--------------------------------------------------------------------------- 2015/03/02 功能: ---------------------------------------------------------------------------*/ void LuaLibOpenGL::Initialize(lua_State* A_L) { m_L = A_L; luaopen_bit32(A_L); FILE* pFile = fopen("OpenGL.lua", "rb"); if(pFile != NULL) { fseek(pFile, 0, SEEK_END); int nLen = ftell(pFile); char* pBuff = new char[nLen + 1]; pBuff[nLen] = 0; fseek(pFile, 0, SEEK_SET); fread(pBuff, nLen, 1, pFile); fclose(pFile); luaL_dostring(m_L, pBuff); delete[] pBuff; } // 注册 OpenGL 函数到 gl 表中 RegistTableGL(); // 调用初始化函数 FuncCall("Init"); }
void MediaStreamTrack::inner_set_ready_state(MediaStreamTrackState value) { if (ready_state_ != value) { ready_state_ = value; if (value == MediaStreamTrackState::Ended) { FuncCall(on_ended_); } change_emitter_->Emit(None()); } }
FuncCall Create() { return FuncCall(id, params, line_number); }
/*--------------------------------------------------------------------------- 2015/03/02 功能: ---------------------------------------------------------------------------*/ void LuaLibOpenGL::Rend() { FuncCall("Rend"); }