void Ellipse::draw()
 {
     if(get_filled_status())
         al_draw_filled_ellipse(_V_pos_x,_V_pos_y,_V_radius_x*bitmap_scale_x,_V_radius_y*bitmap_scale_y,_V_color);
     al_draw_ellipse(_V_pos_x,_V_pos_y,_V_radius_x*bitmap_scale_x,_V_radius_y*bitmap_scale_y,_V_color,
                     _V_thickness*primitives_scale);
 }
Пример #2
0
void Enemy::draw()
{
    al_draw_filled_ellipse(posx_+width_/2, posy_- height_/2+5, width_/2, height_/2, al_map_rgba(0,0,0,50));
    if (lastHurt_ + 0.5 < al_get_time())
        al_draw_bitmap_region(picture_, animationState_*pic_width_, 0, pic_width_, pic_height_, posx_, posy_ - pic_height_ - posz_, 0);
    else
        al_draw_tinted_bitmap_region(picture_, al_map_rgba(200,100,100,100), animationState_*pic_width_, 0, pic_width_, pic_height_, posx_, posy_ - pic_height_ - posz_, 0);
}
Пример #3
0
/**< Função Desenha uma elipse preenchido na Janela */
void Des_Elipse_preenchido( int desenha_elipse, ALLEGRO_FONT *fonte, ALLEGRO_EVENT_QUEUE *fila_eventos, int x1, int y1, int x2, int y2, int x3, int y3)
{
     if (desenha_elipse == 1)
    {
        float a = sqrt(pow(x1 - x2,2) + pow(y1 - y2,2));
        float b = sqrt(pow(x1 - x3,2) + pow(y1 - y3,2));
        al_draw_text(fonte, al_map_rgb(255, 255, 255), 320, 70, ALLEGRO_ALIGN_CENTRE, "Precione em 2 pontos:");
        al_draw_filled_ellipse(x1, y1, b, a, al_map_rgb(255, 255, 255));
    }
}
Пример #4
0
void drawenemy(Game *game, int i)
{
    Enemy enemy;
    enemy = game->room->enemies[i];
    al_draw_filled_ellipse(enemy.posx+enemy.szer/2,enemy.posy-enemy.grub/2 + 5,enemy.szer/2, enemy.grub/2,
                            al_map_rgba(0,0,0,50));
    if (enemy.lasthurt > al_get_time() - 0.3)
        al_draw_tinted_bitmap_region(enemy.picture, al_map_rgba(100,100,100,100),enemy.picposx,enemy.picposy,
                                     enemy.szer, enemy.wys, enemy.posx, enemy.posy-enemy.wys, 0);
    else
        al_draw_bitmap_region(enemy.picture,enemy.picposx,enemy.picposy,
                            enemy.szer, enemy.wys, enemy.posx, enemy.posy-enemy.wys, 0);
}
Пример #5
0
void RenderTarget::drawEllipse(float x, float y, float w, float h, bool fill, const ALLEGRO_COLOR &color) {
	convertCoords(x, y);
	if (w < 0 || h < 0) {
		return;
	}
	setAsCurrent();
	if (fill) {
		al_draw_filled_ellipse(x, y, w * 0.5f, h * 0.5f, color);
	}
	else {
		al_draw_ellipse(x, y, w * 0.5f, h * 0.5f, color, CBEnchanted::instance()->gfxInterface->getLineWidth());
	}
}
Пример #6
0
int main()
{
    ALLEGRO_DISPLAY *display = NULL;
    ALLEGRO_FONT* century_gothic24;

    if(!al_init())
    {
        printf("al_init Failed!\n");
        return -1;
    }
    if(!al_init_primitives_addon())
    {
        printf("al_init_primitives_addon Failed!\n");
        return -1;
    }
    display = al_create_display(640, 480);
    if(!display)
    {
        printf("al_create_display Failed!\n");
        return -1;
    }
    al_init_font_addon();
    al_init_ttf_addon();
    century_gothic24  = al_load_ttf_font("C:\\Windows\\Fonts\\GOTHIC.TTF" , 24, ALLEGRO_ALIGN_CENTRE);
    // Paint a hidden screen (a buffer), that we'll apply later.
    al_clear_to_color(al_map_rgb(0,0,0));
    // Draw an ugly red triangle to the buffer.
    al_draw_filled_triangle(10, 10, 200, 200, 350, 230, al_map_rgb(255,0,0));
    // Draw text to the buffer
    al_draw_text(century_gothic24, al_map_rgb(255,255,255), 550, 440, ALLEGRO_ALIGN_CENTRE, "Hello World!");
    // Draw a line to the buffer
    al_draw_line(400,400,500,34,al_map_rgb(255,255,255), 5);
    // Draw a circle
    al_draw_circle(300,300, 50, al_map_rgb(255,255,0), 5);
    // Draw Eclipse
    al_draw_filled_ellipse(500, 300, 40, 56, al_map_rgb(255,0,255));
    // Draw a rectangle
    al_draw_rectangle(100,200,200,300,al_map_rgb(0,255,0), 6);s
    // Draw a polygon
    al_draw_filled_rectangle(0,480,50,400,al_map_rgb(25,185,35));
    al_draw_filled_rectangle(0,480,200,450,al_map_rgb(25,185,35));
    // Apply the buffer to the front.
    al_flip_display();
    // Wait for 3 secs.
    al_rest(10.0);
    // Destroying the display we created, to avoid memory leaking.
    al_destroy_display(display);

    return 0;
}
Пример #7
0
/* Draws a thing to the current active drawing target, corresponding 
to it's shape and kind and taking the camera into account.  Useful for 
checking or debugging the physics. */
void thing_draw(Thing * self, Camera * camera) {
  int cx      ; 
  int cy      ;
  int drawx, x;
  int drawy, y;
  int w, h    ;
  int sw, sh  ;
  int sx, sy  ;
  int t       = 2;
  Color color;
  // don't draw null things.
  if(!self) return;
  cx          = camera_at_x(camera);
  cy          = camera_at_y(camera);
  w           = self->size.x;
  h           = self->size.y;
  if ((self->physical) && (self->hull)) {
    x         = bumpbody_p(self->physical).x - bumphull_aabb(self->hull).hs.x;
    y         = bumpbody_p(self->physical).y - bumphull_aabb(self->hull).hs.y;
    w         = bumphull_aabb(self->hull).hs.x * 2;
    h         = bumphull_aabb(self->hull).hs.y * 2;
  } 
  
  color     = color_rgba(0xee, 0x44, 0x00, 0x88);
  t         = 8;
  /* Do not draw out of camera range. */
  if(!camera_cansee(camera, x, y, w, h)) {
    return;
  }
  drawx = x - cx;
  drawy = y - cy;
  /* Draw sprite if available... */
  if(spritestate_can_draw_p(&self->spritestate)) {
    BeVec spriteat = bevec(drawx, drawy);
    /* Draw elliptical shadow under sprite unless disabled */
    if (!(self->flags & THING_FLAGS_NO_SHADOW)) { 
      color     = color_rgbaf(0.0, 0.0, 0.0, 0.5);
      sx        = drawx + w / 2;
      sy        = drawy + ((4*h)/5);
      sw        = (4 * w) / 11;
      sh        = h / 3;
      al_draw_filled_ellipse(sx, sy, sw, sh, color);
    }
    spritestate_draw(&self->spritestate, &spriteat);
  } else {
    /* ...  otherwise debug box to alert scripters of it's absence. */
    draw_box(drawx, drawy, w, h, color, t);
  }
}
Пример #8
0
void shal_draw_filled_ellipse(float cx,
                              float cy,
                              float rx,
                              float ry,
                              float color_r,
                              float color_g,
                              float color_b,
                              float color_a)
{
    ALLEGRO_COLOR color;
    color.r = color_r;
    color.g = color_g;
    color.b = color_b;
    color.a = color_a;
    return al_draw_filled_ellipse(cx, cy, rx, ry, color);
}
Пример #9
0
static void primitive(float l, float t, float r, float b,
   ALLEGRO_COLOR color, bool never_fill)
{
   float cx = (l + r) / 2;
   float cy = (t + b) / 2;
   float rx = (r - l) / 2;
   float ry = (b - t) / 2;
   int tk = never_fill ? 0 : ex.thickness;
   int w = ex.what;
   if (w == 0 && never_fill) w = 1;
   if (w == 2 && never_fill) w = 3;
   if (w == 0) al_draw_filled_rectangle(l, t, r, b, color);
   if (w == 1) al_draw_rectangle(l, t, r, b, color, tk);
   if (w == 2) al_draw_filled_ellipse(cx, cy, rx, ry, color);
   if (w == 3) al_draw_ellipse(cx, cy, rx, ry, color, tk);
   if (w == 4) al_draw_line(l, t, r, b, color, tk);
}
Пример #10
0
void Bomb::draw()
{
    if (exploded_)
    {
        double timeLeft = explosionTime_ - al_get_time();
        if (timeLeft > -0.1)
                al_draw_tinted_bitmap_region(picture_, al_map_rgba(0,0,0,100), 0, 35, 173, 156, posx_-69, posy_-95, 0);
            else if (timeLeft > -0.2)
                al_draw_tinted_bitmap_region(picture_, al_map_rgba(0,0,0,50), 0, 35, 173, 156, posx_-69, posy_-95, 1);
            else
                al_draw_tinted_bitmap_region(picture_, al_map_rgba(0,0,0,20), 0, 35, 173, 156, posx_-69, posy_-95, 2);
        return;
    }

    al_draw_filled_ellipse(posx_+width_/2, posy_- height_/2+5, width_/2, height_/2, al_map_rgba(0,0,0,50));
    if (color_ == 0)
        al_draw_bitmap_region(picture_, pic_width_, 0, pic_width_, pic_height_, posx_, posy_ - pic_height_, 0);
    else
        al_draw_tinted_bitmap_region(picture_, al_map_rgb(255, 0, 0), pic_width_, 0, pic_width_, pic_height_, posx_, posy_ - pic_height_, 0);
}
Пример #11
0
void drawshot(Game *game, int i)
{
    Shot shot;
    shot = game->shots[i];
        if (shot.type==0)
        {
            al_draw_filled_ellipse(shot.posx+shot.szer/2, shot.posy, shot.szer/2, shot.wys/2, al_map_rgba(0,0,0,50));
            if (shot.range<40)
                al_draw_tinted_bitmap(shot.picture,al_map_rgba(255,255,255,200),shot.posx,
                                      shot.posy-shot.posz-shot.wys, 0);
            else
                al_draw_bitmap(shot.picture,shot.posx, shot.posy-shot.posz-shot.wys, 0);
        }
        else if (shot.type==1)
        {
            if (shot.speedx==0)
            {
                if (shot.speedy>0)
                {
                    al_draw_line(shot.posx, shot.posy-shot.posz, shot.posx, game->wys, al_map_rgb(255,0,0),3);
                }
                else
                {
                    al_draw_line(shot.posx, shot.posy-shot.posz, shot.posx, 0, al_map_rgb(255,0,0),3);
                }
            }
            else
            {
                if (shot.speedx>0)
                {
                    al_draw_line(shot.posx, shot.posy, game->szer, shot.posy, al_map_rgba(0,0,0,50),3);
                    al_draw_line(shot.posx, shot.posy-shot.posz, game->szer, shot.posy-shot.posz, al_map_rgb(255,0,0),3);
                }
                else
                {
                    al_draw_line(shot.posx, shot.posy, 0, shot.posy, al_map_rgba(0,0,0,50),3);
                    al_draw_line(shot.posx, shot.posy-shot.posz, 0, shot.posy-shot.posz, al_map_rgb(255,0,0),3);
                }
            }
        }
}
Пример #12
0
static void HighFilledPrimitives(int mode)
{
   if (mode == INIT) {
   
   } else if (mode == LOGIC) {
      Theta += Speed;
      al_build_transform(&MainTrans, ScreenW / 2, ScreenH / 2, 1, 1, Theta);
   } else if (mode == DRAW) {
      if (Blend)
         al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE);
      else
         al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO);
      
      al_use_transform(&MainTrans);
      
      al_draw_filled_triangle(-100, -100, -150, 200, 100, 200, al_map_rgb_f(0.5, 0.7, 0.3));
      al_draw_filled_rectangle(20, -50, 200, 50, al_map_rgb_f(0.3, 0.2, 0.6));
      al_draw_filled_ellipse(-250, 0, 100, 150, al_map_rgb_f(0.3, 0.3, 0.3));
      al_draw_filled_rounded_rectangle(50, -250, 350, -75, 50, 70, al_map_rgb_f(0.4, 0.2, 0));
      al_draw_filled_pieslice(200, 125, 50, ALLEGRO_PI / 4, 3 * ALLEGRO_PI / 2, al_map_rgb_f(0.3, 0.3, 0.1));
      
      al_use_transform(&Identity);
   }
}
 void Ellipse::draw_in_another_target()
 {
     if(get_filled_status())
         al_draw_filled_ellipse(_V_pos_x,_V_pos_y,_V_radius_x,_V_radius_y,_V_color);
     al_draw_ellipse(_V_pos_x,_V_pos_y,_V_radius_x,_V_radius_y,_V_color,_V_thickness);
 }
Пример #14
0
void World::Render()
{
	City* c;
	Animation* a;
	int tileScaleW = visualMap->GetTileWidth() * visualMapScale->X;
	int tileScaleH = visualMap->GetTileHeight() * visualMapScale->Y;
	int tileCentreX;
	int tileCentreY;

	visualMap->Render( 0, 0, visualMapScale->X, visualMapScale->Y );

	// Draw shadow
	for( std::vector<City*>::iterator ci = Cities.begin(); ci != Cities.end(); ci++ )
	{
		c = (City*)(*ci);
		tileCentreX = (c->MapPosition->X * tileScaleW) + (tileScaleW / 2);
		tileCentreY = (c->MapPosition->Y * tileScaleH) + (tileScaleH / 2);
		al_draw_filled_ellipse( tileCentreX, tileCentreY, (tileScaleW / 1.5), (tileScaleH / 4), al_map_rgba( 0, 0, 0, 128 ) );
	}

	if( !IsBetweenTurns )
	{
		for( int li = 0; li < Cities.at(AgentWillis->CurrentCity)->LinkedCityNumbers.size(); li++ )
		{
			Vector2* la = Cities.at(AgentWillis->CurrentCity)->MapPosition;
			Vector2* lb = Cities.at(Cities.at(AgentWillis->CurrentCity)->LinkedCityNumbers.at(li))->MapPosition;
			al_draw_line( (la->X * tileScaleW) + (tileScaleW / 2), (la->Y * tileScaleH) + (tileScaleH / 2), (lb->X * tileScaleW) + (tileScaleW / 2), (lb->Y * tileScaleH) + (tileScaleH / 2), al_map_rgba( 0, 0, 0, 64 ), 3.0f );
		}

		// Draw Navigation Lines
		if( visualNavigationLineIndex > 0 )
		{
			Line* l = new Line( Cities.at(AgentWillis->CurrentCity)->MapPosition, Cities.at(AgentWillis->TargetCity)->MapPosition );

			Vector2* segA = l->GetSegmentPoint( visualNavigationLineIndex, WORLD_NAVIGATION_LINE_SEGMENTS );
			Vector2* segB = l->GetSegmentPoint( visualNavigationLineIndex - 1, WORLD_NAVIGATION_LINE_SEGMENTS );
			segA->X = (segA->X * tileScaleW) + (tileScaleW / 2);
			segA->Y = (segA->Y * tileScaleH) + (tileScaleH / 2);
			segB->X = (segB->X * tileScaleW) + (tileScaleW / 2);
			segB->Y = (segB->Y * tileScaleH) + (tileScaleH / 2);
			al_draw_line( segA->X, segA->Y, segB->X, segB->Y, al_map_rgba( 255, 240, 64, 192 ), 3.0f );
		}
	}

	// Draw Weather Indicator
	for( std::vector<City*>::iterator ci = Cities.begin(); ci != Cities.end(); ci++ )
	{
		c = (City*)(*ci);
		a = WeatherAnimations.at( c->WeatherCondition );

		tileCentreX = (c->MapPosition->X * tileScaleW) + (tileScaleW / 2);
		tileCentreY = (c->MapPosition->Y * tileScaleH) + (tileScaleH / 2);
		a->DrawFrame( tileCentreX - (visualSprites->GetFrame(0)->Width / 2), tileCentreY - visualSprites->GetFrame(0)->Height);
	}

	ProfessorFrost->WorldRender();
	AgentWillis->WorldRender();

	al_draw_filled_rectangle( 0, FRAMEWORK->Display_GetHeight() - (textFontHeight * 3), FRAMEWORK->Display_GetWidth(), FRAMEWORK->Display_GetHeight(), al_map_rgb( 0, 0, 0 ) );


	int curY = FRAMEWORK->Display_GetHeight() - (textFontHeight * 3);
	int tmpX = (FRAMEWORK->Display_GetWidth() / 2) + 20;
	al_draw_text( textFont, al_map_rgb( 255, 255, 0 ), 20, curY, 0, Cities.at( AgentWillis->CurrentCity )->Name->c_str() );
	al_draw_text( textFont, al_map_rgb( 255, 255, 0 ), tmpX, curY, 0, Cities.at( AgentWillis->TargetCity )->Name->c_str() );
	curY += textFontHeight;

	al_draw_textf( textFont, al_map_rgb( 255, 255, 0 ), 20, curY, 0, "Population: %d", (int)(Cities.at( AgentWillis->CurrentCity )->Population * 1000.0) );
	al_draw_textf( textFont, al_map_rgb( 255, 255, 0 ), tmpX, curY, 0, "Population: %d", (int)(Cities.at( AgentWillis->TargetCity )->Population * 1000.0) );
	curY += textFontHeight;

}
Пример #15
0
void m_fill_ellipse(int x, int y, int rx, int ry, MCOLOR color)
{
	if (rx <= 0 || ry <= 0) return;
	al_draw_filled_ellipse(x, y, rx, ry, color);
}
Пример #16
0
void DrawingClass::DrawFilledEllipse (float x0, float y0, float rx, float ry,
    int r, int g, int b) {
  ALLEGRO_COLOR color = al_map_rgb(r, g, b);
  al_draw_filled_ellipse(x0, y0, rx, ry, color);
}
Пример #17
0
void al_draw_filled_ellipse_w(float cx, float cy, float rx, float ry, ALLEGRO_COLOR *color)
{
	al_draw_filled_ellipse(cx, cy, rx, ry, *color);
}