Пример #1
0
static void *libdbg_font_init_font(void *gl_data, const char *font_path, float font_size)
{
   unsigned width, height;

   video_driver_get_size(&width, &height);

   (void)font_path;
   (void)font_size;
   (void)width;
   (void)height;

   DbgFontConfig cfg;
#if defined(SN_TARGET_PSP2)
   cfg.fontSize     = SCE_DBGFONT_FONTSIZE_LARGE;
#elif defined(__CELLOS_LV2__)
   cfg.bufSize      = SCE_DBGFONT_BUFSIZE_LARGE;
   cfg.screenWidth  = width;
   cfg.screenHeight = height;
#endif

   DbgFontInit(&cfg);

   /* Doesn't need any state. */
   return (void*)-1;
}
Пример #2
0
void menu_display_set_viewport(void)
{
   unsigned width, height;
   video_driver_get_size(&width, &height);

   video_driver_set_viewport(width, height, true, false);
}
Пример #3
0
static void zrmenu_context_reset(void *data)
{
   char iconpath[PATH_MAX_LENGTH] = {0};
   zrmenu_handle_t *zr              = (zrmenu_handle_t*)data;
   settings_t *settings           = config_get_ptr();
   unsigned width, height = 0;

   video_driver_get_size(&width, &height);

   if (!zr || !settings)
      return;

   fill_pathname_join(iconpath, settings->assets_directory,
         "zahnrad", sizeof(iconpath));
   fill_pathname_slash(iconpath, sizeof(iconpath));

   zrmenu_layout(zr);
   zrmenu_init_device(zr);

   wimp_context_bg_destroy(zr);
   zrmenu_context_reset_textures(zr, iconpath);

   rarch_task_push_image_load(settings->menu.wallpaper, "cb_menu_wallpaper",
         menu_display_handle_wallpaper_upload, NULL);
}
Пример #4
0
static void glui_render_quad(gl_t *gl, int x, int y, int w, int h,
      float r, float g, float b, float a)
{
   unsigned width, height;
   struct gfx_coords coords;
   GRfloat color[16], tex_coord[8], vertex[8];
   menu_handle_t *menu = menu_driver_get_ptr();
   glui_handle_t *glui = (glui_handle_t*)menu->userdata;

   vertex[0] = 0;
   vertex[1] = 0;
   vertex[2] = 1;
   vertex[3] = 0;
   vertex[4] = 0;
   vertex[5] = 1;
   vertex[6] = 1;
   vertex[7] = 1;

   tex_coord[0] = 0;
   tex_coord[1] = 1;
   tex_coord[2] = 1;
   tex_coord[3] = 1;
   tex_coord[4] = 0;
   tex_coord[5] = 0;
   tex_coord[6] = 1;
   tex_coord[7] = 0;

   color[ 0]    = r;
   color[ 1]    = g;
   color[ 2]    = b;
   color[ 3]    = a;
   color[ 4]    = r;
   color[ 5]    = g;
   color[ 6]    = b;
   color[ 7]    = a;
   color[ 8]    = r;
   color[ 9]    = g;
   color[10]    = b;
   color[11]    = a;
   color[12]    = r;
   color[13]    = g;
   color[14]    = b;
   color[15]    = a;

   video_driver_get_size(&width, &height);

   glViewport(x, height - y - h, w, h);

   coords.vertices      = 4;
   coords.vertex        = vertex;
   coords.tex_coord     = tex_coord;
   coords.lut_tex_coord = tex_coord;

   coords.color = color;

   menu_video_draw_frame(gl->shader, &coords,
         &gl->mvp_no_rot, true, glui->textures.white);

   gl->coords.color = gl->white_color_ptr;
}
Пример #5
0
static void nk_menu_context_reset(void *data)
{
   char iconpath[PATH_MAX_LENGTH] = {0};
   nk_menu_handle_t *nk              = (nk_menu_handle_t*)data;
   settings_t *settings           = config_get_ptr();
   unsigned width, height = 0;

   video_driver_get_size(&width, &height);

   if (!nk || !settings)
      return;

   fill_pathname_join(iconpath, settings->directory.assets,
         "nuklear", sizeof(iconpath));
   fill_pathname_slash(iconpath, sizeof(iconpath));

   nk_menu_layout(nk);
   nk_menu_init_device(nk);

   wimp_context_bg_destroy(nk);
   nk_menu_context_reset_textures(nk, iconpath);

   task_push_image_load(settings->path.menu_wallpaper, "cb_menu_wallpaper",
         menu_display_handle_wallpaper_upload, NULL);
}
Пример #6
0
static bool gl1_gfx_alive(void *data)
{
   unsigned temp_width  = 0;
   unsigned temp_height = 0;
   bool quit            = false;
   bool resize          = false;
   bool ret             = false;
   bool is_shutdown     = rarch_ctl(RARCH_CTL_IS_SHUTDOWN, NULL);
   gl1_t *gl1           = (gl1_t*)data;

   /* Needed because some context drivers don't track their sizes */
   video_driver_get_size(&temp_width, &temp_height);

   gl1->ctx_driver->check_window(gl1->ctx_data,
            &quit, &resize, &temp_width, &temp_height, is_shutdown);

   if (resize)
      gl1->should_resize = true;

   ret = !quit;

   if (temp_width != 0 && temp_height != 0)
      video_driver_set_size(&temp_width, &temp_height);

   return ret;
}
Пример #7
0
static void glui_draw_scrollbar(gl_t *gl)
{
   unsigned width, height;
   float content_height, total_height, scrollbar_height, y;
   int scrollbar_width  = 4;
   glui_handle_t *glui  = NULL;
   menu_handle_t *menu  = menu_driver_get_ptr();
   menu_display_t *disp = menu_display_get_ptr();

   if (!menu)
      return;

   video_driver_get_size(&width, &height);

   glui                 = (glui_handle_t*)menu->userdata;
   content_height       = menu_entries_get_end() * glui->line_height;
   total_height         = height - disp->header_height * 2;
   scrollbar_height     = total_height / (content_height / total_height);
   y                    = total_height * menu->scroll_y / content_height;

   if (content_height < total_height)
      return;

   glui_render_quad(gl,
         width - scrollbar_width,
         disp->header_height + y,
         scrollbar_width,
         scrollbar_height,
         1, 1, 1, 1);
}
Пример #8
0
static bool xdk_renderchain_render(void *data, const void *frame,
      unsigned frame_width, unsigned frame_height,
      unsigned pitch, unsigned rotation)
{
   unsigned i;
   unsigned width, height;
   uint64_t *frame_count    = NULL;
   d3d_video_t      *d3d    = (d3d_video_t*)data;
   LPDIRECT3DDEVICE d3dr    = (LPDIRECT3DDEVICE)d3d->dev;
   settings_t *settings     = config_get_ptr();
   xdk_renderchain_t *chain = (xdk_renderchain_t*)d3d->renderchain_data;

   video_driver_ctl(RARCH_DISPLAY_CTL_GET_FRAME_COUNT, &frame_count);

   video_driver_get_size(&width, &height);

   renderchain_blit_to_texture(chain, frame, frame_width, frame_height, pitch);
   renderchain_set_vertices(d3d, 1, frame_width, frame_height, *frame_count);

   d3d_set_texture(d3dr, 0, chain->tex);
   d3d_set_viewports(chain->dev, &d3d->final_viewport);
   d3d_set_sampler_minfilter(d3dr, 0, settings->video.smooth ?
         D3DTEXF_LINEAR : D3DTEXF_POINT);
   d3d_set_sampler_magfilter(d3dr, 0, settings->video.smooth ?
         D3DTEXF_LINEAR : D3DTEXF_POINT);

   d3d_set_vertex_declaration(d3dr, chain->vertex_decl);
   for (i = 0; i < 4; i++)
      d3d_set_stream_source(d3dr, i, chain->vertex_buf, 0, sizeof(Vertex));

   d3d_draw_primitive(d3dr, D3DPT_TRIANGLESTRIP, 0, 2);
   renderchain_set_mvp(d3d, width, height, d3d->dev_rotation);

   return true;
}
Пример #9
0
static void glui_blit_line(float x, float y,
      const char *message, uint32_t color, enum text_alignment text_align)
{
   unsigned width, height;
   glui_handle_t *glui       = NULL;
   struct font_params params = {0};
   menu_handle_t *menu       = menu_driver_get_ptr();
   menu_display_t *disp      = menu_display_get_ptr();

   if (!menu)
      return;

   video_driver_get_size(&width, &height);

   glui = (glui_handle_t*)menu->userdata;

   params.x           = x / width;
   params.y           = 1.0f - (y + glui->line_height/2 + disp->font.size/3) 
                        / height;
   params.scale       = 1.0;
   params.color       = color;
   params.full_screen = true;
   params.text_align  = text_align;

   video_driver_set_osd_msg(message, &params, disp->font.buf);
}
Пример #10
0
static void *zrmenu_init(void **userdata)
{
   settings_t *settings = config_get_ptr();
   zrmenu_handle_t   *zr = NULL;
   menu_handle_t *menu = (menu_handle_t*)
      calloc(1, sizeof(*menu));
   unsigned width, height = 0;

   video_driver_get_size(&width, &height);

   if (!menu)
      goto error;

   if (!menu_display_ctl(MENU_DISPLAY_CTL_INIT_FIRST_DRIVER, NULL))
      goto error;

   zr = (zrmenu_handle_t*)calloc(1, sizeof(zrmenu_handle_t));

   if (!zr)
      goto error;

   *userdata = zr;

   fill_pathname_join(zr->assets_directory, settings->assets_directory,
         "zahnrad", sizeof(zr->assets_directory));
   zrmenu_init_device(zr);

   zr->window[ZRMENU_WND_WIZARD].open = true;

   return menu;
error:
   if (menu)
      free(menu);
   return NULL;
}
Пример #11
0
static void glui_layout(menu_handle_t *menu, glui_handle_t *glui)
{
   menu_display_t *disp = menu_display_get_ptr();
   float scale_factor;
   unsigned width, height;
   video_driver_get_size(&width, &height);

   /* Mobiles platforms may have very small display metrics coupled to a high
      resolution, so we should be dpi aware to ensure the entries hitboxes are big
      enough. On desktops, we just care about readability, with every widget size
      proportional to the display width. */
   scale_factor = menu_display_get_dpi();

   glui->line_height            = scale_factor / 3;
   glui->margin                 = scale_factor / 6;
   menu->display.header_height  = scale_factor / 3;
   menu->display.font.size      = scale_factor / 10;
   /* we assume the average glyph aspect ratio is close to 3:4 */
   glui->glyph_width            = menu->display.font.size * 3/4;

   glui_font(menu);

   if (disp && disp->font.buf) /* calculate a more realistic ticker_limit */
   {
      driver_t *driver   = driver_get_ptr();
      int m_width = driver->font_osd_driver->get_message_width(disp->font.buf, "a", 1, 1);

      if (m_width)
         glui->glyph_width = m_width;
   }
}
Пример #12
0
static void glui_navigation_set(bool scroll)
{
   menu_display_t *disp = menu_display_get_ptr();
   menu_handle_t *menu  = menu_driver_get_ptr();
   float scroll_pos = 0;

   if (!menu || !disp || !scroll)
      return;

   scroll_pos = glui_get_scroll();

   if (menu->userdata)
   {
      unsigned height = 0, num_lines = 0, end = 0;
      glui_handle_t *glui    = (glui_handle_t*)menu->userdata;
      menu_navigation_t *nav = menu_navigation_get_ptr();

      video_driver_get_size(NULL, &height);
      num_lines = height / glui->line_height;
      end       = menu_entries_get_end();

      if (nav->selection_ptr < num_lines / 2 || end <= num_lines)
         menu_entries_set_start(0);
      else if (nav->selection_ptr < (end - num_lines / 2))
         menu_entries_set_start(nav->selection_ptr - num_lines / 2);
      else
         menu_entries_set_start(end - num_lines);

      if (menu_entries_get_start() >= 5)
         menu_entries_set_start(menu_entries_get_start() - 5);
   }

   menu_animation_push(disp->animation, 10, scroll_pos,
         &menu->scroll_y, EASING_IN_OUT_QUAD, -1, NULL);
}
Пример #13
0
static void mui_render_messagebox(const char *message)
{
   unsigned i, width, height;
   uint32_t normal_color;
   int x, y, font_size;
   settings_t *settings     = config_get_ptr();
   struct string_list *list = (struct string_list*)
      string_split(message, "\n");

   if (!list)
      return;
   if (list->elems == 0)
      goto end;

   video_driver_get_size(&width, &height);

   menu_display_ctl(MENU_DISPLAY_CTL_FONT_SIZE, &font_size);

   x = width  / 2;
   y = height / 2 - list->size * font_size / 2;

   normal_color = FONT_COLOR_ARGB_TO_RGBA(settings->menu.entry_normal_color);

   for (i = 0; i < list->size; i++)
   {
      const char *msg = list->elems[i].data;
      if (msg)
         mui_blit_line(x, y + i * font_size,
               width, height,
               msg, normal_color, TEXT_ALIGN_CENTER);
   }

end:
   string_list_free(list);
}
Пример #14
0
static void *nk_menu_init(void **userdata)
{
   settings_t *settings = config_get_ptr();
   nk_menu_handle_t   *nk = NULL;
   menu_handle_t *menu = (menu_handle_t*)
      calloc(1, sizeof(*menu));
   unsigned width, height = 0;

   video_driver_get_size(&width, &height);

   if (!menu)
      goto error;

   if (!menu_display_init_first_driver())
      goto error;

   nk = (nk_menu_handle_t*)calloc(1, sizeof(nk_menu_handle_t));

   if (!nk)
      goto error;

   *userdata = nk;

   fill_pathname_join(nk->assets_directory, settings->directory.assets,
         "nuklear", sizeof(nk->assets_directory));
   nk_menu_init_device(nk);

   return menu;
error:
   if (menu)
      free(menu);
   return NULL;
}
Пример #15
0
static int mui_pointer_tap(void *userdata,
      unsigned x, unsigned y, 
      unsigned ptr, menu_file_list_cbs_t *cbs,
      menu_entry_t *entry, unsigned action)
{
   size_t selection, idx;
   unsigned header_height, width, height, i;
   bool scroll                = false;
   mui_handle_t *mui          = (mui_handle_t*)userdata;
   file_list_t *menu_stack    = menu_entries_get_menu_stack_ptr(0);
   file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);

   if (!mui)
      return 0;

   video_driver_get_size(&width, &height);

   menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection);
   menu_display_ctl(MENU_DISPLAY_CTL_HEADER_HEIGHT, &header_height);

   if (y < header_height)
   {
      menu_entries_pop_stack(&selection, 0);
      menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection);
   }
   else if (y > height - mui->tabs_height)
   {
      for (i = 0; i <= MUI_SYSTEM_TAB_END; i++)
      {
         unsigned tab_width = width / (MUI_SYSTEM_TAB_END + 1);
         unsigned start = tab_width * i;

         if ((x >= start) && (x < (start + tab_width)))
         {
            mui->categories.selection_ptr = i;

            mui_preswitch_tabs(mui, action);

            if (cbs && cbs->action_content_list_switch)
               return cbs->action_content_list_switch(selection_buf, menu_stack,
                     "", "", 0);
         }
      }
   }
   else if (ptr <= (menu_entries_get_size() - 1))
   {
      if (ptr == selection && cbs && cbs->action_select)
         return menu_entry_action(entry, selection, MENU_ACTION_SELECT);

      idx  = ptr;

      menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &idx);
      menu_navigation_ctl(MENU_NAVIGATION_CTL_SET, &scroll);
   }

   return 0;
}
Пример #16
0
static bool d3d_initialize(d3d_video_t *d3d, const video_info_t *info)
{
   unsigned width, height;
   bool ret             = true;
   settings_t *settings = config_get_ptr();

   if (!d3d)
      return false;

   if (!g_pD3D)
      ret = d3d_init_base(d3d, info);
   else if (d3d->needs_restore)
   {
      D3DPRESENT_PARAMETERS d3dpp;

      d3d_make_d3dpp(d3d, info, &d3dpp);

      if (!d3d_reset(d3d->dev, &d3dpp))
      {
         d3d_deinitialize(d3d);
         d3d_device_free(NULL, g_pD3D);
         g_pD3D = NULL;

         ret = d3d_init_base(d3d, info);
         if (ret)
            RARCH_LOG("[D3D]: Recovered from dead state.\n");
      }
   }

   if (!ret)
      return ret;

   if (!d3d_init_chain(d3d, info))
   {
      RARCH_ERR("Failed to initialize render chain.\n");
      return false;
   }

   video_driver_get_size(&width, &height);
   d3d_set_viewport(d3d,
	   width, height, false, true);

#if defined(_XBOX360)
   strlcpy(settings->path.font, "game:\\media\\Arial_12.xpr",
         sizeof(settings->path.font));
#endif
   if (!font_driver_init_first(NULL, NULL,
            d3d, settings->path.font, 0, false,
            FONT_DRIVER_RENDER_DIRECT3D_API))
   {
      RARCH_ERR("[D3D]: Failed to initialize font renderer.\n");
      return false;
   }

   return true;
}
Пример #17
0
static void nk_menu_layout(nk_menu_handle_t *nk)
{
   float scale_factor;
   unsigned width, height, new_header_height;

   video_driver_get_size(&width, &height);

   scale_factor = menu_display_get_dpi();
   menu_display_set_header_height(new_header_height);
}
Пример #18
0
static void glui_render_menu_list(glui_handle_t *glui,
      menu_handle_t *menu,
      uint32_t normal_color,
      uint32_t hover_color)
{
   unsigned width, height;
   size_t i               = 0;
   uint64_t frame_count   = video_driver_get_frame_count();
   size_t          end    = menu_entries_get_end();
   menu_display_t *disp   = menu_display_get_ptr();

   if (!menu_display_update_pending())
      return;

   video_driver_get_size(&width, &height);

   glui->list_block.carr.coords.vertices = 0;

   for (i = menu_entries_get_start(); i < end; i++)
   {
      bool entry_selected;
      char entry_path[PATH_MAX_LENGTH];
      char entry_value[PATH_MAX_LENGTH];
      char message[PATH_MAX_LENGTH];
      char entry_title_buf[PATH_MAX_LENGTH];
      char type_str_buf[PATH_MAX_LENGTH];
      int y = disp->header_height - menu->scroll_y + (glui->line_height * i);

      if (y > (int)height || ((y + (int)glui->line_height) < 0))
         continue;

      entry_path[0]      = '\0';
      entry_value[0]     = '\0';
      message[0]         = '\0';
      entry_title_buf[0] = '\0';
      type_str_buf[0]    = '\0';

      entry_selected = menu_entry_is_currently_selected(i);
      menu_entry_get_value(i, entry_value, sizeof(entry_value));
      menu_entry_get_path(i, entry_path, sizeof(entry_path));

      menu_animation_ticker_line(entry_title_buf, glui->ticker_limit,
            frame_count / 100, entry_path, entry_selected);
      menu_animation_ticker_line(type_str_buf, glui->ticker_limit,
            frame_count / 100, entry_value, entry_selected);

      strlcpy(message, entry_title_buf, sizeof(message));

      glui_blit_line(glui->margin, y, message,
            entry_selected ? hover_color : normal_color, TEXT_ALIGN_LEFT);

      glui_blit_line(width - glui->margin, y, type_str_buf,
            entry_selected ? hover_color : normal_color, TEXT_ALIGN_RIGHT);
   }
}
Пример #19
0
static void gl_raster_font_restore_viewport(gl_t *gl)
{
   unsigned width, height;

   video_driver_get_size(&width, &height);

   glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);

   glDisable(GL_BLEND);
   video_driver_set_viewport(width, height, false, true);
}
Пример #20
0
static bool vg_frame(void *data, const void *frame,
      unsigned frame_width, unsigned frame_height,
      uint64_t frame_count, unsigned pitch, const char *msg)
{
   unsigned width, height;
   vg_t                           *vg = (vg_t*)data;
   static struct retro_perf_counter    vg_fr = {0};
   static struct retro_perf_counter vg_image = {0};

   rarch_perf_init(&vg_fr, "vg_fr");
   retro_perf_start(&vg_fr);

   video_driver_get_size(&width, &height);

   if (frame_width != vg->mRenderWidth || frame_height != vg->mRenderHeight || vg->should_resize)
   {
      vg->mRenderWidth  = frame_width;
      vg->mRenderHeight = frame_height;
      vg_calculate_quad(vg);
      matrix_3x3_quad_to_quad(
         vg->x1, vg->y1, vg->x2, vg->y1, vg->x2, vg->y2, vg->x1, vg->y2,
         /* needs to be flipped, Khronos loves their bottom-left origin */
         0, frame_height, frame_width, frame_height, frame_width, 0, 0, 0,
         &vg->mTransformMatrix);
      vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE);
      vgLoadMatrix(vg->mTransformMatrix.data);

      vg->should_resize = false;
   }

   vgSeti(VG_SCISSORING, VG_FALSE);
   vgClear(0, 0, width, height);
   vgSeti(VG_SCISSORING, VG_TRUE);

   rarch_perf_init(&vg_image, "vg_image");
   retro_perf_start(&vg_image);
   vg_copy_frame(vg, frame, frame_width, frame_height, pitch);
   retro_perf_stop(&vg_image);

   vgDrawImage(vg->mImage);

#if 0
   if (msg && vg->mFontsOn)
      vg_draw_message(vg, msg);
#endif

   gfx_ctx_update_window_title(vg);

   retro_perf_stop(&vg_fr);

   gfx_ctx_swap_buffers(vg);

   return true;
}
Пример #21
0
static void nk_menu_frame(void *data)
{
   float white_bg[16]=  {
      0.98, 0.98, 0.98, 1,
      0.98, 0.98, 0.98, 1,
      0.98, 0.98, 0.98, 1,
      0.98, 0.98, 0.98, 1,
   };

   unsigned width, height, ticker_limit, i;
   nk_menu_handle_t *nk = (nk_menu_handle_t*)data;
   settings_t *settings  = config_get_ptr();

   bool libretro_running = menu_display_libretro_running();

   if (!nk)
      return;

   video_driver_get_size(&width, &height);

   menu_display_set_viewport();

   nk_input_begin(&nk->ctx);
   nk_menu_input_gamepad(nk);
   nk_menu_input_mouse_movement(&nk->ctx);
   nk_menu_input_mouse_button(&nk->ctx);
   nk_menu_input_keyboard(&nk->ctx);

   if (width != nk->size.x || height != nk->size.y)
   {
      nk->size.x = width;
      nk->size.y = height;
      nk->size_changed = true;
   }

   nk_input_end(&nk->ctx);
   nk_menu_main(nk);
   if(nk_window_is_closed(&nk->ctx, "Shader Parameters"))
      nk_menu_wnd_shader_parameters(nk);
   nk_common_device_draw(&device, &nk->ctx, width, height, NK_ANTI_ALIASING_ON);

   menu_display_draw_cursor(
         &white_bg[0],
         64,
         nk->textures.list[NK_TEXTURE_POINTER],
         menu_input_mouse_state(MENU_MOUSE_X_AXIS),
         menu_input_mouse_state(MENU_MOUSE_Y_AXIS),
         width,
         height);

   menu_display_restore_clear_color();
   menu_display_unset_viewport();
}
Пример #22
0
static void zrmenu_frame(void *data)
{
   float white_bg[16]=  {
      0.98, 0.98, 0.98, 1,
      0.98, 0.98, 0.98, 1,
      0.98, 0.98, 0.98, 1,
      0.98, 0.98, 0.98, 1,
   };

   unsigned width, height, ticker_limit, i;
   zrmenu_handle_t *zr = (zrmenu_handle_t*)data;
   settings_t *settings  = config_get_ptr();

   bool libretro_running = menu_display_ctl(
         MENU_DISPLAY_CTL_LIBRETRO_RUNNING, NULL);

   if (!zr)
      return;

   video_driver_get_size(&width, &height);

   menu_display_ctl(MENU_DISPLAY_CTL_SET_VIEWPORT, NULL);

   zr_input_begin(&zr->ctx);
   zrmenu_input_gamepad(zr);
   zrmenu_input_mouse_movement(&zr->ctx);
   zrmenu_input_mouse_button(&zr->ctx);
   zrmenu_input_keyboard(&zr->ctx);

   if (width != zr->size.x || height != zr->size.y)
   {
      zr->size.x = width;
      zr->size.y = height;
      zr->size_changed = true;
   }

   zr_input_end(&zr->ctx);
   zrmenu_main(zr);
   zr_common_device_draw(&device, &zr->ctx, width, height, ZR_ANTI_ALIASING_ON);

   if (settings->menu.mouse.enable && (settings->video.fullscreen
            || !video_driver_ctl(RARCH_DISPLAY_CTL_HAS_WINDOWED, NULL)))
   {
      int16_t mouse_x = menu_input_mouse_state(MENU_MOUSE_X_AXIS);
      int16_t mouse_y = menu_input_mouse_state(MENU_MOUSE_Y_AXIS);

      zrmenu_draw_cursor(zr, &white_bg[0], mouse_x, mouse_y, width, height);
   }

   menu_display_ctl(MENU_DISPLAY_CTL_RESTORE_CLEAR_COLOR, NULL);
   menu_display_ctl(MENU_DISPLAY_CTL_UNSET_VIEWPORT, NULL);
}
Пример #23
0
static void vg_calculate_quad(vg_t *vg)
{
   unsigned width, height;
   video_driver_get_size(&width, &height);

   /* set viewport for aspect ratio, taken from the OpenGL driver. */
   if (vg->keep_aspect)
   {
      float desired_aspect = video_driver_get_aspect_ratio();

      /* If the aspect ratios of screen and desired aspect ratio 
       * are sufficiently equal (floating point stuff),
       * assume they are actually equal. */
      if (fabs(vg->mScreenAspect - desired_aspect) < 0.0001)
      {
         vg->x1 = 0;
         vg->y1 = 0;
         vg->x2 = width;
         vg->y2 = height;
      }
      else if (vg->mScreenAspect > desired_aspect)
      {
         float delta = (desired_aspect / vg->mScreenAspect - 1.0) / 2.0 + 0.5;
         vg->x1 = width * (0.5 - delta);
         vg->y1 = 0;
         vg->x2 = 2.0 * width * delta + vg->x1;
         vg->y2 = height + vg->y1;
      }
      else
      {
         float delta = (vg->mScreenAspect / desired_aspect - 1.0) / 2.0 + 0.5;
         vg->x1 = 0;
         vg->y1 = height * (0.5 - delta);
         vg->x2 = width + vg->x1;
         vg->y2 = 2.0 * height * delta + vg->y1;
      }
   }
   else
   {
      vg->x1 = 0;
      vg->y1 = 0;
      vg->x2 = width;
      vg->y2 = height;
   }

   vg->scissor[0] = vg->x1;
   vg->scissor[1] = vg->y1;
   vg->scissor[2] = vg->x2 - vg->x1;
   vg->scissor[3] = vg->y2 - vg->y1;

   vgSetiv(VG_SCISSOR_RECTS, 4, vg->scissor);
}
Пример #24
0
static void zrmenu_layout(zrmenu_handle_t *zr)
{
   void *fb_buf;
   float scale_factor;
   unsigned width, height, new_header_height;

   video_driver_get_size(&width, &height);

   menu_display_ctl(MENU_DISPLAY_CTL_GET_DPI, &scale_factor);
   menu_display_ctl(MENU_DISPLAY_CTL_SET_HEADER_HEIGHT,
         &new_header_height);

}
Пример #25
0
static void gl1_gfx_viewport_info(void *data,
      struct video_viewport *vp)
{
   unsigned width, height;
   unsigned top_y, top_dist;
   gl1_t *gl1             = (gl1_t*)data;

   video_driver_get_size(&width, &height);

   *vp             = gl1->vp;
   vp->full_width  = width;
   vp->full_height = height;

   /* Adjust as GL viewport is bottom-up. */
   top_y           = vp->y + vp->height;
   top_dist        = height - top_y;
   vp->y           = top_dist;
}
Пример #26
0
static void xdk_renderchain_viewport_info(void *data, struct video_viewport *vp)
{
   unsigned width, height;
   d3d_video_t *d3d = (d3d_video_t*)data;

   if (!d3d || !vp)
      return;

   video_driver_get_size(&width, &height);

   vp->x            = d3d->final_viewport.X;
   vp->y            = d3d->final_viewport.Y;
   vp->width        = d3d->final_viewport.Width;
   vp->height       = d3d->final_viewport.Height;

   vp->full_width   = width;
   vp->full_height  = height;
}
Пример #27
0
static void glui_layout(menu_handle_t *menu, glui_handle_t *glui)
{
   float scale_factor;
   unsigned width, height;
   settings_t *settings  = config_get_ptr();
   video_driver_get_size(&width, &height);

   if (settings->video.fullscreen)
      scale_factor = menu_display_get_dpi();
   else
      scale_factor = width / 6;

   glui->line_height            = scale_factor / 3;
   glui->margin                 = scale_factor / 6;
   glui->ticker_limit           = scale_factor / 3;
   menu->display.header_height  = scale_factor / 3;
   menu->display.font.size      = scale_factor / 8;
}
Пример #28
0
static void zarch_render(void)
{
   int bottom;
   unsigned width, height;
   zui_t         *zarch = NULL;
   menu_handle_t *menu  = menu_driver_get_ptr();
   settings_t *settings = config_get_ptr();

   if (!menu || !menu->userdata)
      return;
    
   (void)settings;
   (void)bottom;
   (void)zarch;

   video_driver_get_size(&width, &height);

}
Пример #29
0
static void glui_render_quad(gl_t *gl, int x, int y, int w, int h,
      float r, float g, float b, float a)
{
   unsigned width, height;
   struct gl_coords coords;
   menu_handle_t *menu = menu_driver_get_ptr();
   glui_handle_t *glui = (glui_handle_t*)menu->userdata;
   static const GLfloat vertex[] = {
      0, 0,
      1, 0,
      0, 1,
      1, 1,
   };

   static const GLfloat tex_coord[] = {
      0, 1,
      1, 1,
      0, 0,
      1, 0,
   };

   GLfloat color[] = {
      r, g, b, a,
      r, g, b, a,
      r, g, b, a,
      r, g, b, a,
   };

   video_driver_get_size(&width, &height);

   glViewport(x, height - y - h, w, h);

   coords.vertices      = 4;
   coords.vertex        = vertex;
   coords.tex_coord     = tex_coord;
   coords.lut_tex_coord = tex_coord;

   coords.color = color;

   menu_gl_draw_frame(gl->shader, &coords,
         &gl->mvp_no_rot, true, glui->textures.white);

   gl->coords.color = gl->white_color_ptr;
}
Пример #30
0
static void mui_layout(mui_handle_t *mui)
{
   void *fb_buf;
   float scale_factor;
   int new_font_size;
   unsigned width, height, new_header_height;

   video_driver_get_size(&width, &height);

   /* Mobiles platforms may have very small display metrics coupled to a high
      resolution, so we should be dpi aware to ensure the entries hitboxes are
      big enough. On desktops, we just care about readability, with every widget
      size proportional to the display width. */
   menu_display_ctl(MENU_DISPLAY_CTL_GET_DPI, &scale_factor);

   new_header_height    = scale_factor / 3;
   new_font_size        = scale_factor / 9;

   mui->shadow_height   = scale_factor / 36;
   mui->scrollbar_width = scale_factor / 36;
   mui->tabs_height     = scale_factor / 3;
   mui->line_height     = scale_factor / 3;
   mui->margin          = scale_factor / 9;
   mui->icon_size       = scale_factor / 3;

   menu_display_ctl(MENU_DISPLAY_CTL_SET_HEADER_HEIGHT, &new_header_height);
   menu_display_ctl(MENU_DISPLAY_CTL_SET_FONT_SIZE,     &new_font_size);

   /* we assume the average glyph aspect ratio is close to 3:4 */
   mui->glyph_width = new_font_size * 3/4;

   mui_font();

   menu_display_ctl(MENU_DISPLAY_CTL_FONT_BUF, &fb_buf);

   if (fb_buf) /* calculate a more realistic ticker_limit */
   {
      unsigned m_width = font_driver_get_message_width(fb_buf, "a", 1, 1);

      if (m_width)
         mui->glyph_width = m_width;
   }
}