/* ----------------------------------------------------------------------------
 * Draws the circle and the pointer.
 */
void angle_picker::draw_self() {
    float circle_r = (y2 - y1) / 2;
    float circle_cx = x1 + circle_r;
    float circle_cy = y1 + circle_r;
    al_draw_filled_circle(circle_cx, circle_cy, circle_r, get_bg_color());
    al_draw_arc(circle_cx, circle_cy, circle_r, M_PI_2 + M_PI_4, M_PI, get_darker_bg_color(), 1);
    al_draw_arc(circle_cx, circle_cy, circle_r, M_PI_2 + M_PI_4 + M_PI, M_PI, get_lighter_bg_color(), 1);
    al_draw_line(
        circle_cx, circle_cy,
        circle_cx + cos(angle) * circle_r,
        circle_cy + sin(angle) * circle_r,
        get_fg_color(), 2
    );
}
예제 #2
0
		void ShapeRenderer::drawArc(float x, float y, float rad, float iPheta, float dPheta, uint8_t r, uint8_t g, uint8_t b, uint8_t a, float thickness)
		{
			ALLEGRO_COLOR color;
			if (a != UINT8_MAX)
				color = al_map_rgba(r, g, b, a);
			else
				color = al_map_rgb(r, g, b);
			float adjustedX = (x + xOff) * xScale;
			float adjustedY = (y + yOff) * yScale;
			al_draw_arc(adjustedX, adjustedY, rad * ((xScale + yScale) / 2), iPheta, dPheta, color, thickness);
		}
예제 #3
0
파일: weapon_sys.c 프로젝트: rcorre/alecs
void weapon_system_draw() {
  if (current_target) {
    al_draw_arc(current_target->position.x, current_target->position.y,
        indicator_radius, 0,
        2 * PI * current_lockon_time / current_weapon->lockon_time,
        PRIMARY_LOCK_COLOR, indicator_thickness);
  }
  if (lockon_list) {
    list *already_drawn = list_new();
    for (list_node *node = lockon_list->head; node; node = node->next) {
      ecs_entity *target = node->value;
      if (list_find(already_drawn, target)) { continue; }
      list_push(already_drawn, target);
      draw_lockon(target, list_count(lockon_list, target));
    }
    list_free(already_drawn, NULL);
  }
}
예제 #4
0
static void TransformationsPrimitives(int mode)
{
   float t = al_get_time();
   if (mode == INIT) {
   
   } else if (mode == LOGIC) {
      Theta += Speed;
      al_build_transform(&MainTrans, ScreenW / 2, ScreenH / 2, sinf(t / 5), cosf(t / 5), Theta);
   } else if (mode == DRAW) {
      float points[8] = {
         -300, -200,
         700, 200,
         -700, 200,
         300, -200
      };
      
      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_line(-300, -200, 300, 200, al_map_rgba_f(0, 0.5, 0.5, 1), Thickness);
      al_draw_triangle(-150, -250, 0, 250, 150, -250, al_map_rgba_f(0.5, 0, 0.5, 1), Thickness);
      al_draw_rectangle(-300, -200, 300, 200, al_map_rgba_f(0.5, 0, 0, 1), Thickness);
      al_draw_rounded_rectangle(-200, -125, 200, 125, 50, 100, al_map_rgba_f(0.2, 0.2, 0, 1), Thickness);
      
      al_draw_ellipse(0, 0, 300, 150, al_map_rgba_f(0, 0.5, 0.5, 1), Thickness);
      al_draw_elliptical_arc(-20, 0, 300, 200, -ALLEGRO_PI / 2, -ALLEGRO_PI, al_map_rgba_f(0.25, 0.25, 0.5, 1), Thickness);
      al_draw_arc(0, 0, 200, -ALLEGRO_PI / 2, ALLEGRO_PI, al_map_rgba_f(0.5, 0.25, 0, 1), Thickness);
      al_draw_spline(points, al_map_rgba_f(0.1, 0.2, 0.5, 1), Thickness);
      al_draw_pieslice(0, 25, 150, ALLEGRO_PI * 3 / 4, -ALLEGRO_PI / 2, al_map_rgba_f(0.4, 0.3, 0.1, 1), Thickness);
      
      al_use_transform(&Identity);
   }
}
예제 #5
0
void shal_draw_arc(float cx,
                   float cy,
                   float r,
                   float start_theta,
                   float delta_theta,
                   float color_r,
                   float color_g,
                   float color_b,
                   float color_a,
                   float thickness)
{
    ALLEGRO_COLOR color;
    color.r = color_r;
    color.g = color_g;
    color.b = color_b;
    color.a = color_a;
    return al_draw_arc(cx,
                       cy,
                       r,
                       start_theta,
                       delta_theta,
                       color,
                       thickness);
}
void SVSlime::onDraw(void)
{
	al_draw_arc(x, y, bodyRadius / 2.0, M_PI, M_PI, bodyColor, bodyRadius);
}
예제 #7
0
void al_draw_arc_w(float cx, float cy, float r, float start_theta, float delta_theta, ALLEGRO_COLOR *color, float thickness)
{
	al_draw_arc(cx, cy, r, start_theta, delta_theta, *color, thickness);
}