static int resize(bps_event_t *event) { //Query width and height of the window surface created by utility code EGLint surface_width, surface_height; if (event) { int angle = navigator_event_get_orientation_angle(event); //Let bbutil rotate current screen surface to this angle if (EXIT_FAILURE == bbutil_rotate_screen_surface(angle)) { fprintf(stderr, "Unable to handle orientation change\n"); return EXIT_FAILURE; } } eglQuerySurface(egl_disp, egl_surf, EGL_WIDTH, &surface_width); eglQuerySurface(egl_disp, egl_surf, EGL_HEIGHT, &surface_height); EGLint err = eglGetError(); if (err != 0x3000) { fprintf(stderr, "Unable to query EGL surface dimensions\n"); return EXIT_FAILURE; } width = (float) surface_width; height = (float) surface_height; if (event) { render(); navigator_done_orientation(event); } return EXIT_SUCCESS; }
int resize(bps_event_t *event) { //Query width and height of the window surface created by utility code EGLint surface_width, surface_height; if (event) { int angle = navigator_event_get_orientation_angle(event); //Let bbutil rotate current screen surface to this angle if (EXIT_FAILURE == bbutil_rotate_screen_surface(angle)) { fprintf(stderr, "Unable to handle orientation change\n"); return EXIT_FAILURE; } navigator_set_orientation(angle, NULL); navigator_done_orientation(event); } eglQuerySurface(egl_disp, egl_surf, EGL_WIDTH, &surface_width); eglQuerySurface(egl_disp, egl_surf, EGL_HEIGHT, &surface_height); EGLint err = eglGetError(); if (err != 0x3000) { fprintf(stderr, "Unable to query egl surface dimensions\n"); return EXIT_FAILURE; } width = (float) surface_width; height = (float) surface_height; if (width > height) { shadow_pos_x = 365.0f; shadow_pos_y = 0.0f; cube_pos_x = 2.9f; cube_pos_y = 0.3f; cube_pos_z = -20.0f; } else { shadow_pos_x = 70.0f; shadow_pos_y = 10.0f; cube_pos_x = 0.5f; cube_pos_y = -4.1f; cube_pos_z = -30.0f; } shadow_vertices[0] = shadow_pos_x; shadow_vertices[1] = shadow_pos_y; shadow_vertices[2] = shadow_pos_x + shadow_size_x; shadow_vertices[3] = shadow_pos_y; shadow_vertices[4] = shadow_pos_x; shadow_vertices[5] = shadow_pos_y + shadow_size_y; shadow_vertices[6] = shadow_pos_x + shadow_size_x; shadow_vertices[7] = shadow_pos_y + shadow_size_y; update(); return EXIT_SUCCESS; }
int resize(bps_event_t *event) { //Query width and height of the window surface created by utility code EGLint surface_width, surface_height; if (event) { int angle = navigator_event_get_orientation_angle(event); //Let bbutil rotate current screen surface to this angle if (EXIT_FAILURE == bbutil_rotate_screen_surface(angle)) { fprintf(stderr, "Unable to handle orientation change\n"); return EXIT_FAILURE; } } eglQuerySurface(egl_disp, egl_surf, EGL_WIDTH, &surface_width); eglQuerySurface(egl_disp, egl_surf, EGL_HEIGHT, &surface_height); EGLint err = eglGetError(); if (err != 0x3000) { fprintf(stderr, "Unable to query EGL surface dimensions\n"); return EXIT_FAILURE; } width = (float) surface_width; height = (float) surface_height; if (width > height) { cube_pos_x = 2.9f; cube_pos_y = 0.3f; cube_pos_z = -20.0f; background = background_landscape; background_vertices = background_landscape_vertices; background_tex_coord = background_landscape_tex_coord; } else { cube_pos_x = 0.5f; cube_pos_y = -4.1f; cube_pos_z = -30.0f; background = background_portrait; background_vertices = background_portrait_vertices; background_tex_coord = background_portrait_tex_coord; } update(); if (event) { render(); navigator_done_orientation(event); } return EXIT_SUCCESS; }
int resize(bps_event_t *event) { int angle = navigator_event_get_orientation_angle(event); fprintf(stderr,"angle: %i\n",angle); //Let bbutil rotate current screen surface to this angle if (EXIT_FAILURE == bbutil_rotate_screen_surface(angle)) { fprintf(stderr, "Unable to handle orientation change\n"); return EXIT_FAILURE; } //Query width and height of the window surface created by utility code EGLint surface_width, surface_height; eglQuerySurface(egl_disp, egl_surf, EGL_WIDTH, &surface_width); eglQuerySurface(egl_disp, egl_surf, EGL_HEIGHT, &surface_height); EGLint err = eglGetError(); if (err != 0x3000) { fprintf(stderr, "Unable to query EGL surface dimensions\n"); return EXIT_FAILURE; } // width and height from Render.h width = (float) surface_width; height = (float) surface_height; fprintf(stderr, "angle %i\n",angle); switch (angle) { case 0: oriention_side_up = 0; break; case 90: oriention_side_up = 1; break; case 270: oriention_side_up = 2; break; case 180: oriention_side_up = -1; break; default: oriention_side_up = 0; break; } render(); navigator_done_orientation(event); return EXIT_SUCCESS; }
void OSBB10::_resize(bps_event_t* event) { int angle = navigator_event_get_orientation_angle(event); bbutil_rotate_screen_surface(angle); EGLint surface_width, surface_height; eglQuerySurface(egl_disp, egl_surf, EGL_WIDTH, &surface_width); eglQuerySurface(egl_disp, egl_surf, EGL_HEIGHT, &surface_height); VideoMode mode; mode.width = surface_width; mode.height = surface_height; mode.fullscreen = true; mode.resizable = false; set_video_mode(mode); };