os_android.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752
  1. /*************************************************************************/
  2. /* os_android.cpp */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /*************************************************************************/
  30. #include "os_android.h"
  31. #include "core/io/file_access_buffered_fa.h"
  32. #include "core/project_settings.h"
  33. #include "drivers/gles2/rasterizer_gles2.h"
  34. #include "drivers/gles3/rasterizer_gles3.h"
  35. #include "drivers/unix/dir_access_unix.h"
  36. #include "drivers/unix/file_access_unix.h"
  37. #include "file_access_android.h"
  38. #include "main/main.h"
  39. #include "servers/visual/visual_server_raster.h"
  40. #include "servers/visual/visual_server_wrap_mt.h"
  41. #include "dir_access_jandroid.h"
  42. #include "file_access_jandroid.h"
  43. #include <dlfcn.h>
  44. #include "java_godot_io_wrapper.h"
  45. #include "java_godot_wrapper.h"
  46. class AndroidLogger : public Logger {
  47. public:
  48. virtual void logv(const char *p_format, va_list p_list, bool p_err) {
  49. __android_log_vprint(p_err ? ANDROID_LOG_ERROR : ANDROID_LOG_INFO, "godot", p_format, p_list);
  50. }
  51. virtual ~AndroidLogger() {}
  52. };
  53. int OS_Android::get_video_driver_count() const {
  54. return 2;
  55. }
  56. const char *OS_Android::get_video_driver_name(int p_driver) const {
  57. switch (p_driver) {
  58. case VIDEO_DRIVER_GLES3:
  59. return "GLES3";
  60. case VIDEO_DRIVER_GLES2:
  61. return "GLES2";
  62. }
  63. ERR_FAIL_V_MSG(NULL, "Invalid video driver index: " + itos(p_driver) + ".");
  64. }
  65. int OS_Android::get_audio_driver_count() const {
  66. return 1;
  67. }
  68. const char *OS_Android::get_audio_driver_name(int p_driver) const {
  69. return "Android";
  70. }
  71. void OS_Android::initialize_core() {
  72. OS_Unix::initialize_core();
  73. if (use_apk_expansion)
  74. FileAccess::make_default<FileAccessUnix>(FileAccess::ACCESS_RESOURCES);
  75. else {
  76. #ifdef USE_JAVA_FILE_ACCESS
  77. FileAccess::make_default<FileAccessBufferedFA<FileAccessJAndroid> >(FileAccess::ACCESS_RESOURCES);
  78. #else
  79. //FileAccess::make_default<FileAccessBufferedFA<FileAccessAndroid> >(FileAccess::ACCESS_RESOURCES);
  80. FileAccess::make_default<FileAccessAndroid>(FileAccess::ACCESS_RESOURCES);
  81. #endif
  82. }
  83. FileAccess::make_default<FileAccessUnix>(FileAccess::ACCESS_USERDATA);
  84. FileAccess::make_default<FileAccessUnix>(FileAccess::ACCESS_FILESYSTEM);
  85. //FileAccessBufferedFA<FileAccessUnix>::make_default();
  86. if (use_apk_expansion)
  87. DirAccess::make_default<DirAccessUnix>(DirAccess::ACCESS_RESOURCES);
  88. else
  89. DirAccess::make_default<DirAccessJAndroid>(DirAccess::ACCESS_RESOURCES);
  90. DirAccess::make_default<DirAccessUnix>(DirAccess::ACCESS_USERDATA);
  91. DirAccess::make_default<DirAccessUnix>(DirAccess::ACCESS_FILESYSTEM);
  92. }
  93. void OS_Android::set_opengl_extensions(const char *p_gl_extensions) {
  94. ERR_FAIL_COND(!p_gl_extensions);
  95. gl_extensions = p_gl_extensions;
  96. }
  97. int OS_Android::get_current_video_driver() const {
  98. return video_driver_index;
  99. }
  100. Error OS_Android::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
  101. bool use_gl3 = godot_java->get_gles_version_code() >= 0x00030000;
  102. use_gl3 = use_gl3 && (GLOBAL_GET("rendering/quality/driver/driver_name") == "GLES3");
  103. bool gl_initialization_error = false;
  104. while (true) {
  105. if (use_gl3) {
  106. if (RasterizerGLES3::is_viable() == OK) {
  107. godot_java->gfx_init(false);
  108. RasterizerGLES3::register_config();
  109. RasterizerGLES3::make_current();
  110. break;
  111. } else {
  112. if (GLOBAL_GET("rendering/quality/driver/fallback_to_gles2")) {
  113. p_video_driver = VIDEO_DRIVER_GLES2;
  114. use_gl3 = false;
  115. continue;
  116. } else {
  117. gl_initialization_error = true;
  118. break;
  119. }
  120. }
  121. } else {
  122. if (RasterizerGLES2::is_viable() == OK) {
  123. godot_java->gfx_init(true);
  124. RasterizerGLES2::register_config();
  125. RasterizerGLES2::make_current();
  126. break;
  127. } else {
  128. gl_initialization_error = true;
  129. break;
  130. }
  131. }
  132. }
  133. if (gl_initialization_error) {
  134. OS::get_singleton()->alert("Your device does not support any of the supported OpenGL versions.\n"
  135. "Please try updating your Android version.",
  136. "Unable to initialize Video driver");
  137. return ERR_UNAVAILABLE;
  138. }
  139. video_driver_index = p_video_driver;
  140. visual_server = memnew(VisualServerRaster);
  141. if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
  142. visual_server = memnew(VisualServerWrapMT(visual_server, false));
  143. }
  144. visual_server->init();
  145. AudioDriverManager::initialize(p_audio_driver);
  146. input = memnew(InputDefault);
  147. input->set_fallback_mapping("Default Android Gamepad");
  148. ///@TODO implement a subclass for Android and instantiate that instead
  149. camera_server = memnew(CameraServer);
  150. //power_manager = memnew(PowerAndroid);
  151. return OK;
  152. }
  153. void OS_Android::set_main_loop(MainLoop *p_main_loop) {
  154. main_loop = p_main_loop;
  155. input->set_main_loop(p_main_loop);
  156. }
  157. void OS_Android::delete_main_loop() {
  158. memdelete(main_loop);
  159. }
  160. void OS_Android::finalize() {
  161. memdelete(camera_server);
  162. memdelete(input);
  163. }
  164. GodotJavaWrapper *OS_Android::get_godot_java() {
  165. return godot_java;
  166. }
  167. GodotIOJavaWrapper *OS_Android::get_godot_io_java() {
  168. return godot_io_java;
  169. }
  170. void OS_Android::alert(const String &p_alert, const String &p_title) {
  171. //print("ALERT: %s\n", p_alert.utf8().get_data());
  172. godot_java->alert(p_alert, p_title);
  173. }
  174. bool OS_Android::request_permission(const String &p_name) {
  175. return godot_java->request_permission(p_name);
  176. }
  177. Error OS_Android::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) {
  178. p_library_handle = dlopen(p_path.utf8().get_data(), RTLD_NOW);
  179. ERR_FAIL_COND_V_MSG(!p_library_handle, ERR_CANT_OPEN, "Can't open dynamic library: " + p_path + ", error: " + dlerror() + ".");
  180. return OK;
  181. }
  182. void OS_Android::set_mouse_show(bool p_show) {
  183. //android has no mouse...
  184. }
  185. void OS_Android::set_mouse_grab(bool p_grab) {
  186. //it really has no mouse...!
  187. }
  188. bool OS_Android::is_mouse_grab_enabled() const {
  189. //*sigh* technology has evolved so much since i was a kid..
  190. return false;
  191. }
  192. Point2 OS_Android::get_mouse_position() const {
  193. return Point2();
  194. }
  195. int OS_Android::get_mouse_button_state() const {
  196. return 0;
  197. }
  198. void OS_Android::set_window_title(const String &p_title) {
  199. //This queries/updates the currently connected devices/joypads
  200. //Set_window_title is called when initializing the main loop (main.cpp)
  201. //therefore this place is found to be suitable (I found no better).
  202. godot_java->init_input_devices();
  203. }
  204. void OS_Android::set_video_mode(const VideoMode &p_video_mode, int p_screen) {
  205. }
  206. OS::VideoMode OS_Android::get_video_mode(int p_screen) const {
  207. return default_videomode;
  208. }
  209. void OS_Android::get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen) const {
  210. p_list->push_back(default_videomode);
  211. }
  212. void OS_Android::set_keep_screen_on(bool p_enabled) {
  213. OS::set_keep_screen_on(p_enabled);
  214. godot_java->set_keep_screen_on(p_enabled);
  215. }
  216. Size2 OS_Android::get_window_size() const {
  217. return Vector2(default_videomode.width, default_videomode.height);
  218. }
  219. String OS_Android::get_name() const {
  220. return "Android";
  221. }
  222. MainLoop *OS_Android::get_main_loop() const {
  223. return main_loop;
  224. }
  225. bool OS_Android::can_draw() const {
  226. return true; //always?
  227. }
  228. void OS_Android::main_loop_begin() {
  229. if (main_loop)
  230. main_loop->init();
  231. }
  232. bool OS_Android::main_loop_iterate() {
  233. if (!main_loop)
  234. return false;
  235. return Main::iteration();
  236. }
  237. void OS_Android::main_loop_end() {
  238. if (main_loop)
  239. main_loop->finish();
  240. }
  241. void OS_Android::main_loop_focusout() {
  242. if (main_loop)
  243. main_loop->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT);
  244. audio_driver_android.set_pause(true);
  245. }
  246. void OS_Android::main_loop_focusin() {
  247. if (main_loop)
  248. main_loop->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN);
  249. audio_driver_android.set_pause(false);
  250. }
  251. void OS_Android::process_joy_event(OS_Android::JoypadEvent p_event) {
  252. switch (p_event.type) {
  253. case JOY_EVENT_BUTTON:
  254. input->joy_button(p_event.device, p_event.index, p_event.pressed);
  255. break;
  256. case JOY_EVENT_AXIS:
  257. InputDefault::JoyAxis value;
  258. value.min = -1;
  259. value.value = p_event.value;
  260. input->joy_axis(p_event.device, p_event.index, value);
  261. break;
  262. case JOY_EVENT_HAT:
  263. input->joy_hat(p_event.device, p_event.hat);
  264. break;
  265. default:
  266. return;
  267. }
  268. }
  269. void OS_Android::process_event(Ref<InputEvent> p_event) {
  270. input->parse_input_event(p_event);
  271. }
  272. void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos> &p_points) {
  273. switch (p_what) {
  274. case 0: { //gesture begin
  275. if (touch.size()) {
  276. //end all if exist
  277. for (int i = 0; i < touch.size(); i++) {
  278. Ref<InputEventScreenTouch> ev;
  279. ev.instance();
  280. ev->set_index(touch[i].id);
  281. ev->set_pressed(false);
  282. ev->set_position(touch[i].pos);
  283. input->parse_input_event(ev);
  284. }
  285. }
  286. touch.resize(p_points.size());
  287. for (int i = 0; i < p_points.size(); i++) {
  288. touch.write[i].id = p_points[i].id;
  289. touch.write[i].pos = p_points[i].pos;
  290. }
  291. //send touch
  292. for (int i = 0; i < touch.size(); i++) {
  293. Ref<InputEventScreenTouch> ev;
  294. ev.instance();
  295. ev->set_index(touch[i].id);
  296. ev->set_pressed(true);
  297. ev->set_position(touch[i].pos);
  298. input->parse_input_event(ev);
  299. }
  300. } break;
  301. case 1: { //motion
  302. ERR_FAIL_COND(touch.size() != p_points.size());
  303. for (int i = 0; i < touch.size(); i++) {
  304. int idx = -1;
  305. for (int j = 0; j < p_points.size(); j++) {
  306. if (touch[i].id == p_points[j].id) {
  307. idx = j;
  308. break;
  309. }
  310. }
  311. ERR_CONTINUE(idx == -1);
  312. if (touch[i].pos == p_points[idx].pos)
  313. continue; //no move unncesearily
  314. Ref<InputEventScreenDrag> ev;
  315. ev.instance();
  316. ev->set_index(touch[i].id);
  317. ev->set_position(p_points[idx].pos);
  318. ev->set_relative(p_points[idx].pos - touch[i].pos);
  319. input->parse_input_event(ev);
  320. touch.write[i].pos = p_points[idx].pos;
  321. }
  322. } break;
  323. case 2: { //release
  324. if (touch.size()) {
  325. //end all if exist
  326. for (int i = 0; i < touch.size(); i++) {
  327. Ref<InputEventScreenTouch> ev;
  328. ev.instance();
  329. ev->set_index(touch[i].id);
  330. ev->set_pressed(false);
  331. ev->set_position(touch[i].pos);
  332. input->parse_input_event(ev);
  333. }
  334. touch.clear();
  335. }
  336. } break;
  337. case 3: { // add touch
  338. for (int i = 0; i < p_points.size(); i++) {
  339. if (p_points[i].id == p_pointer) {
  340. TouchPos tp = p_points[i];
  341. touch.push_back(tp);
  342. Ref<InputEventScreenTouch> ev;
  343. ev.instance();
  344. ev->set_index(tp.id);
  345. ev->set_pressed(true);
  346. ev->set_position(tp.pos);
  347. input->parse_input_event(ev);
  348. break;
  349. }
  350. }
  351. } break;
  352. case 4: { // remove touch
  353. for (int i = 0; i < touch.size(); i++) {
  354. if (touch[i].id == p_pointer) {
  355. Ref<InputEventScreenTouch> ev;
  356. ev.instance();
  357. ev->set_index(touch[i].id);
  358. ev->set_pressed(false);
  359. ev->set_position(touch[i].pos);
  360. input->parse_input_event(ev);
  361. touch.remove(i);
  362. break;
  363. }
  364. }
  365. } break;
  366. }
  367. }
  368. void OS_Android::process_accelerometer(const Vector3 &p_accelerometer) {
  369. input->set_accelerometer(p_accelerometer);
  370. }
  371. void OS_Android::process_gravity(const Vector3 &p_gravity) {
  372. input->set_gravity(p_gravity);
  373. }
  374. void OS_Android::process_magnetometer(const Vector3 &p_magnetometer) {
  375. input->set_magnetometer(p_magnetometer);
  376. }
  377. void OS_Android::process_gyroscope(const Vector3 &p_gyroscope) {
  378. input->set_gyroscope(p_gyroscope);
  379. }
  380. bool OS_Android::has_touchscreen_ui_hint() const {
  381. return true;
  382. }
  383. bool OS_Android::has_virtual_keyboard() const {
  384. return true;
  385. }
  386. int OS_Android::get_virtual_keyboard_height() const {
  387. return godot_io_java->get_vk_height();
  388. // ERR_PRINT("Cannot obtain virtual keyboard height.");
  389. // return 0;
  390. }
  391. void OS_Android::show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_screen_rect) {
  392. if (godot_io_java->has_vk()) {
  393. godot_io_java->show_vk(p_existing_text);
  394. } else {
  395. ERR_PRINT("Virtual keyboard not available");
  396. };
  397. }
  398. void OS_Android::hide_virtual_keyboard() {
  399. if (godot_io_java->has_vk()) {
  400. godot_io_java->hide_vk();
  401. } else {
  402. ERR_PRINT("Virtual keyboard not available");
  403. };
  404. }
  405. void OS_Android::init_video_mode(int p_video_width, int p_video_height) {
  406. default_videomode.width = p_video_width;
  407. default_videomode.height = p_video_height;
  408. default_videomode.fullscreen = true;
  409. default_videomode.resizable = false;
  410. }
  411. void OS_Android::main_loop_request_go_back() {
  412. if (main_loop)
  413. main_loop->notification(MainLoop::NOTIFICATION_WM_GO_BACK_REQUEST);
  414. }
  415. void OS_Android::set_display_size(Size2 p_size) {
  416. default_videomode.width = p_size.x;
  417. default_videomode.height = p_size.y;
  418. }
  419. Error OS_Android::shell_open(String p_uri) {
  420. return godot_io_java->open_uri(p_uri);
  421. }
  422. String OS_Android::get_resource_dir() const {
  423. return "/"; //android has its own filesystem for resources inside the APK
  424. }
  425. String OS_Android::get_locale() const {
  426. String locale = godot_io_java->get_locale();
  427. if (locale != "") {
  428. return locale;
  429. }
  430. return OS_Unix::get_locale();
  431. }
  432. void OS_Android::set_clipboard(const String &p_text) {
  433. // DO we really need the fallback to OS_Unix here?!
  434. if (godot_java->has_set_clipboard()) {
  435. godot_java->set_clipboard(p_text);
  436. } else {
  437. OS_Unix::set_clipboard(p_text);
  438. }
  439. }
  440. String OS_Android::get_clipboard() const {
  441. // DO we really need the fallback to OS_Unix here?!
  442. if (godot_java->has_get_clipboard()) {
  443. return godot_java->get_clipboard();
  444. }
  445. return OS_Unix::get_clipboard();
  446. }
  447. String OS_Android::get_model_name() const {
  448. String model = godot_io_java->get_model();
  449. if (model != "")
  450. return model;
  451. return OS_Unix::get_model_name();
  452. }
  453. int OS_Android::get_screen_dpi(int p_screen) const {
  454. return godot_io_java->get_screen_dpi();
  455. }
  456. String OS_Android::get_user_data_dir() const {
  457. if (data_dir_cache != String())
  458. return data_dir_cache;
  459. String data_dir = godot_io_java->get_user_data_dir();
  460. if (data_dir != "") {
  461. //store current dir
  462. char real_current_dir_name[2048];
  463. getcwd(real_current_dir_name, 2048);
  464. //go to data dir
  465. chdir(data_dir.utf8().get_data());
  466. //get actual data dir, so we resolve potential symlink (Android 6.0+ seems to use symlink)
  467. char data_current_dir_name[2048];
  468. getcwd(data_current_dir_name, 2048);
  469. //cache by parsing utf8
  470. data_dir_cache.parse_utf8(data_current_dir_name);
  471. //restore original dir so we don't mess things up
  472. chdir(real_current_dir_name);
  473. return data_dir_cache;
  474. }
  475. return ".";
  476. }
  477. void OS_Android::set_screen_orientation(ScreenOrientation p_orientation) {
  478. godot_io_java->set_screen_orientation(p_orientation);
  479. }
  480. String OS_Android::get_unique_id() const {
  481. String unique_id = godot_io_java->get_unique_id();
  482. if (unique_id != "")
  483. return unique_id;
  484. return OS::get_unique_id();
  485. }
  486. Error OS_Android::native_video_play(String p_path, float p_volume, String p_audio_track, String p_subtitle_track) {
  487. // FIXME: Add support for volume, audio and subtitle tracks
  488. godot_io_java->play_video(p_path);
  489. return OK;
  490. }
  491. bool OS_Android::native_video_is_playing() const {
  492. return godot_io_java->is_video_playing();
  493. }
  494. void OS_Android::native_video_pause() {
  495. godot_io_java->pause_video();
  496. }
  497. String OS_Android::get_system_dir(SystemDir p_dir) const {
  498. return godot_io_java->get_system_dir(p_dir);
  499. }
  500. void OS_Android::native_video_stop() {
  501. godot_io_java->stop_video();
  502. }
  503. void OS_Android::set_context_is_16_bits(bool p_is_16) {
  504. //use_16bits_fbo = p_is_16;
  505. //if (rasterizer)
  506. // rasterizer->set_force_16_bits_fbo(p_is_16);
  507. }
  508. void OS_Android::joy_connection_changed(int p_device, bool p_connected, String p_name) {
  509. return input->joy_connection_changed(p_device, p_connected, p_name, "");
  510. }
  511. bool OS_Android::is_joy_known(int p_device) {
  512. return input->is_joy_mapped(p_device);
  513. }
  514. String OS_Android::get_joy_guid(int p_device) const {
  515. return input->get_joy_guid_remapped(p_device);
  516. }
  517. void OS_Android::vibrate_handheld(int p_duration_ms) {
  518. godot_java->vibrate(p_duration_ms);
  519. }
  520. bool OS_Android::_check_internal_feature_support(const String &p_feature) {
  521. if (p_feature == "mobile") {
  522. //TODO support etc2 only if GLES3 driver is selected
  523. return true;
  524. }
  525. #if defined(__aarch64__)
  526. if (p_feature == "arm64-v8a") {
  527. return true;
  528. }
  529. #elif defined(__ARM_ARCH_7A__)
  530. if (p_feature == "armeabi-v7a" || p_feature == "armeabi") {
  531. return true;
  532. }
  533. #elif defined(__arm__)
  534. if (p_feature == "armeabi") {
  535. return true;
  536. }
  537. #endif
  538. return false;
  539. }
  540. OS_Android::OS_Android(GodotJavaWrapper *p_godot_java, GodotIOJavaWrapper *p_godot_io_java, bool p_use_apk_expansion) {
  541. use_apk_expansion = p_use_apk_expansion;
  542. default_videomode.width = 800;
  543. default_videomode.height = 600;
  544. default_videomode.fullscreen = true;
  545. default_videomode.resizable = false;
  546. main_loop = NULL;
  547. gl_extensions = NULL;
  548. //rasterizer = NULL;
  549. use_gl2 = false;
  550. godot_java = p_godot_java;
  551. godot_io_java = p_godot_io_java;
  552. Vector<Logger *> loggers;
  553. loggers.push_back(memnew(AndroidLogger));
  554. _set_logger(memnew(CompositeLogger(loggers)));
  555. AudioDriverManager::add_driver(&audio_driver_android);
  556. }
  557. OS_Android::~OS_Android() {
  558. }