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

Function EngineCreate

engine/hid/src/test/test_app_hid.cpp:344–425  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

342}
343
344static void* EngineCreate(int argc, char** argv)
345{
346 EngineCtx* engine = (EngineCtx*)&g_EngineCtx;
347 memset(engine, 0, sizeof(EngineCtx));
348 engine->m_InteractiveOutput = IsInteractiveStdout();
349#if defined(_WIN32)
350 if (engine->m_InteractiveOutput && !EnableVirtualTerminalProcessing())
351 {
352 engine->m_InteractiveOutput = false;
353 }
354#endif
355 SetLastEvent(engine, "Waiting for input");
356
357 engine->m_Window = dmPlatform::NewWindow();
358
359 WindowCreateParams window_params;
360 WindowCreateParamsInitialize(&window_params);
361 window_params.m_Width = 32;
362 window_params.m_Height = 32;
363 window_params.m_Title = "hid_test_app";
364 window_params.m_ContextAlphabits = 8;
365 window_params.m_Hidden = 1;
366
367 if (dmGraphics::GetInstalledAdapterFamily() == dmGraphics::ADAPTER_FAMILY_OPENGLES)
368 {
369 window_params.m_GraphicsApi = WINDOW_GRAPHICS_API_OPENGLES;
370 }
371 else
372 {
373 window_params.m_GraphicsApi = WINDOW_GRAPHICS_API_OPENGL;
374 }
375
376
377 (void)dmPlatform::OpenWindow(engine->m_Window, window_params);
378
379#if defined(ANDROID)
380 if (!WaitForWindow())
381 {
382 dmLogFatal("Unable to open the Android window.");
383 EngineDestroy(engine);
384 return 0;
385 }
386#endif
387
388 dmGraphics::ContextParams graphics_context_params = {};
389 graphics_context_params.m_DefaultTextureMinFilter = dmGraphics::TEXTURE_FILTER_LINEAR_MIPMAP_NEAREST;
390 graphics_context_params.m_DefaultTextureMagFilter = dmGraphics::TEXTURE_FILTER_LINEAR_MIPMAP_NEAREST;
391 graphics_context_params.m_VerifyGraphicsCalls = false;
392 graphics_context_params.m_Window = engine->m_Window;
393
394 dmGraphics::InstallAdapter(dmGraphics::ADAPTER_FAMILY_OPENGL);
395 dmGraphics::HContext graphics_context = dmGraphics::NewContext(graphics_context_params);
396 if (graphics_context == 0x0)
397 {
398 dmLogFatal("Unable to create the graphics context.");
399 return 0;
400 }
401

Callers

nothing calls this directly

Calls 15

IsInteractiveStdoutFunction · 0.85
SetLastEventFunction · 0.85
EnableAccelerometerFunction · 0.85
SetWindowFunction · 0.85
WaitForWindowFunction · 0.70
EngineDestroyFunction · 0.70
NewWindowFunction · 0.50
OpenWindowFunction · 0.50

Tested by

no test coverage detected