Exemplo n.º 1
0
static void render_to_display_list(pl_vk_layout *layout)
{
  /* Render the virtual keyboard to a call list */
  memset(layout->call_list, 0, sizeof(layout->call_list));

  pspVideoBegin();

  const pl_vk_button *button;
  int off_x, off_y;
  int i;

  off_x = (SCR_WIDTH / 2 - layout->keyb_image->Viewport.Width / 2);
  off_y = (SCR_HEIGHT / 2 - layout->keyb_image->Viewport.Height / 2);

  pspVideoFillRect(off_x,
                   off_y,
                   off_x + layout->keyb_image->Viewport.Width + 1,
                   off_y + layout->keyb_image->Viewport.Height + 1,
                   PL_VK_LAYOUT_BG);

  off_x += layout->offset_x;
  off_y += layout->offset_y;

  for (i = 0, button = layout->keys; i < layout->key_count; i++, button++)
    pspVideoFillRect(off_x + button->x,
                     off_y + button->y,
                     off_x + button->x + button->w + 1,
                     off_y + button->y + button->h + 1,
                     PL_VK_BUTTON_BG);
  pspVideoEnd();
}
Exemplo n.º 2
0
void pl_vk_render(const pl_vk_layout *layout)
{
  int off_x, off_y, i, j;
  const pl_vk_button *button;

  pspVideoCallList(layout->call_list);

  off_x = (SCR_WIDTH / 2 - layout->keyb_image->Viewport.Width / 2);
  off_y = (SCR_HEIGHT / 2 - layout->keyb_image->Viewport.Height / 2);

  if (layout->keyb_image)
    pspVideoPutImage(layout->keyb_image,
                     off_x, off_y,
                     layout->keyb_image->Viewport.Width,
                     layout->keyb_image->Viewport.Height);
  else
  {
    /* TODO: render the entire layout */
  }

  off_x += layout->offset_x;
  off_y += layout->offset_y;

  /* Highlight sticky buttons */
  pl_vk_sticky *sticky;
  for (i = 0, sticky = layout->stickies;
       i < layout->sticky_count;
       i++, sticky++)
  {
    if (sticky->status)
    {
      for (j = 0; j < sticky->index_count; j++)
      {
        button = &(layout->keys[sticky->key_index[j]]);
        pspVideoFillRect(off_x + button->x + 1,
                         off_y + button->y + 1,
                         off_x + button->x + button->w,
                         off_y + button->y + button->h,
                         PL_VK_STUCK_COLOR);
      }
    }
  }

  /* Highlight selected button */
  button = &(layout->keys[layout->selected]);
  pspVideoFillRect(off_x + button->x + 1,
                   off_y + button->y + 1,
                   off_x + button->x + button->w,
                   off_y + button->y + button->h,
                   PL_VK_SELECTED_COLOR);
}
Exemplo n.º 3
0
/***
 * Prints the current FPS to the screen.
 */
void show_fps()
{
    static char fps_display[32];
    sprintf(fps_display, "FPS: %3.02f", curr_fps);

    int width = pspFontGetTextWidth(&PspStockFont, fps_display);
    int height = pspFontGetLineHeight(&PspStockFont);

    pspVideoFillRect(0, 0, width, height, PSP_COLOR_BLACK);
    pspVideoPrint(&PspStockFont, 0, 0, fps_display, PSP_COLOR_WHITE);
}
Exemplo n.º 4
0
/* Handles drawing of generic items */
void OnGenericRender(const void *uiobject, const void *item_obj)
{
  /* Draw tabs */
  int height = pspFontGetLineHeight(UiMetric.Font);
  int width;
  int i, x;
  for (i = 0, x = 5; i <= TAB_MAX; i++, x += width + 10)
  {
    width = -10;

    if (!GAME_LOADED && (i == TAB_STATE || i == TAB_SYSTEM))
      continue;

    /* Determine width of text */
    width = pspFontGetTextWidth(UiMetric.Font, TabLabel[i]);

    /* Draw background of active tab */
    if (i == TabIndex)
      pspVideoFillRect(x - 5, 0, x + width + 5, height + 1, UiMetric.TabBgColor);

    /* Draw name of tab */
    pspVideoPrint(UiMetric.Font, x, 0, TabLabel[i], PSP_COLOR_WHITE);
  }
}