Exemplo n.º 1
0
void Sector::Draw(ALLEGRO_BITMAP* dest, const ALLEGRO_COLOR& color, bool filled) {

    Line initial(GetPosition(), GetStartPoint().GetPosition(), color);
    Line terminal(GetPosition(), GetEndPoint().GetPosition(), color);

    initial.Draw(dest, initial.GetColor(), false);
    terminal.Draw(dest, terminal.GetColor(), false);

    _arc.Draw(dest, color, filled);

    ALLEGRO_BITMAP* old_target = al_get_target_bitmap();

    filled ? al_draw_filled_pieslice(a2de::Math::ToScreenScale(GetX()), a2de::Math::ToScreenScale(GetY()), a2de::Math::ToScreenScale(GetRadius()), GetStartAngle(), GetEndAngle() - GetStartAngle(), color) :
             al_draw_pieslice(a2de::Math::ToScreenScale(GetX()), a2de::Math::ToScreenScale(GetY()), a2de::Math::ToScreenScale(GetRadius()), GetStartAngle(), GetEndAngle() - GetStartAngle(), color, 0.0);

    al_set_target_bitmap(old_target);

}
Exemplo n.º 2
0
void shal_draw_filled_pieslice(float cx,
                               float cy,
                               float r,
                               float start_theta,
                               float delta_theta,
                               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_pieslice(cx,
                                   cy,
                                   r,
                                   start_theta,
                                   delta_theta,
                                   color);
}
Exemplo n.º 3
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);
   }
}