static void qemulator_setup( QEmulator* emulator ) { AndroidOptions* opts = emulator->opts; if ( !emulator->window && !opts->no_window ) { SkinLayout* layout = emulator->layout; double scale = get_default_scale(emulator->opts); static const SkinWindowFuncs skin_window_funcs = { .key_event = &qemulator_window_key_event, .mouse_event = &qemulator_window_mouse_event, .generic_event = &qemulator_window_generic_event, .opengles_show = &android_showOpenglesWindow, .opengles_hide = &android_hideOpenglesWindow, .opengles_redraw = &android_redrawOpenglesWindow, }; emulator->window = skin_window_create(layout, emulator->win_x, emulator->win_y, scale, 0, &skin_window_funcs); if (emulator->window == NULL) return; { SkinTrackBall* ball; SkinTrackBallParameters params; params.diameter = 30; params.ring = 2; params.ball_color = 0xffe0e0e0; params.dot_color = 0xff202020; params.ring_color = 0xff000000; params.event_func = &qemulator_trackball_event; ball = skin_trackball_create( ¶ms ); emulator->trackball = ball; skin_window_set_trackball( emulator->window, ball ); emulator->lcd_brightness = 128; /* 50% */ skin_window_set_lcd_brightness( emulator->window, emulator->lcd_brightness ); } if ( emulator->onion != NULL ) skin_window_set_onion( emulator->window, emulator->onion, emulator->onion_rotation, emulator->onion_alpha ); qemulator_set_title(emulator); skin_window_enable_touch ( emulator->window, !androidHwConfig_isScreenNoTouch(android_hw)); skin_window_enable_dpad ( emulator->window, android_hw->hw_dPad != 0 ); skin_window_enable_qwerty( emulator->window, android_hw->hw_keyboard != 0 ); skin_window_enable_trackball( emulator->window, android_hw->hw_trackBall != 0 ); }
static void qemulator_setup( QEmulator* emulator ) { AndroidOptions* opts = emulator->opts; if ( !emulator->window && !opts->no_window ) { SkinLayout* layout = emulator->layout; double scale = get_default_scale(emulator->opts); emulator->window = skin_window_create( layout, emulator->win_x, emulator->win_y, scale, 0); if (emulator->window == NULL) return; { SkinTrackBall* ball; SkinTrackBallParameters params; params.diameter = 30; params.ring = 2; params.ball_color = 0xffe0e0e0; params.dot_color = 0xff202020; params.ring_color = 0xff000000; ball = skin_trackball_create( ¶ms ); emulator->trackball = ball; skin_window_set_trackball( emulator->window, ball ); emulator->lcd_brightness = 128; skin_window_set_lcd_brightness( emulator->window, emulator->lcd_brightness ); } if ( emulator->onion != NULL ) skin_window_set_onion( emulator->window, emulator->onion, emulator->onion_rotation, emulator->onion_alpha ); qemulator_set_title(emulator); skin_window_enable_touch ( emulator->window, !androidHwConfig_isScreenNoTouch(android_hw)); skin_window_enable_dpad ( emulator->window, android_hw->hw_dPad != 0 ); skin_window_enable_qwerty( emulator->window, android_hw->hw_keyboard != 0 ); skin_window_enable_trackball( emulator->window, android_hw->hw_trackBall != 0 ); } uicmd_set_brightness_change_callback(qemulator_light_brightness, emulator); }
static void emulator_window_setup( EmulatorWindow* emulator ) { static const SkinWindowFuncs my_window_funcs = { .key_event = &emulator_window_window_key_event, .mouse_event = &emulator_window_window_mouse_event, .generic_event = &emulator_window_window_generic_event, .opengles_show = &emulator_window_opengles_show_window, .opengles_hide = &emulator_window_opengles_hide_window, .opengles_redraw = &emulator_window_opengles_redraw_window, .opengles_free = &android_stopOpenglesRenderer, }; static const SkinTrackBallParameters my_trackball_params = { .diameter = 30, .ring = 2, .ball_color = 0xffe0e0e0, .dot_color = 0xff202020, .ring_color = 0xff000000, .event_func = &emulator_window_trackball_event, }; if (emulator->opts->no_window || emulator->ui) { return; } SkinUIParams my_ui_params = { .enable_touch = !androidHwConfig_isScreenNoTouch(android_hw), .enable_dpad = android_hw->hw_dPad != 0, .enable_keyboard = android_hw->hw_keyboard != 0, .enable_trackball = android_hw->hw_trackBall != 0, .window_x = emulator->win_x, .window_y = emulator->win_y, .window_scale = get_default_scale(emulator->opts), .keyboard_charmap = emulator->opts->charmap, .keyboard_raw_keys = emulator->opts->raw_keys != 0, #if CONFIG_QT .win32_ignore_events = true, #else .win32_ignore_events = false, #endif }; write_window_name(my_ui_params.window_name, sizeof(my_ui_params.window_name), android_base_port, avdInfo_getName(android_avdInfo)); static const SkinUIFuncs my_ui_funcs = { .window_funcs = &my_window_funcs, .trackball_params = &my_trackball_params, .keyboard_event = &emulator_window_keyboard_event, //user_event_key, .keyboard_flush = &user_event_keycodes, .network_toggle = &emulator_window_network_toggle, .framebuffer_invalidate = &emulator_window_framebuffer_invalidate, }; // Determine whether to use an EmuGL sub-window or not. const char* env = getenv("ANDROID_GL_SOFTWARE_RENDERER"); s_use_emugl_subwindow = !env || !env[0] || env[0] == '0'; if (s_use_emugl_subwindow) { VERBOSE_PRINT(gles, "Using EmuGL sub-window for GPU display"); } else { VERBOSE_PRINT(gles, "Using glReadPixels() for GPU display"); } emulator->ui = skin_ui_create(emulator->layout_file, android_hw->hw_initialOrientation, &my_ui_funcs, &my_ui_params); if (!emulator->ui) { return; } if (emulator->onion) { skin_ui_set_onion(emulator->ui, emulator->onion, emulator->onion_rotation, emulator->onion_alpha); } // Determine whether to use an EmuGL sub-window or not. if (!s_use_emugl_subwindow) { gpu_frame_set_post_callback(looper_newCore(), emulator, _emulator_window_on_gpu_frame); } skin_ui_reset_title(emulator->ui); } static void emulator_window_fb_update( void* _emulator, int x, int y, int w, int h ) { EmulatorWindow* emulator = _emulator; if (emulator->opts->no_window) { return; } if (!emulator->ui) { emulator_window_setup(emulator); } skin_ui_update_display(emulator->ui, x, y, w, h); } static void emulator_window_fb_rotate( void* _emulator, int rotation ) { EmulatorWindow* emulator = _emulator; emulator_window_setup( emulator ); }