Example #1
0
/* Mudar Cor Background */
void set_fundo( char nova_cor ){
	int r,g,b;
	if(search_color(nova_cor, &r,&g,&b)==1){
		fundo_ = nova_cor;
		mudar_cor( FUNDO , r, g, b);
	}
}
Example #2
0
/* Muda a cor de blocos e linhas */
void set_cor( char nova_cor ){
	int r,g,b;
	if(search_color(nova_cor, &r,&g,&b)==1){
		last_cor_=cor_;
		cor_=nova_cor;
		mudar_cor( TEXTO , r,g,b);
	}
}
Example #3
0
/**
 * Initialize some predefined colors
 */
void
display_colors_init (void)
{
  coulor[BLACK] = search_color (0, 0, 0);
  coulor[LIGHT_GRAY] = search_color (212, 212, 212);
  coulor[WHITE] = search_color (255, 255, 255);
  coulor[RED] = search_color (255, 0, 0);
  coulor[GREEN] = search_color (0, 255, 0);
  real_black_color = coulor[BLACK];
  if (bytes_per_pixel == 2)
    {
      real_black_color = (Sint32) pal16[real_black_color];
    }
  else
    {
      if (bytes_per_pixel > 3)
        {
          real_black_color = (Sint32) pal32[real_black_color];
        }
    }
}
Example #4
0
/**
 * Allocate buffers and precalcule the rings
 * @return TRUE if it completed successfully or 0 otherwise
 */
bool
shockwave_once_init (void)
{
    double a, step, pi;
    Sint32 i, j, n, r;
    Sint16 x, y;


    /* allocate shockwaves data structure */
    if (shockwave == NULL)
    {
        shockwave =
            (shockwave_struct *) memory_allocation (MAX_NUMOF_SHOCKWAVES *
                    sizeof (shockwave_struct));
        if (shockwave == NULL)
        {
            LOG_ERR ("shockwave out of memory");
            return FALSE;
        }
    }
    if (shockwave_right_buffer == NULL)
    {
        shockwave_right_buffer =
            (Sint32 *) memory_allocation (offscreen_height * sizeof (Sint32));
        if (shockwave_right_buffer == NULL)
        {
            LOG_ERR ("shockwave_right_buffer out of memory");
            return FALSE;
        }

    }
    if (shockwave_left_buffer == NULL)
    {
        shockwave_left_buffer =
            (Sint32 *) memory_allocation (offscreen_height * sizeof (Sint32));
        if (shockwave_left_buffer == NULL)
        {
            LOG_ERR ("shockwave_left_buffer out of memory");
            return FALSE;
        }

    }

    if (shockwave_ring_x == NULL)
    {
        shockwave_ring_x =
            (Sint16 *) memory_allocation (NUMOF_RINGS_SHOCKWAVE *
                                          NUMOF_POINTS_SHOCKWAVE * 2 *
                                          sizeof (Sint16));
        if (shockwave_ring_x == NULL)
        {
            LOG_ERR ("'shockwave_ring_x' out of memory");
            return FALSE;
        }
        shockwave_ring_y =
            shockwave_ring_x + NUMOF_RINGS_SHOCKWAVE * NUMOF_POINTS_SHOCKWAVE;
    }

    /* set colors of the shockwaves */
    shockwave_colors[0] = search_color (255, 255, 0);
    shockwave_colors[1] = search_color (248, 248, 0);
    shockwave_colors[2] = search_color (241, 241, 0);
    shockwave_colors[3] = search_color (234, 234, 0);
    shockwave_colors[4] = search_color (227, 227, 0);
    shockwave_colors[5] = search_color (220, 220, 0);
    shockwave_colors[6] = search_color (213, 213, 0);
    shockwave_colors[7] = search_color (206, 206, 0);
    shockwave_colors[8] = search_color (199, 199, 0);
    shockwave_colors[9] = search_color (192, 192, 0);
    shockwave_colors[10] = search_color (185, 185, 0);
    shockwave_colors[11] = search_color (178, 178, 0);
    shockwave_colors[12] = search_color (171, 171, 0);
    shockwave_colors[13] = search_color (164, 164, 0);
    shockwave_colors[14] = search_color (157, 157, 0);
    shockwave_colors[15] = search_color (150, 150, 0);
    shockwave_colors[16] = search_color (143, 143, 0);
    shockwave_colors[17] = search_color (136, 136, 0);
    shockwave_colors[18] = search_color (129, 129, 0);
    shockwave_colors[19] = search_color (122, 122, 0);
    shockwave_colors[20] = search_color (115, 115, 0);
    shockwave_colors[21] = search_color (108, 108, 0);
    shockwave_colors[22] = search_color (101, 101, 0);
    shockwave_colors[23] = search_color (94, 94, 0);
    shockwave_colors[24] = search_color (87, 87, 0);

    /*
     * precalculate the 55 rings (rings are circles)
     */
    n = NUMOF_POINTS_SHOCKWAVE;
    pi = 4 * atan (1.0);
    /* ring radius: 30 to 300 pixels */
    r = 30 * pixel_size;
    step = (pi * 2) / (NUMOF_POINTS_SHOCKWAVE - 1);
    for (i = 0; i < NUMOF_RINGS_SHOCKWAVE; i++, r += 5)
    {
        /* clear angle value */
        a = 0.0;
        for (j = 0; j < (NUMOF_POINTS_SHOCKWAVE - 1); j++)
        {
            x = (Sint16) (cos (a) * r);
            y = (Sint16) (sin (a) * r);
            a = a + step;
            shockwave_ring_x[i * n + j] = x;
            shockwave_ring_y[i * n + j] = y;
        }
        /* the first and last point are equal to get a closer ring */
        shockwave_ring_x[i * n + j] = shockwave_ring_x[i * n];
        shockwave_ring_y[i * n + j] = shockwave_ring_y[i * n];
    }
    shockwave_init ();
    return TRUE;
}