Example #1
0
void eol_font_draw_text_block(
    char   * text,
    eolInt   x,
    eolInt   y,
    eolInt   w,
    eolInt   h,
    eolVec3D color,
    eolFloat alpha,
    eolInt   size
  )
{
  if (!eol_font_initialized())return;
  if (size >= eolFontSizeMax)
  {
    eol_logger_message(
      EOL_LOG_WARN,
      "eol_font: passed a font size outside of available range");
    return;
  }
  eol_font_draw_text_block_custom(
    text,
    eol_rect(x,y,w,h),
    color,
    alpha,
    _eol_font_size[size]
  );
}
Example #2
0
void eol_component_label_draw(eolComponent *component, eolRect bounds)
{
  eolComponentLabel *label = eol_component_get_label_data(component);
  if (label == NULL)return;
  if (label->buffer == NULL)return;
  if (label->font == NULL)
  {
    if (label->wordWrap)
    {
      eol_font_draw_text_block(
      label->buffer->str,
      bounds.x,
      bounds.y,
      bounds.w,
      0,
      label->color,
      label->alpha,
      label->fontSize
      );
    }
    else
    {
      eol_font_draw_text_justify(
        label->buffer->str,
        bounds.x,
        bounds.y,
        label->color,
        label->alpha,
        label->fontSize,
        label->justify
      );
    }
  }
  else
  {
    if (label->wordWrap)
    {
      eol_font_draw_text_block_custom(
        label->buffer->str,
        bounds,
        label->color,
        label->alpha,
        label->font
      );
    }
    else
    {
      eol_font_draw_text_justify_custom(
        label->buffer->str,
        bounds.x,
        bounds.y,
        label->color,
        label->alpha,
        label->font,
        label->justify
      );
    }
  }
}
Example #3
0
void eol_component_entry_draw(eolComponent *component, eolRect bounds)
{
  eolRect r;
  eolComponentEntry *entry = eol_component_get_entry_data(component);
  if (entry == NULL)return;
  r.x = bounds.x - 1;
  r.y = bounds.y - 1;
  r.w = bounds.w + 2;
  r.h = bounds.h + 2;
  eol_draw_solid_rect(r,eol_vec3d(1,1,1),1);
  eol_draw_solid_rect(bounds,entry->bgcolor,1);
  if (entry->buffer->len <= 0)return;
  if (entry->font == NULL)
  {
    if (entry->wordWrap)
    {
      eol_font_draw_text_block(
      entry->buffer->str,
      bounds.x,
      bounds.y,
      bounds.w,
      0,
      entry->color,
      entry->alpha,
      entry->fontSize
      );
    }
    else
    {
      eol_font_draw_text_justify(
        entry->buffer->str,
        bounds.x,
        bounds.y,
        entry->color,
        entry->alpha,
        entry->fontSize,
        entry->justify
      );
    }
  }
  else
  {
    if (entry->wordWrap)
    {
      eol_font_draw_text_block_custom(
        entry->buffer->str,
        bounds,
        entry->color,
        entry->alpha,
        entry->font
      );
    }
    else
    {
      eol_font_draw_text_justify_custom(
        entry->buffer->str,
        bounds.x,
        bounds.y,
        entry->color,
        entry->alpha,
        entry->font,
        entry->justify
      );
    }
  }
}