Пример #1
0
		void draw(const paint::paint_params &pp)
		{
			auto &image = holder->player_image;
			image.set_position(get_position());
			image.draw(pp);
			get_circle().draw(pp, holder->black_brush);
		}
Пример #2
0
static guint
create_app (void)
{
	GtkWidget *canvas, *window, *box, *hbox, *control; 
	
        window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	g_signal_connect (G_OBJECT(window), "destroy", 
              G_CALLBACK(on_destroy), NULL);

	gtk_widget_set_usize (GTK_WIDGET(window), 400, 300);
        box = gtk_vbox_new (FALSE, 2);
        gtk_container_add(GTK_CONTAINER(window), box);

	canvas = mate_canvas_new();
        gtk_box_pack_start_defaults (GTK_BOX (box), canvas);
	get_square(mate_canvas_root(MATE_CANVAS(canvas)));
        get_circle(mate_canvas_root(MATE_CANVAS(canvas)));

        hbox = gtk_hbox_new(FALSE, 2);
        gtk_box_pack_start (GTK_BOX (box), hbox, FALSE, FALSE, 0);

        control = matecomponent_widget_new_control("OAFIID:Circle_Controller", NULL);
        gtk_box_pack_start (GTK_BOX (hbox), control, FALSE, FALSE, 0);

        control = matecomponent_widget_new_control("OAFIID:Square_Controller", NULL);
        gtk_box_pack_start (GTK_BOX (hbox), control, FALSE, FALSE, 0);

	gtk_widget_show_all (GTK_WIDGET(window));

	return FALSE;
}
Пример #3
0
  Datum  spherecircle_in(PG_FUNCTION_ARGS)
  {
    SCIRCLE  * c  = ( SCIRCLE * ) MALLOC ( sizeof ( SCIRCLE ) ) ;
    char     * s  = PG_GETARG_CSTRING(0);
    double lng, lat, radius ;

    void sphere_yyparse( void );

    init_buffer ( s );
    sphere_yyparse();
    if ( get_circle( &lng, &lat, &radius ) ){
      c->center.lng  = lng;
      c->center.lat  = lat;
      c->radius      = radius;
      reset_buffer();
      /*
        It's important to allow circles with radius 90deg!!      
      */
      if ( FPgt(c->radius,PIH) ){
        FREE( c );
        c = NULL;
        elog ( ERROR , "spherecircle_in: radius must be not greater than 90 degrees" );
      } else if ( FPeq(c->radius,PIH) ){
        // set "exact" 90 degrees
        c->radius = PIH;
      }
      spoint_check ( &c->center );
    } else {
      reset_buffer();
      FREE( c );
      c = NULL;
      elog ( ERROR , "spherecircle_in: parse error" );
    }
    PG_RETURN_POINTER( c );
  }
Пример #4
0
int digitize(FILE * fd)
{
    int any;
    struct Categories labels;

    G_init_cats((CELL) 0, "", &labels);
    any = 0;
    for (;;) {
	switch (get_type()) {
	case 'A':		/* area */
	    if (get_area(fd, &labels))
		any = 1;
	    break;
	case 'C':		/* circle */
	    if (get_circle(fd, &labels))
		any = 1;
	    break;
	case 'L':		/* line */
	    if (get_line(fd, &labels))
		any = 1;
	    break;
	case 'X':		/* done */
	    return any;
	case 'Q':		/* exit without saving */
	    if (G_yes(_("Quit without creating a map?? "), 0))
		return 0;
	}
    }
}
Пример #5
0
void Damageable::default_render_health(Graphic& graphic, const Color& color, float frames_count) const {
    if (has_hp()) {
        Box health_box;

        health_box.set_size(50.f * get_hp() / get_default_hp(), 5.f);
        health_box.set_left_top(
                get_position().x - health_box.get_width() / 2 + get_current_speed().x * frames_count,
                get_position().y - get_circle().get_radius() + get_current_speed().y * frames_count
        );

        graphic.render_box(health_box, color);
    }
}
int
AsciiProcessor::get_circles( const char * buf,
                             Multi< Circle2d > & circles,
                             char const * & next )
{
    int res;
    int k = 0;

    while ( 1 )
    {
        if ( k >= circles.max_size )
        {
            circles.set_cur_size( k ); //do not loose entries
            circles.set_max_size_and_preserve_cur_size( k + k + 1 );
        }

        res = get_circle( buf, circles.tab[k], next );

        if ( res == -1 )
        {
            break;
        }

        if ( res != 3 )
        {
            return -1;
        }

        buf = next;

        ++k;
    };

    if ( ! strskip( buf, DELIMITER_CHAR, next ) )
    {
        P_ERROR( "wrong delimiter char" );
        return -1;
    }

    circles.set_cur_size( k );

    return k;
}
Пример #7
0
 bool is_colliding(const character &c)
 {
     return get_circle().is_colliding(c.get_circle());
 }
Пример #8
0
		void draw(const paint::paint_params &pp, const paint::brush &brush)
		{
			get_circle().fill(pp, brush);
		}
Пример #9
0
			void draw(const paint::paint_params &pp) override
			{
				get_circle().fill(pp, holder->black_brush);
			}