MCPcopy Create free account
hub / github.com/BabylonJS/BabylonNative / Initialize

Method Initialize

Plugins/NativeWindow/Source/NativeWindow.cpp:10–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8 }
9
10 void NativeWindow::Initialize(Napi::Env env, void* windowPtr, size_t width, size_t height)
11 {
12 Napi::HandleScope scope{env};
13
14 Napi::Function constructor = DefineClass(
15 env,
16 JS_CLASS_NAME,
17 {});
18
19 auto global = env.Global();
20 auto jsNative = global.Get(JsRuntime::JS_NATIVE_NAME).As<Napi::Object>();
21 auto jsWindow = constructor.New({Napi::External<void>::New(env, windowPtr), Napi::Number::From(env, width), Napi::Number::From(env, height)});
22
23 jsNative.Set(JS_NATIVE_WINDOW_NAME, jsWindow);
24 }
25
26 NativeWindow& NativeWindow::GetFromJavaScript(Napi::Env env)
27 {

Callers

nothing calls this directly

Calls 4

GlobalMethod · 0.80
SetMethod · 0.80
GetMethod · 0.45
NewMethod · 0.45

Tested by

no test coverage detected