MCPcopy Create free account
hub / github.com/crownengine/crown / main_loop

Method main_loop

src/device/device.cpp:571–878  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

569}
570
571int Device::main_loop()
572{
573 s64 run_t0 = time::now();
574
575 _console_server->register_command_name("pause", "Pause the engine.", device_command_pause, this);
576 _console_server->register_command_name("unpause", "Resume the engine.", device_command_unpause, this);
577 _console_server->register_command_name("game", "Pause/resume the engine.", device_command_game, this);
578 _console_server->register_command_name("crash", "Crash the engine.", device_command_crash, this);
579
580 _console_server->register_message_type("resize", device_message_resize, this);
581 _console_server->register_message_type("frame", device_message_frame, this);
582 _console_server->register_message_type("quit", device_message_quit, this);
583 _console_server->register_message_type("refresh", device_message_refresh, this);
584
585#if !CROWN_PLATFORM_EMSCRIPTEN
586 _console_server->listen(_options._console_port
587 , _options._wait_console
588 , _options._port_file.empty() ? NULL : _options._port_file.c_str()
589 , CROWN_DEFAULT_CONSOLE_PORT
590 );
591#endif
592
593 bool is_bundle = true;
594#if CROWN_PLATFORM_ANDROID
595 _data_filesystem = CE_NEW(_allocator, FilesystemApk)(default_allocator(), (AAssetManager *)g_platform_data._android_asset_manager);
596#else
597 _data_filesystem = CE_NEW(_allocator, FilesystemDisk)(default_allocator());
598 {
599 char cwd[1024];
600 const char *data_dir = NULL;
601
602 if (_options._bundle_dir.empty() && _options._data_dir.empty()) {
603 data_dir = os::getcwd(cwd, sizeof(cwd));
604 } else {
605 if (!_options._bundle_dir.empty()) {
606 data_dir = _options._bundle_dir.c_str();
607 } else {
608 is_bundle = false;
609 if (!_options._data_dir.empty())
610 data_dir = _options._data_dir.c_str();
611 else
612 data_dir = os::getcwd(cwd, sizeof(cwd));
613 }
614 }
615
616 ((FilesystemDisk *)_data_filesystem)->set_prefix(data_dir);
617 }
618#endif // if CROWN_PLATFORM_ANDROID
619
620 logi(DEVICE, "Crown %s %s %s", CROWN_VERSION, CROWN_PLATFORM_NAME, CROWN_ARCH_NAME);
621
622 _shader_manager = CE_NEW(_allocator, ShaderManager)(default_allocator());
623
624 _resource_loader = CE_NEW(_allocator, ResourceLoader)(*_data_filesystem, is_bundle);
625 _resource_loader->register_fallback(RESOURCE_TYPE_FONT, STRING_ID_64("core/fallback/fallback", 0xd09058ae71962248));
626 _resource_loader->register_fallback(RESOURCE_TYPE_MESH, STRING_ID_64("core/fallback/fallback", 0xd09058ae71962248));
627 _resource_loader->register_fallback(RESOURCE_TYPE_TEXTURE, STRING_ID_64("core/fallback/fallback", 0xd09058ae71962248));
628 _resource_loader->register_fallback(RESOURCE_TYPE_MATERIAL, STRING_ID_64("core/fallback/fallback", 0xd09058ae71962248));

Callers 1

main_runtimeFunction · 0.80

Calls 15

nowFunction · 0.85
expandFunction · 0.85
parent_dirFunction · 0.85
renderer_type_to_bgfxFunction · 0.85
getCapsFunction · 0.85
merged_render_settingsFunction · 0.85
secondsFunction · 0.85
frameFunction · 0.85
register_command_nameMethod · 0.80
register_message_typeMethod · 0.80
set_prefixMethod · 0.80
register_fallbackMethod · 0.80

Tested by

no test coverage detected