MCPcopy Create free account
hub / github.com/defold/defold / OnContextEvent

Function OnContextEvent

engine/render/src/render/render.cpp:1343–1370  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1341 }
1342
1343 void OnContextEvent(void* context, RenderContextEvent event_type)
1344 {
1345 RenderContext* render_context = (RenderContext*)context;
1346 if (event_type == dmRender::CONTEXT_LOST)
1347 {
1348 SetRenderPause(render_context, 1u);
1349 dmGraphics::InvalidateGraphicsHandles(render_context->m_GraphicsContext);
1350 }
1351 if (render_context->m_CallbackInfo != 0x0)
1352 {
1353 dmScript::LuaCallbackInfo* cbk = render_context->m_CallbackInfo;
1354 if (!dmScript::IsCallbackValid(cbk))
1355 {
1356 return;
1357 }
1358 lua_State* L = dmScript::GetCallbackLuaContext(cbk);
1359 DM_LUA_STACK_CHECK(L, 0);
1360
1361 if (!dmScript::SetupCallback(cbk))
1362 {
1363 return;
1364 }
1365 lua_pushinteger(L, event_type);
1366 int ret = dmScript::PCall(L, 2, 0);
1367 (void)ret;
1368 dmScript::TeardownCallback(cbk);
1369 }
1370 }
1371
1372 void SetRenderPause(HRenderContext context, uint8_t is_paused)
1373 {

Callers

nothing calls this directly

Calls 8

SetRenderPauseFunction · 0.85
IsCallbackValidFunction · 0.85
GetCallbackLuaContextFunction · 0.85
SetupCallbackFunction · 0.85
lua_pushintegerFunction · 0.85
PCallFunction · 0.85
TeardownCallbackFunction · 0.85

Tested by

no test coverage detected