Exemplo n.º 1
0
static void shape_erase(s32_t x, s32_t y, u32_t index)
{
    u32_t i;

    for(i = 0; i < 4; i++)
    {
    	block_draw(x, y, TCOLOR_BLACK);
        x += shapes[index].direction[i].x;
        y += shapes[index].direction[i].y;
    }
    block_draw(x, y, TCOLOR_BLACK);
}
Exemplo n.º 2
0
static void shape_draw(s32_t x, s32_t y, u32_t index)
{
    u32_t i;

    for(i = 0; i < 4; i++)
    {
    	block_draw(x, y, shapes[index].color);
        x += shapes[index].direction[i].x;
        y += shapes[index].direction[i].y;
    }
    block_draw(x, y, shapes[index].color);
}
//Draw fight stage
int draw_fight_stage(){ int r, c;
    //Draw basic grass across screen
    for(r = 0; r < num_rows; r++){ // Rows
        for(c = 0; c < num_columns; c++){ 
            block_draw_sp(c, r, &NoGrass_img);
        }
    }
    
    //Spell Rune interface around borders
    //Elec Spell
    for(int i = num_columns-2; i>num_columns-5 ; i--){
        block_draw_sp(i, 0, &Light_img);
    }
    
    //Water Spell
    for(int i = 3; i < 6; i++){
        block_draw_sp(num_columns-1, i, &Water_img);
    }
    
    //Fire Spell
    for(int i = 1; i < 4; i++){
        block_draw_sp(i, 8, &Fire_img);
    }
    
    //Grass Spell
    for(int i = 4; i < 7; i++){
        block_draw_sp(0, i, &Earth_img);
    }
    
    draw_char();
    block_draw(4, 5, ST7735_BLACK);
    block_draw(5, 5, ST7735_BLACK);
    
    int element = random(1, 5); //Random Generation of Enemy
    Serial.print(element);
    if(element == 1){ //Fire Monster
        draw_enemy(&Fmns_img);
    }
    if(element == 2){ //Water Monster
        draw_enemy(&Wmns_img);
    }
    if(element == 3){ //Lightning Monster
        draw_enemy(&Lmns_img);
    }
    if(element == 4){ //Earth Monster
        draw_enemy(&Emns_img);
    }
    
    
    
    return element;}
//Draw Interface on bottom row.
void draw_interface(Coords *cc){
    for(int i = 0; i < num_columns; i++){
        block_draw(i, num_rows, ST7735_BLACK);
    }
    // Draw lives
    for(int i = 0; i < cc->life_Counter; i++){
        lcd_image_draw(&Heart_img, &tft, 0, 0, (i+1)*blocksize, num_rows*blocksize, 16, 16);
    }}
Exemplo n.º 5
0
/**
 * params:
 *  game -- the game to draw
 */
void game_draw(game_t *game) {
  field_draw(&game->field);

  screen_clear(&game->block_screen, 0x30);
  for(int x = 0; x < BLOCK_QUEUE_SIZE; ++x) {
    if(game->player != (game->queue + x)) {
      block_draw(&game->block_screen, &game->queue[x]);
    }
  }

  field_block_draw(&game->field, game->player);
}
Exemplo n.º 6
0
Arquivo: map.c Projeto: odrevet/GE
bool map_draw(map *p_map, SDL_Surface *destination)
{
  int i, j;
  SDL_Rect rect_src;
  rect_src.h = TILE_SIZE;
  rect_src.w = TILE_SIZE;

  for (i=0;i<p_map->height;i++)
    {
      for (j=0;j<p_map->width[i];j++)
        {
	  if (p_map->pp_tile[i][j].key == '_')
            {
	      image_draw_part(p_map->p_chipset,
			      destination,
			      j*TILE_SIZE,
			      i*TILE_SIZE,
			      0,
			      0,
			      rect_src.h,
			      rect_src.w);
            }
	  else if (p_map->pp_tile[i][j].key == '#')
            {
	      image_draw_part(p_map->p_chipset,
			      destination,
			      j*TILE_SIZE,
			      i*TILE_SIZE,
			      32,
			      0,
			      rect_src.h,
			      rect_src.w);
            }

	  if(p_map->pp_tile[i][j].type == BLOCK){
	    block_draw(p_map->pp_tile[i][j].p_block, destination);
	    block_update(&p_map->pp_tile[i][j]);
	  }
        }
    }

  return true;
}