os_flash.cpp 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. #include "os_flash.h"
  2. #include "main/main.h"
  3. #include "rasterizer_flash.h"
  4. #include "drivers/gles1/rasterizer_gles1.h"
  5. #include "servers/visual/visual_server_raster.h"
  6. #include "dir_access_flash.h"
  7. //#include "AS3.h"
  8. int OSFlash::get_video_driver_count() const {
  9. return 1;
  10. };
  11. const char * OSFlash::get_video_driver_name(int p_driver) const {
  12. return "Flash";
  13. };
  14. OS::VideoMode OSFlash::get_default_video_mode() const {
  15. return OS::VideoMode();
  16. };
  17. int OSFlash::get_audio_driver_count() const {
  18. return 1;
  19. };
  20. const char * OSFlash::get_audio_driver_name(int p_driver) const {
  21. return "Flash";
  22. };
  23. void OSFlash::initialize_core() {
  24. OS_Unix::initialize_core();
  25. //DirAccessFlash::make_default();
  26. };
  27. void OSFlash::initialize(const OS::VideoMode& p_desired,int p_video_driver,int p_audio_driver) {
  28. input = memnew( InputDefault );
  29. rasterizer = memnew( RasterizerGLES1(false) );
  30. //rasterizer = memnew( RasterizerFlash(false) );
  31. visual_server = memnew( VisualServerRaster(rasterizer) );
  32. visual_server->init();
  33. visual_server->cursor_set_visible(false, 0);
  34. audio_driver = memnew(AudioDriverDummy);
  35. audio_driver->set_singleton();
  36. audio_driver->init();
  37. sample_manager = memnew( SampleManagerMallocSW );
  38. audio_server = memnew( AudioServerSW(sample_manager) );
  39. audio_server->set_mixer_params(AudioMixerSW::INTERPOLATION_LINEAR,false);
  40. audio_server->init();
  41. spatial_sound_server = memnew( SpatialSoundServerSW );
  42. spatial_sound_server->init();
  43. spatial_sound_2d_server = memnew( SpatialSound2DServerSW );
  44. spatial_sound_2d_server->init();
  45. physics_server = memnew( PhysicsServerSW );
  46. physics_server->init();
  47. physics_2d_server = memnew( Physics2DServerSW );
  48. physics_2d_server->init();
  49. };
  50. void OSFlash::set_main_loop( MainLoop * p_main_loop ) {
  51. input->set_main_loop(p_main_loop);
  52. main_loop=p_main_loop;
  53. };
  54. void OSFlash::delete_main_loop() {
  55. memdelete( main_loop );
  56. main_loop = NULL;
  57. };
  58. void OSFlash::finalize() {
  59. memdelete(input);
  60. };
  61. void OSFlash::set_mouse_show(bool p_show) {
  62. };
  63. void OSFlash::set_mouse_grab(bool p_grab) {
  64. };
  65. bool OSFlash::is_mouse_grab_enabled() const {
  66. return false;
  67. };
  68. Point2 OSFlash::get_mouse_pos() const {
  69. return Point2();
  70. };
  71. int OSFlash::get_mouse_button_state() const {
  72. return 0;
  73. };
  74. void OSFlash::set_window_title(const String& p_title) {
  75. };
  76. bool OSFlash::has_virtual_keyboard() const {
  77. return false;
  78. };
  79. void OSFlash::show_virtual_keyboard(const String& p_existing_text,const Rect2& p_screen_rect) {
  80. };
  81. void OSFlash::hide_virtual_keyboard() {
  82. };
  83. void OSFlash::set_video_mode(const OS::VideoMode& p_video_mode,int p_screen) {
  84. default_videomode = p_video_mode;
  85. };
  86. OS::VideoMode OSFlash::get_video_mode(int p_screen) const {
  87. return default_videomode;
  88. };
  89. void OSFlash::get_fullscreen_mode_list(List<OS::VideoMode> *p_list,int p_screen) const {
  90. p_list->push_back(default_videomode);
  91. };
  92. String OSFlash::get_name() {
  93. return "Flash";
  94. };
  95. MainLoop *OSFlash::get_main_loop() const {
  96. return main_loop;
  97. };
  98. bool OSFlash::can_draw() const {
  99. return true;
  100. }
  101. void OSFlash::set_cursor_shape(CursorShape p_shape) {
  102. };
  103. bool OSFlash::has_touchscreen_ui_hint() const {
  104. return false;
  105. };
  106. Error OSFlash::shell_open(String p_uri) {
  107. return ERR_UNAVAILABLE;
  108. };
  109. void OSFlash::yield() {
  110. //flyield();
  111. //inline_as3(
  112. // "flyield();\n"
  113. //);
  114. };
  115. bool OSFlash::iterate() {
  116. if (!main_loop)
  117. return true;
  118. return Main::iteration();
  119. };