Ejemplo n.º 1
0
// Lua: height = ucg.getHeight( self )
static int lucg_getHeight( lua_State *L )
{
    lucg_userdata_t *lud;

    if ((lud = get_lud( L )) == NULL)
        return 0;

    lua_pushinteger( L, ucg_GetHeight( LUCG ) );

    return 1;
}
Ejemplo n.º 2
0
static void pg_hline(pg_struct *pg, ucg_t *ucg)
{
  pg_word_t x1, x2, y;
  x1 = pg->pge[PG_LEFT].current_x;
  x2 = pg->pge[PG_RIGHT].current_x;
  y = pg->pge[PG_RIGHT].current_y;
  
  if ( y < 0 )
    return;
  if ( y >= ucg_GetHeight(ucg) )
    return;
  if ( x1 < x2 )
  {
    if ( x2 < 0 )
      return;
    if ( x1 >= ucg_GetWidth(ucg) )
      return;
    if ( x1 < 0 )
      x1 = 0;
    if ( x2 >= ucg_GetWidth(ucg) )
      x2 = ucg_GetWidth(ucg);
    ucg_DrawHLine(ucg, x1, y, x2 - x1);
  }
  else
  {
    if ( x1 < 0 )
      return;
    if ( x2 >= ucg_GetWidth(ucg) )
      return;
    if ( x2 < 0 )
      x1 = 0;
    if ( x1 >= ucg_GetWidth(ucg) )
      x1 = ucg_GetWidth(ucg);
    ucg_DrawHLine(ucg, x2, y, x1 - x2);
  }
}
Ejemplo n.º 3
0
int main(void)
{
  ucg_int_t a,b;
  
  ucg_Init(&ucg, ucg_sdl_dev_cb, ucg_ext_none, (ucg_com_fnptr)0);
  ucg_SetFontMode(&ucg, UCG_FONT_MODE_TRANSPARENT);
  ucg_SetFont(&ucg, ucg_font_ncenB24);  
  //ucg_SetRotate90(&ucg);
  
  //ucg_SetRotate270(&ucg);  
  //ucg_SetClipRange(&ucg, 10,5,40,20);


  
  a = 2;
  b = 3;
  
  ucg_SetColor(&ucg, 0, 135*a/b,206*a/b,250*a/b);
  ucg_SetColor(&ucg, 1, 176*a/b,226*a/b,255*a/b);
  ucg_SetColor(&ucg, 2, 25*a/b,25*a/b,112*a/b);
  ucg_SetColor(&ucg, 3, 	85*a/b,26*a/b,139*a/b);
  ucg_DrawGradientBox(&ucg, 0, 0, ucg_GetWidth(&ucg)/4, ucg_GetHeight(&ucg));

  ucg_SetColor(&ucg, 1, 135*a/b,206*a/b,250*a/b);
  ucg_SetColor(&ucg, 0, 176*a/b,226*a/b,255*a/b);
  ucg_SetColor(&ucg, 3, 25*a/b,25*a/b,112*a/b);
  ucg_SetColor(&ucg, 2, 	85*a/b,26*a/b,139*a/b);
  ucg_DrawGradientBox(&ucg, ucg_GetWidth(&ucg)/4, 0, ucg_GetWidth(&ucg)/4, ucg_GetHeight(&ucg));

  ucg_SetColor(&ucg, 0, 135*a/b,206*a/b,250*a/b);
  ucg_SetColor(&ucg, 1, 176*a/b,226*a/b,255*a/b);
  ucg_SetColor(&ucg, 2, 25*a/b,25*a/b,112*a/b);
  ucg_SetColor(&ucg, 3, 	85*a/b,26*a/b,139*a/b);
  ucg_DrawGradientBox(&ucg, ucg_GetWidth(&ucg)*2/4, 0, ucg_GetWidth(&ucg)/4, ucg_GetHeight(&ucg));

  ucg_SetColor(&ucg, 1, 135*a/b,206*a/b,250*a/b);
  ucg_SetColor(&ucg, 0, 176*a/b,226*a/b,255*a/b);
  ucg_SetColor(&ucg, 3, 25*a/b,25*a/b,112*a/b);
  ucg_SetColor(&ucg, 2, 	85*a/b,26*a/b,139*a/b);
  ucg_DrawGradientBox(&ucg, ucg_GetWidth(&ucg)*3/4, 0, ucg_GetWidth(&ucg)/4, ucg_GetHeight(&ucg));
  
  
  upper_pin(&ucg, 7+0*14, 4);
  upper_pin(&ucg, 7+1*14, 4);
  upper_pin(&ucg, 7+2*14, 4);
  upper_pin(&ucg, 7+3*14, 4);
  
  ic_body(&ucg, 2, 10);

  lower_pin(&ucg, 7+0*14, 41);
  lower_pin(&ucg, 7+1*14, 41);
  lower_pin(&ucg, 7+2*14, 41);
  lower_pin(&ucg, 7+3*14, 41);

  ucg_SetColor(&ucg, 0, 135*a/b, 206*a/b, 250*a/b);
  ucg_DrawString(&ucg, 63+1, 33+1, 0, "glib");

  ucg_SetColor(&ucg, 0, 255, 168, 0);
  ucg_DrawGlyph(&ucg, 26, 38, 0, 'U');
  ucg_DrawString(&ucg, 63, 33, 0, "glib");

  ucg_SetColor(&ucg, 0, 135*a/b, 206*a/b, 250*a/b);
  ucg_SetColor(&ucg, 1, 135*a/b, 206*a/b, 250*a/b);
  ucg_SetColor(&ucg, 2, 135*a/b, 206*a/b, 250*a/b);
  ucg_SetColor(&ucg, 3, 135*a/b, 206*a/b, 250*a/b);
  ucg_DrawGradientBox(&ucg, 84+1, 42+1-6, 42, 4);

  ucg_SetColor(&ucg, 0, 255, 180, 40);
  ucg_SetColor(&ucg, 1, 235, 148, 0);
  //ucg_DrawGradientLine(&ucg, 79, 42, 20, 0);
  ucg_SetColor(&ucg, 2, 245, 158, 0);
  ucg_SetColor(&ucg, 3, 220, 138, 0);
  ucg_DrawGradientBox(&ucg, 84, 42-6, 42, 4);

  ucg_SetColor(&ucg, 0, 255, 168, 0);
  ucg_SetFont(&ucg, ucg_font_5x8);
  //ucg_SetFont(&ucg, ucg_font_courB08);
  ucg_DrawString(&ucg, 2, 54, 0, "http://");
  ucg_DrawString(&ucg, 1, 61, 0, "code.google.com/p/ucglib/");


  while( ucg_sdl_get_key() < 0 )
    ;
    
  
  return 0;
}