Exemple #1
0
/** 
 * Display a sprite into score panel (from an 'image' structure)
 * @param img Pointer to a image structure
 * @param xcoord X-coordinate in the top panel 
 * @param ycoord Y-coordinate in the top panel
 */
void
draw_image_in_score (image * img, Uint32 xcoord, Uint32 ycoord)
{
  Uint32 size;
  char *source, *dest, *repeats;
  source = img->img;
  dest =
    scores_offscreen + ycoord * score_offscreen_pitch +
    xcoord * bytes_per_pixel;
  repeats = img->compress;
  size = img->nbr_data_comp >> 2;
  switch (bytes_per_pixel)
    {
    case 1:
      put_sprite_8 (source, dest, repeats, size);
      break;
    case 2:
      put_sprite_16 (source, dest, repeats, size);
      break;
    case 3:
      put_sprite_24 (source, dest, repeats, size);
      break;
    case 4:
      put_sprite_32 (source, dest, repeats, size);
      break;
    }
}
Exemple #2
0
/** 
 * Display sprite into options panel (from an 'bitmap' structure)
 * @param bmp Pointer to a 'bitmap' structure
 * @param xcoord X-coordinate in the option panel offscreen
 * @param ycoord Y-coordinate in the option panel offscreen
 */
void
draw_bitmap_in_options (bitmap * bmp, Uint32 xcoord, Uint32 ycoord)
{
  Uint32 size;
  char *source, *dest, *repeats;
  source = bmp->img;
  dest =
    options_offscreen + (ycoord * OPTIONS_WIDTH + xcoord) * bytes_per_pixel;
  repeats = bmp->compress;
  size = bmp->nbr_data_comp >> 2;
  switch (bytes_per_pixel)
    {
    case 1:
      put_sprite_8 (source, dest, repeats, size);
      break;
    case 2:
      put_sprite_16 (source, dest, repeats, size);
      break;
    case 3:
      put_sprite_24 (source, dest, repeats, size);
      break;
    case 4:
      put_sprite_32 (source, dest, repeats, size);
      break;
    }
}
Exemple #3
0
/**
 * Repeat the same image horizontally
 * @param img Pointer to a image structure
 * @param xcoord X-coordinate in the top panel 
 * @param ycoord Y-coordinate in the top panel
 * @param repeat_count The number of repetitions
 */
void
draw_image_in_score_repeat (image * img, Uint32 xcoord, Uint32 ycoord,
                            Uint32 repeat_count)
{
  Uint32 i, step, size;
  char *source, *dest, *repeats;
  source = img->img;
  dest =
    scores_offscreen + ycoord * score_offscreen_pitch +
    xcoord * bytes_per_pixel;
  repeats = img->compress;
  size = img->nbr_data_comp >> 2;
  step = 1 * pixel_size * bytes_per_pixel;
  switch (bytes_per_pixel)
    {
    case 1:
      for (i = 0; i < repeat_count; i++)
        {
          put_sprite_8 (source, dest, repeats, size);
          dest += step;
        }
      break;
    case 2:
      for (i = 0; i < repeat_count; i++)
        {
          put_sprite_16 (source, dest, repeats, size);
          dest += step;
        }
      break;
    case 3:
      for (i = 0; i < repeat_count; i++)
        {
          put_sprite_24 (source, dest, repeats, size);
          dest += step;
        }
      break;
    case 4:
      for (i = 0; i < repeat_count; i++)
        {
          put_sprite_32 (source, dest, repeats, size);
          dest += step;
        }
      break;
    }
}
Exemple #4
0
// do the whole preview table and stuff :)
void do_preview(u_char* buf) {
	int asc, x, y, addr;
	u_char st;

	set_color(15, 4, 4);
	set_sprite_8(0, square);

	fill(MODE2_ATTR, 0xF0, MODE2_MAX);

	// start blitting buffer at pixel (16,16)
	addr = map_block(16, 16);

	// 16 chars of width (*8), 16 "lines", jump 256 in VRAM for each line
	blit_ram_vram(buf, addr, 16 * 8, 16, 16 * 8, 256);

	// fill yellow background
	blit_fill_vram(MODE2_ATTR + map_block(8, 8), 0x1A, 8 * 18, 18, 256);

	x = 0; y = 0;

	// preview loop
	while (!get_trigger(0)) {
		// move the cursor and set the zooming
		st = st_dir[get_stick(0)];

		x += (st & st_right) ? 1 : ((st & st_left) ? -1 : 0);
		y += (st & st_down) ? 1 : ((st & st_up) ? -1 : 0);

		x &= 15;
		y &= 15;
		asc = (y << 4) + x;
		put_sprite_8(0, (x + 2) << 3, (y + 2) << 3, 0, 9);

		preview_char(buf + (asc << 3));
	}	
}